竞技房间没人解散
This commit is contained in:
parent
5bdf3d78df
commit
67a85f6535
|
@ -13,43 +13,6 @@ import (
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CSDestroyRoomPacketFactory struct {
|
|
||||||
}
|
|
||||||
type CSDestroyRoomHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *CSDestroyRoomPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &gamehall.CSDestroyRoom{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *CSDestroyRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
|
||||||
logger.Logger.Trace("CSDestroyRoomHandler Process recv ", data)
|
|
||||||
p := base.PlayerMgrSington.GetPlayer(sid)
|
|
||||||
if p == nil {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler p == nil")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
scene := p.GetScene()
|
|
||||||
if scene == nil {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler p.GetScene() == nil")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if !scene.HasPlayer(p) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if scene.Creator != p.SnId {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler s.creator != p.AccountId")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// 房卡场开始后不能解散
|
|
||||||
if scene.IsCustom() && scene.NumOfGames > 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
scene.Destroy(true)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type CSLeaveRoomPacketFactory struct {
|
type CSLeaveRoomPacketFactory struct {
|
||||||
}
|
}
|
||||||
type CSLeaveRoomHandler struct {
|
type CSLeaveRoomHandler struct {
|
||||||
|
|
|
@ -148,6 +148,9 @@ func (this *ScenePolicyTienLen) OnPlayerLeave(s *base.Scene, p *base.Player, rea
|
||||||
}
|
}
|
||||||
sceneEx.OnPlayerLeave(p, reason)
|
sceneEx.OnPlayerLeave(p, reason)
|
||||||
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
||||||
|
if s.IsCustom() && len(s.Players) == 0 {
|
||||||
|
s.Destroy(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 玩家掉线
|
// 玩家掉线
|
||||||
|
@ -603,9 +606,6 @@ func (this *SceneBaseStateTienLen) OnTick(s *base.Scene) {
|
||||||
s.RandRobotCnt()
|
s.RandRobotCnt()
|
||||||
s.SetTimerRandomRobot(s.GetRobotTime())
|
s.SetTimerRandomRobot(s.GetRobotTime())
|
||||||
}
|
}
|
||||||
if s.IsCustom() && len(s.Players) == 0 {
|
|
||||||
s.Destroy(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送玩家操作情况
|
// 发送玩家操作情况
|
||||||
|
|
Loading…
Reference in New Issue