Commit 2f3874ad authored by hujiebin's avatar hujiebin

匹配成功

parent 0726a0cb
...@@ -376,6 +376,7 @@ message SheepMatchSuccess { ...@@ -376,6 +376,7 @@ message SheepMatchSuccess {
uint64 match_id = 1; uint64 match_id = 1;
User user = 2; User user = 2;
User otherUser = 3; User otherUser = 3;
uint64 game_id = 4;
} }
message SheepGamePlayer { message SheepGamePlayer {
...@@ -388,6 +389,7 @@ message SheepGamePlayer { ...@@ -388,6 +389,7 @@ message SheepGamePlayer {
message SheepGameResult { message SheepGameResult {
uint64 match_id = 1; uint64 match_id = 1;
repeated SheepGamePlayer players = 2; repeated SheepGamePlayer players = 2;
uint64 game_id = 3;
} }
/* id == 149 cp邀请 */ /* id == 149 cp邀请 */
......
...@@ -224,11 +224,16 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string ...@@ -224,11 +224,16 @@ func SendGroupChatNotice(fromUserId uint64, userIds []uint64, senderExtId string
} }
// 羊羊匹配成功 // 羊羊匹配成功
func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string) error { func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, avatar1, avatar2 string, gameIds ...uint64) error {
gameId := uint64(0)
if len(gameIds) > 0 {
gameId = gameIds[0]
}
msg := &userProxy.SheepMatchSuccess{ msg := &userProxy.SheepMatchSuccess{
MatchId: matchId, MatchId: matchId,
User: &userProxy.User{Id: myUserId, Nick: nick1, Avatar: avatar1}, User: &userProxy.User{Id: myUserId, Nick: nick1, Avatar: avatar1},
OtherUser: &userProxy.User{Id: otherUserId, Nick: nick2, Avatar: avatar2}, OtherUser: &userProxy.User{Id: otherUserId, Nick: nick2, Avatar: avatar2},
GameId: gameId,
} }
if buffer, err := proto.Marshal(msg); err == nil { if buffer, err := proto.Marshal(msg); err == nil {
userIds := []uint64{myUserId} userIds := []uint64{myUserId}
...@@ -253,7 +258,7 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2, ...@@ -253,7 +258,7 @@ func SendSheepMatchSuccess(matchId, myUserId, otherUserId uint64, nick1, nick2,
} }
// 羊羊游戏结果 // 羊羊游戏结果
func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, avatar1, avatar2 string, isAiMap map[uint64]bool) error { func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, avatar1, avatar2 string, isAiMap map[uint64]bool, gameIds ...uint64) error {
if isAiMap == nil { if isAiMap == nil {
isAiMap = make(map[uint64]bool) isAiMap = make(map[uint64]bool)
} }
...@@ -270,9 +275,14 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2, ...@@ -270,9 +275,14 @@ func SendSheepGameResult(matchId, winId, userId1, userId2 uint64, nick1, nick2,
for i := range players { for i := range players {
players[i].Rank = int32(i) + 1 players[i].Rank = int32(i) + 1
} }
gameId := uint64(0)
if len(gameIds) > 0 {
gameId = gameIds[0]
}
msg := &userProxy.SheepGameResult{ msg := &userProxy.SheepGameResult{
MatchId: matchId, MatchId: matchId,
Players: players, Players: players,
GameId: gameId,
} }
if buffer, err := proto.Marshal(msg); err == nil { if buffer, err := proto.Marshal(msg); err == nil {
var userIds []uint64 var userIds []uint64
......
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