修复房卡房离开和开始条件

This commit is contained in:
sk 2024-09-18 14:59:17 +08:00
parent 97a6d363e7
commit 1b2a9c30e7
2 changed files with 7 additions and 3 deletions

View File

@ -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开始,并且有真人或者是预创建房间,并且有房主

View File

@ -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