1
This commit is contained in:
parent
2ca100c006
commit
0c61ae146a
@ -169,6 +169,9 @@ func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
|||||||
hum.SendMsg(rspMsg)
|
hum.SendMsg(rspMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if this.canStart() {
|
||||||
|
this.doStart(1)
|
||||||
|
}
|
||||||
hum.SendMsg(rspMsg)
|
hum.SendMsg(rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,10 +212,10 @@ func (this *room) broadcastMsg(msg proto.Message) {
|
|||||||
|
|
||||||
func (this *room) autoStart() {
|
func (this *room) autoStart() {
|
||||||
if this.roomState == ROOM_INIT_STATE {
|
if this.roomState == ROOM_INIT_STATE {
|
||||||
if this.getTeamNum() < ROOM_MIN_START_TEAM_NUM {
|
if this.canStart() {
|
||||||
this.doDisband(0)
|
|
||||||
} else {
|
|
||||||
this.doStart(0)
|
this.doStart(0)
|
||||||
|
} else {
|
||||||
|
this.doDisband(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,7 +275,6 @@ func (this *room) notifyGameStart() {
|
|||||||
StartTime: int32(this.startTime),
|
StartTime: int32(this.startTime),
|
||||||
}
|
}
|
||||||
q5.NewSlice(&startInfo.TeamList, 0, 10)
|
q5.NewSlice(&startInfo.TeamList, 0, 10)
|
||||||
this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo))
|
|
||||||
for _, t := range(this.teams) {
|
for _, t := range(this.teams) {
|
||||||
if t.hasAlreadMember() {
|
if t.hasAlreadMember() {
|
||||||
ele := q5.NewSliceElement(&startInfo.TeamList)
|
ele := q5.NewSliceElement(&startInfo.TeamList)
|
||||||
@ -289,6 +291,7 @@ func (this *room) notifyGameStart() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo))
|
||||||
}
|
}
|
||||||
for _, m := range(this.members) {
|
for _, m := range(this.members) {
|
||||||
if m.state == MEMBER_READY_STATE &&
|
if m.state == MEMBER_READY_STATE &&
|
||||||
@ -298,3 +301,13 @@ func (this *room) notifyGameStart() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *room) canStart() bool {
|
||||||
|
alreadyNum := 0
|
||||||
|
for _, t := range(this.teams) {
|
||||||
|
if t.hasAlreadMember() {
|
||||||
|
alreadyNum++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return alreadyNum >- ROOM_MIN_START_TEAM_NUM
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user