Compare commits
No commits in common. "54c2b0735e3cfb8949d2472aeb7cd2923dc887a6" and "5418b2bdda004154621d9a6446ae195bc30737eb" have entirely different histories.
54c2b0735e
...
5418b2bdda
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -18,5 +18,3 @@ const (
|
|||
FortuneDragonPlayerOpSwitch
|
||||
)
|
||||
const NowByte int64 = 10000
|
||||
|
||||
const GameDataKey = "FortuneData"
|
||||
|
|
|
@ -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[string]*model.PlayerGameData),
|
||||
GameData: make(map[int32]*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 == "" {
|
||||
if v.Id == 0 {
|
||||
v.Id = k
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,17 +2,16 @@ package fortunedragon
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"mongo.games.com/game/gamerule/fortunedragon"
|
||||
"mongo.games.com/game/gamesrv/slotspkg/assemble"
|
||||
"mongo.games.com/game/gamesrv/slotspkg/slots"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/gamerule/fortunedragon"
|
||||
"mongo.games.com/game/gamesrv/base"
|
||||
"mongo.games.com/game/gamesrv/slotspkg/assemble"
|
||||
"mongo.games.com/game/gamesrv/slotspkg/slots"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
protocol "mongo.games.com/game/protocol/fortunedragon"
|
||||
)
|
||||
|
@ -78,14 +77,6 @@ func (this *ScenePolicyFortuneDragon) OnPlayerEnter(s *base.Scene, p *base.Playe
|
|||
logger.Logger.Trace("(this *ScenePolicyFortuneDragon) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name)
|
||||
if sceneEx, ok := s.GetExtraData().(*FortuneDragonSceneData); ok {
|
||||
playerEx := &FortuneDragonPlayerData{Player: p}
|
||||
|
||||
d := p.GameData[fortunedragon.GameDataKey]
|
||||
if d != nil {
|
||||
m := map[string]string{}
|
||||
json.Unmarshal(d.Data.([]byte), &m)
|
||||
playerEx.PullPlayer(m)
|
||||
}
|
||||
|
||||
playerEx.init()
|
||||
playerEx.Clear()
|
||||
|
||||
|
@ -108,23 +99,6 @@ func (this *ScenePolicyFortuneDragon) OnPlayerLeave(s *base.Scene, p *base.Playe
|
|||
s.FirePlayerEvent(p, base.PlayerEventLeave, nil)
|
||||
sceneEx.OnPlayerLeave(p, reason)
|
||||
}
|
||||
|
||||
if playerEx, ok := p.ExtraData.(*FortuneDragonPlayerData); ok {
|
||||
m := playerEx.PushPlayer()
|
||||
if m != nil && len(m) > 0 {
|
||||
b, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
logger.Logger.Error("OnPlayerLeave, json.Marshal error:", err)
|
||||
} else {
|
||||
p.GameData[fortunedragon.GameDataKey] = &model.PlayerGameData{
|
||||
Platform: p.Platform,
|
||||
SnId: p.SnId,
|
||||
Id: fortunedragon.GameDataKey,
|
||||
Data: b,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 玩家掉线
|
||||
|
|
|
@ -348,7 +348,7 @@ type MatchFreeSignupRec struct {
|
|||
// 大厅玩家信息发送给游戏服
|
||||
type WGPlayerInfo struct {
|
||||
*PlayerData
|
||||
GameData map[string]*PlayerGameData // 游戏数据,只允许存储玩家对应某个游戏需要持久化的数据
|
||||
GameData map[int32]*PlayerGameData // 游戏数据,只允许存储玩家对应某个游戏需要持久化的数据
|
||||
}
|
||||
|
||||
type PlayerData struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
type PlayerGameData struct {
|
||||
Platform string `bson:"-"`
|
||||
SnId int32
|
||||
Id string // 游戏id或场次id
|
||||
Id int32 // 游戏id或场次id
|
||||
Data interface{} // 数据
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ type AllPlayerInfo struct {
|
|||
|
||||
// PlayerInfo 玩家信息
|
||||
type PlayerInfo struct {
|
||||
GameData map[string]*model.PlayerGameData // 游戏数据
|
||||
GameData map[int32]*model.PlayerGameData // 游戏数据
|
||||
}
|
||||
|
||||
type PlayerInfoMgr struct {
|
||||
|
@ -69,7 +69,7 @@ func (p *PlayerInfoMgr) Callback(player any, ret *internal.PlayerLoadReplay) {
|
|||
return
|
||||
}
|
||||
info := &PlayerInfo{
|
||||
GameData: make(map[string]*model.PlayerGameData),
|
||||
GameData: make(map[int32]*model.PlayerGameData),
|
||||
}
|
||||
|
||||
// 游戏数据
|
||||
|
|
Loading…
Reference in New Issue