From dd70b97f58d5e8caf4eb36e660f831a8d61e070a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 16 Sep 2023 12:45:34 +0800 Subject: [PATCH] 1 --- server/hallserver/room/room.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/server/hallserver/room/room.go b/server/hallserver/room/room.go index 6f687c6a..e04d3b78 100644 --- a/server/hallserver/room/room.go +++ b/server/hallserver/room/room.go @@ -343,6 +343,19 @@ func (this *room) GetRoomState() int32 { } func (this *room) notifyGameStart() { + if this.gameStartNotifyMsg == nil { + this.genGameStartNotifyMsg() + } + for _, m := range(this.members) { + if m.state == MEMBER_READY_STATE && + m.hum.GetRoom() == this && + !m.closeGameStartNotify { + m.hum.SendMsg(this.gameStartNotifyMsg) + } + } +} + +func (this *room) genGameStartNotifyMsg() { if this.gameStartNotifyMsg == nil { this.gameStartNotifyMsg = &cs.SMRoomGameStartNotify{} this.gameStartNotifyMsg.ZoneId = proto.Int32(this.config.zoneId) @@ -384,13 +397,6 @@ func (this *room) notifyGameStart() { } this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo)) } - for _, m := range(this.members) { - if m.state == MEMBER_READY_STATE && - m.hum.GetRoom() == this && - !m.closeGameStartNotify { - m.hum.SendMsg(this.gameStartNotifyMsg) - } - } } func (this *room) canStart() bool {