// Server public void OnReadyUpMessage(NetworkMessage _networkMessage) { ReadyUpMessage incomingMsg = _networkMessage.ReadMessage <ReadyUpMessage>(); string lobbyMsg = ""; // Find player in our info list for (int i = 0; i < this.maxConnections; i++) { if (this.playerInfoList[i].connectionId == _networkMessage.conn.connectionId) { // Set our ready bool in our list this.isPlayerReadyList[i] = incomingMsg.isReady; if (incomingMsg.isReady) { //Debug.Log("Player " + _networkMessage.conn.connectionId.ToString() + " is ready"); lobbyMsg = this.playerInfoList[i].name + " is ready"; } else { //Debug.Log("Player " + _networkMessage.conn.connectionId.ToString() + " is NOT ready"); lobbyMsg = this.playerInfoList[i].name + " is not ready"; this.isLobbyTimerCountingDown = false; } } } this.SendLobbyUpdates(lobbyMsg); }
// Client public void SendReadyUpMessage() { // update button text this.canvasManager.UpdateReadyButtonText(!this.isClientReady); // Send msg ReadyUpMessage msg = new ReadyUpMessage(); this.isClientReady = !this.isClientReady; msg.isReady = this.isClientReady; this.client.Send(CustomMsgType.ReadyUp, msg); }