From 67a85f6535f6411a0fccb77e9d034d65943e135c Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 6 Sep 2024 17:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E6=88=BF=E9=97=B4=E6=B2=A1?= =?UTF-8?q?=E4=BA=BA=E8=A7=A3=E6=95=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/action/action_game.go | 37 -------------------------- gamesrv/tienlen/scenepolicy_tienlen.go | 6 ++--- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/gamesrv/action/action_game.go b/gamesrv/action/action_game.go index 344fa6e..8148257 100644 --- a/gamesrv/action/action_game.go +++ b/gamesrv/action/action_game.go @@ -13,43 +13,6 @@ import ( "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 CSLeaveRoomHandler struct { diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 46bf98c..6a90360 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -148,6 +148,9 @@ func (this *ScenePolicyTienLen) OnPlayerLeave(s *base.Scene, p *base.Player, rea } sceneEx.OnPlayerLeave(p, 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.SetTimerRandomRobot(s.GetRobotTime()) } - if s.IsCustom() && len(s.Players) == 0 { - s.Destroy(true) - } } // 发送玩家操作情况