From 1b2a9c30e7b133c66241aa1af28da5df4f596e1a Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 18 Sep 2024 14:59:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=88=BF=E5=8D=A1=E6=88=BF?= =?UTF-8?q?=E7=A6=BB=E5=BC=80=E5=92=8C=E5=BC=80=E5=A7=8B=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/tienlen/scenedata_tienlen.go | 2 +- gamesrv/tienlen/scenepolicy_tienlen.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gamesrv/tienlen/scenedata_tienlen.go b/gamesrv/tienlen/scenedata_tienlen.go index e06b45f..d01ee18 100644 --- a/gamesrv/tienlen/scenedata_tienlen.go +++ b/gamesrv/tienlen/scenedata_tienlen.go @@ -163,7 +163,7 @@ func (this *TienLenSceneData) CanStart() bool { } if this.IsCustom() { - return this.IsAllReady() && this.GetPlayerCnt() >= this.GetPlayerNum() + return (this.IsAllReady() || this.GetNumOfGames() > 0) && this.GetPlayerCnt() >= this.GetPlayerNum() } // 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主 diff --git a/gamesrv/tienlen/scenepolicy_tienlen.go b/gamesrv/tienlen/scenepolicy_tienlen.go index 2cbd208..efa7157 100644 --- a/gamesrv/tienlen/scenepolicy_tienlen.go +++ b/gamesrv/tienlen/scenepolicy_tienlen.go @@ -603,6 +603,10 @@ func (this *SceneBaseStateTienLen) OnTick(s *base.Scene) { s.RandRobotCnt() s.SetTimerRandomRobot(s.GetRobotTime()) } + // 房卡房长时间没人解散房间 + if s.IsCustom() && s.GetRealPlayerCnt() == 0 && this.GetTimeout(s) > 5 { + s.Destroy(true) + } } // 发送玩家操作情况 @@ -719,7 +723,7 @@ func (this *SceneWaitPlayerStateTienLen) CanChangeTo(s base.SceneState) bool { // 当前状态能否换桌 func (this *SceneWaitPlayerStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool { - if s.IsMatchScene() { + if s.IsMatchScene() || (s.IsCustom() && s.GetNumOfGames() > 0) { return false } return true @@ -810,7 +814,7 @@ func (this *SceneWaitStartStateTienLen) CanChangeTo(s base.SceneState) bool { // 当前状态能否换桌 func (this *SceneWaitStartStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool { - if s.IsMatchScene() { + if s.IsMatchScene() || (s.IsCustom() && s.GetNumOfGames() > 0) { return false } return true