From f056014c50a2133d50715f79e41f6e4ee0d5a9f7 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Thu, 5 Sep 2024 11:24:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E6=B8=B8=E6=88=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/base/player.go | 4 ++-- model/player.go | 2 +- model/playergamedata.go | 2 +- worldsrv/playerinfo.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gamesrv/base/player.go b/gamesrv/base/player.go index 9b29b76..7a8c0cb 100644 --- a/gamesrv/base/player.go +++ b/gamesrv/base/player.go @@ -149,7 +149,7 @@ func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player { ShopLastLookTime: make(map[int32]int64), IsFoolPlayer: make(map[string]bool), }, - GameData: make(map[int32]*model.PlayerGameData), + GameData: make(map[string]*model.PlayerGameData), } if p.init(data) { @@ -383,7 +383,7 @@ func (this *Player) MarshalData(gameid int) (d []byte, e error) { if v.Platform == "" { v.Platform = this.Platform } - if v.Id == 0 { + if v.Id == "" { v.Id = k } } diff --git a/model/player.go b/model/player.go index c26829f..27cf053 100644 --- a/model/player.go +++ b/model/player.go @@ -348,7 +348,7 @@ type MatchFreeSignupRec struct { // 大厅玩家信息发送给游戏服 type WGPlayerInfo struct { *PlayerData - GameData map[int32]*PlayerGameData // 游戏数据,只允许存储玩家对应某个游戏需要持久化的数据 + GameData map[string]*PlayerGameData // 游戏数据,只允许存储玩家对应某个游戏需要持久化的数据 } type PlayerData struct { diff --git a/model/playergamedata.go b/model/playergamedata.go index 0fd4a07..be6677c 100644 --- a/model/playergamedata.go +++ b/model/playergamedata.go @@ -9,7 +9,7 @@ import ( type PlayerGameData struct { Platform string `bson:"-"` SnId int32 - Id int32 // 游戏id或场次id + Id string // 游戏id或场次id Data interface{} // 数据 } diff --git a/worldsrv/playerinfo.go b/worldsrv/playerinfo.go index 850c073..70b2f3c 100644 --- a/worldsrv/playerinfo.go +++ b/worldsrv/playerinfo.go @@ -30,7 +30,7 @@ type AllPlayerInfo struct { // PlayerInfo 玩家信息 type PlayerInfo struct { - GameData map[int32]*model.PlayerGameData // 游戏数据 + GameData map[string]*model.PlayerGameData // 游戏数据 } type PlayerInfoMgr struct { @@ -69,7 +69,7 @@ func (p *PlayerInfoMgr) Callback(player any, ret *internal.PlayerLoadReplay) { return } info := &PlayerInfo{ - GameData: make(map[int32]*model.PlayerGameData), + GameData: make(map[string]*model.PlayerGameData), } // 游戏数据