This commit is contained in:
aozhiwei 2023-09-16 12:45:34 +08:00
parent bf985f9c81
commit dd70b97f58

View File

@ -343,6 +343,19 @@ func (this *room) GetRoomState() int32 {
} }
func (this *room) notifyGameStart() { 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 { if this.gameStartNotifyMsg == nil {
this.gameStartNotifyMsg = &cs.SMRoomGameStartNotify{} this.gameStartNotifyMsg = &cs.SMRoomGameStartNotify{}
this.gameStartNotifyMsg.ZoneId = proto.Int32(this.config.zoneId) this.gameStartNotifyMsg.ZoneId = proto.Int32(this.config.zoneId)
@ -384,13 +397,6 @@ func (this *room) notifyGameStart() {
} }
this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo)) 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 { func (this *room) canStart() bool {