Commit 7c039f19 authored by hujiebin's avatar hujiebin

H5游戏静音

parent 902884c1
......@@ -377,6 +377,10 @@ message SheepMatchSuccess {
User user = 2;
User otherUser = 3;
uint64 game_id = 4;
string channelId = 5;
string token = 6;
uint32 agoraId = 7;
uint32 provider = 8;
}
message SheepGamePlayer {
......@@ -473,4 +477,12 @@ message LobbyMatchSuccess {
User user = 4;
User otherUser = 5;
string gameCode = 6;
}
\ No newline at end of file
}
/* id == 158 H5游戏静音 */
message H5GameVoiceMute {
}
/* id == 159 H5游戏打开语音 */
message H5GameVoiceUnMute {
}
......@@ -68,6 +68,8 @@ const (
MsgTypeSvipUpgrade = 151 // svip升级
MsgTypeGroupMicChange = 155 // 麦位变化
MsgTypeLobbyMatchSuccess = 157 // 羊羊匹配成功
MsgTypeH5GameMute = 158 // H5游戏静音
MsgTypeH5GameUnMute = 159 // H5游戏开音
)
const (
......
......@@ -255,6 +255,7 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string
}
// 羊羊匹配成功
// Deprecated: missing Params
func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string, gameIds ...uint64) error {
gameId := uint64(0)
if len(gameIds) > 0 {
......@@ -288,6 +289,40 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2,
return nil
}
// 羊羊匹配成功
func SendSheepMatchSuccessV2(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string, gameId uint64, channelId, token string, agoraId uint32, provider int) error {
msg := &userProxy.SheepMatchSuccess{
MatchId: matchId,
User: &userProxy.User{Id: myUserId, Nick: nick1, Avatar: avatar1},
OtherUser: &userProxy.User{Id: otherUserId, Nick: nick2, Avatar: avatar2},
GameId: gameId,
ChannelId: channelId,
Token: token,
AgoraId: agoraId,
Provider: uint32(provider),
}
if buffer, err := proto.Marshal(msg); err == nil {
userIds := []uint64{myUserId}
rspUids, err := multicast(userIds, MsgTypeSheepGameMatchSuccess, buffer)
//记录socket,注意闭包问题
go func(userIds []uint64, msg *userProxy.SheepMatchSuccess, rspUids []uint64, err error) {
buf, _ := json.Marshal(msg)
AddRpcLogs(MsgTypeSheepGameMatchSuccess, userIds, string(buf[:]), rspUids, err)
}(userIds, msg, rspUids, err)
if err != nil {
mylogrus.MyLog.Errorf("grpc SendSheepMatchSuccess send fail")
return err
} else {
mylogrus.MyLog.Info("grpc SendSheepMatchSuccess send success")
}
} else {
return err
}
return nil
}
// 羊羊游戏结果
func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, avatar1, avatar2 string, isAiMap map[uint64]bool, gameIds ...uint64) error {
if isAiMap == nil {
......@@ -508,3 +543,51 @@ func SendLobbyMatchSuccess(myUserId, otherUserId uint64, nick1, nick2, avatar1,
}
return nil
}
// h5游戏静音
func SendH5GameMute(userId uint64) error {
msg := &userProxy.H5GameVoiceMute{}
if buffer, err := proto.Marshal(msg); err == nil {
rspUids, err := multicast([]uint64{userId}, MsgTypeH5GameMute, buffer)
//记录socket,注意闭包问题
go func(userId uint64, msg *userProxy.H5GameVoiceMute, rspUids []uint64, err error) {
buf, _ := json.Marshal(msg)
AddRpcLog(MsgTypeH5GameUnMute, userId, string(buf[:]), rspUids, err)
}(userId, msg, rspUids, err)
if err != nil {
mylogrus.MyLog.Errorf("grpc SendH5GameMute send fail")
return err
} else {
mylogrus.MyLog.Info("grpc SendH5GameMute send success")
}
} else {
return err
}
return nil
}
// h5游戏开音
func SendH5GameUnMute(userId uint64) error {
msg := &userProxy.H5GameVoiceUnMute{}
if buffer, err := proto.Marshal(msg); err == nil {
rspUids, err := multicast([]uint64{userId}, MsgTypeH5GameUnMute, buffer)
//记录socket,注意闭包问题
go func(userId uint64, msg *userProxy.H5GameVoiceUnMute, rspUids []uint64, err error) {
buf, _ := json.Marshal(msg)
AddRpcLog(MsgTypeH5GameUnMute, userId, string(buf[:]), rspUids, err)
}(userId, msg, rspUids, err)
if err != nil {
mylogrus.MyLog.Errorf("grpc SendH5GameUnMute send fail")
return err
} else {
mylogrus.MyLog.Info("grpc SendH5GameUnMute send success")
}
} else {
return err
}
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment