mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
优化玩家管理器
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"hk4e/pkg/reflection"
|
||||
"hk4e/protocol/cmd"
|
||||
"hk4e/protocol/proto"
|
||||
"time"
|
||||
)
|
||||
|
||||
var GAME_MANAGER *GameManager = nil
|
||||
@@ -69,8 +70,10 @@ func (g *GameManager) Start() {
|
||||
|
||||
func (g *GameManager) Stop() {
|
||||
// 保存玩家数据
|
||||
USER_MANAGER.SaveUser()
|
||||
|
||||
LOCAL_EVENT_MANAGER.localEventChan <- &LocalEvent{
|
||||
EventId: RunUserCopyAndSave,
|
||||
}
|
||||
time.Sleep(time.Second * 5)
|
||||
//g.worldManager.worldStatic.SaveTerrain()
|
||||
}
|
||||
|
||||
@@ -115,6 +118,18 @@ func (g *GameManager) CommonRetError(cmdId uint16, player *model.Player, rsp pb.
|
||||
g.SendMsg(cmdId, player.PlayerID, player.ClientSeq, rsp)
|
||||
}
|
||||
|
||||
// CommonRetSucc 通用返回成功
|
||||
func (g *GameManager) CommonRetSucc(cmdId uint16, player *model.Player, rsp pb.Message) {
|
||||
if rsp == nil {
|
||||
return
|
||||
}
|
||||
ok := reflection.SetStructFieldValue(rsp, "Retcode", int32(proto.Retcode_RET_SUCC))
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
g.SendMsg(cmdId, player.PlayerID, player.ClientSeq, rsp)
|
||||
}
|
||||
|
||||
func (g *GameManager) ReconnectPlayer(userId uint32) {
|
||||
g.SendMsg(cmd.ClientReconnectNotify, userId, 0, new(proto.ClientReconnectNotify))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user