Compare commits
No commits in common. "fafc946f759cc9f293743d8cacea5c3780ab67d8" and "d3642c93e454e5a4925d3cc7aabccfb66263e5f7" have entirely different histories.
fafc946f75
...
d3642c93e4
|
@ -38,24 +38,12 @@ func init() {
|
||||||
return &serverproto.GWPlayerLeave{}
|
return &serverproto.GWPlayerLeave{}
|
||||||
}))
|
}))
|
||||||
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_PLAYERLEAVE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
|
netlib.RegisterHandler(int(serverproto.SSPacketID_PACKET_GW_PLAYERLEAVE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
|
||||||
logger.Logger.Trace("receive GWPlayerLeave:", pack)
|
if msg, ok := pack.(*serverproto.GWPlayerLeave); ok {
|
||||||
msg, ok := pack.(*serverproto.GWPlayerLeave)
|
logger.Logger.Trace("receive GWPlayerLeave:", msg.GetPlayerId())
|
||||||
if !ok {
|
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()))
|
||||||
return nil
|
if scene != nil {
|
||||||
}
|
|
||||||
|
|
||||||
scene := SceneMgrSingleton.GetScene(int(msg.GetRoomId()), true)
|
|
||||||
if scene == nil {
|
|
||||||
logger.Logger.Warnf("玩家离开房间,房间没找到 %v", pack)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
p := PlayerMgrSington.GetPlayerBySnId(msg.GetPlayerId())
|
p := PlayerMgrSington.GetPlayerBySnId(msg.GetPlayerId())
|
||||||
if p == nil {
|
if p != nil {
|
||||||
logger.Logger.Warnf("玩家离开房间,玩家信息没找到 %v", pack)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
data := msg.GetPlayerData()
|
data := msg.GetPlayerData()
|
||||||
if len(data) != 0 {
|
if len(data) != 0 {
|
||||||
logger.Logger.Trace("GWPlayerLeave p.UnmarshalData(data)")
|
logger.Logger.Trace("GWPlayerLeave p.UnmarshalData(data)")
|
||||||
|
@ -182,6 +170,12 @@ func init() {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.Logger.Tracef("GWPlayerLeave LocalRobotIdMgrSington %v", msg.GetPlayerId())
|
||||||
|
//LocalRobotIdMgrSington.FreeId(msg.GetPlayerId())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -102,14 +102,8 @@ func (m *SceneMgr) GetPlatformBySceneId(sceneId int) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetScene 获取房间对象
|
// GetScene 获取房间对象
|
||||||
// 默认是不包含删除中的房间
|
func (m *SceneMgr) GetScene(sceneId int) *Scene {
|
||||||
// hasDeleting true 包含删除中的房间
|
if s, exist := m.scenes[sceneId]; exist && !s.deleting {
|
||||||
func (m *SceneMgr) GetScene(sceneId int, hasDeleting ...bool) *Scene {
|
|
||||||
has := false
|
|
||||||
if len(hasDeleting) > 0 {
|
|
||||||
has = hasDeleting[0]
|
|
||||||
}
|
|
||||||
if s, exist := m.scenes[sceneId]; exist && (has || !s.deleting) {
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue