game_sync/gatesrv/serverctrl.go

26 lines
708 B
Go

package main
import (
"mongo.games.com/game/common"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/server"
"mongo.games.com/goserver/core/mongo"
"mongo.games.com/goserver/srvlib"
)
func init() {
common.RegisteServerCtrlCallback(func(code int32) {
switch code {
case common.SrvCtrlStateSwitchCode:
pack := &server.ServerStateSwitch{
SrvType: proto.Int(common.GetSelfSrvType()),
SrvId: proto.Int(common.GetSelfSrvId()),
}
proto.SetDefaults(pack)
srvlib.ServerSessionMgrSington.Broadcast(int(server.SSPacketID_PACKET_GB_STATE_SWITCH), pack, common.GetSelfAreaId(), srvlib.WorldServerType)
case common.SrvCtrlResetMgoSession:
mongo.ResetAllSession()
}
})
}