修复游戏对象id错误导致的同步问题
This commit is contained in:
+3
-2
@@ -79,7 +79,7 @@ func StartGameListen() {
|
|||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 开始游戏
|
// 对方同意开始游戏
|
||||||
router.POST("/start_game", func(c *gin.Context) {
|
router.POST("/start_game", func(c *gin.Context) {
|
||||||
user, msg, is := service.PublicPostCheck(c)
|
user, msg, is := service.PublicPostCheck(c)
|
||||||
if !is {
|
if !is {
|
||||||
@@ -89,8 +89,9 @@ func StartGameListen() {
|
|||||||
game.itemX = float32(msg["x"].(float64))
|
game.itemX = float32(msg["x"].(float64))
|
||||||
game.itemY = float32(msg["y"].(float64))
|
game.itemY = float32(msg["y"].(float64))
|
||||||
game.winSum = int(msg["win"].(float64))
|
game.winSum = int(msg["win"].(float64))
|
||||||
|
gameUuid := msg["game_uuid"].(string)
|
||||||
online := &models.Online{ID: user.ID, Ip: user.Ip, Port: user.Port}
|
online := &models.Online{ID: user.ID, Ip: user.Ip, Port: user.Port}
|
||||||
game.AddNet(utils.Uuid.CreateUUID(), 1, online, &user.Users)
|
game.AddNet(gameUuid, 1, online, &user.Users)
|
||||||
game.Show()
|
game.Show()
|
||||||
c.JSON(200, gin.H{"message": "ok"})
|
c.JSON(200, gin.H{"message": "ok"})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user