tl 2 years ago
parent
commit
2dac60f382
1 changed files with 20 additions and 0 deletions
  1. 20 0
      game/qznn/qznn.go

+ 20 - 0
game/qznn/qznn.go

@@ -906,9 +906,29 @@ func (p *Game) Ready(playerID int32) error {
 			}
 		}()
 
+		allReady := true
+		p.locker.Lock()
+		{
+			roomItem := p.RoomMap[roomItem.ID]
+			for _, chairItem := range roomItem.ChairList {
+				if chairItem.PlayerID == 0 {
+					continue
+				}
+
+				chairPlayer := p.PlayerMap[chairItem.PlayerID]
+				if chairPlayer.Status != PlayerStatusReady {
+					allReady = false
+					break
+				}
+			}
+		}
+
+		p.locker.Unlock()
+
 		if !allReady {
 			p.locker.Lock()
 			{
+
 				p.EventInfo(playerID, "准备", fmt.Sprintf("等待房间准备:%d", roomItem.ID))
 			}
 			p.locker.Unlock()