娃娃机离线 踢出房间玩家

This commit is contained in:
by 2024-09-24 16:36:39 +08:00
parent 1714948491
commit b04d422d8b
3 changed files with 4 additions and 7 deletions

View File

@ -74,7 +74,7 @@ type SceneEx struct {
// 游戏是否能开始
func (this *SceneEx) CanStart() bool {
//人数>=1自动开始
if len(this.players) >= 1 && (this.GetRealPlayerNum() >= 1 || this.IsPreCreateScene() || this.IsHasPlaying()) {
if len(this.players) >= 1 && (this.GetRealPlayerNum() >= 1 || this.IsPreCreateScene() || this.IsHasPlaying()) && this.machineStatus == 1 {
return true
}
return false
@ -191,7 +191,6 @@ func (this *SceneEx) ClawdollCreateRoomInfoPacket(s *base.Scene, p *base.Player)
RoundId: proto.Int(this.RoundId),
ParamsEx: nil,
GameFreeId: 0,
BaseScore: proto.Int32(this.GetBaseScore()),
}
// 玩家信息

View File

@ -77,7 +77,7 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) {
if machineStatus == 0 {
//链接状态不可用 踢出所有玩家
for _, p := range sceneEx.players {
sceneEx.delPlayer(p.Player)
sceneEx.PlayerLeave(p.Player, common.PlayerLeaveReason_RoomClose, false)
}
sceneEx.machineStatus = 0
logger.Logger.Trace("娃娃机离线,当前场景暂停服务!")
@ -97,7 +97,6 @@ func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) {
if s == nil || p == nil {
return
}
logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
playerEx := &PlayerEx{Player: p}

View File

@ -52,9 +52,8 @@ message SCCLAWDOLLRoomInfo {
int32 TimeOut = 6; // :
repeated CLAWDOLLPlayerData Players = 7; //
int32 TotalPlayer = 8; //
int32 RoundId = 9; //ID
repeated int32 ParamsEx = 10; //
int32 RoundId = 9; //ID
repeated int32 ParamsEx = 10; //
int32 GameFreeId = 15;
int32 BaseScore = 16; //
}