public void playAgain() { if (CurrentRoom != null) { if (CurrentRoom.FirstUser.Username == Message) { CurrentRoom.FirstUser.Player.PlayAgain = true; if (!CurrentRoom.SecondUser.Player.PlayAgain) { BasicPacket bp = new BasicPacket(GameProtocol.PlayAgain()); Othello.Server.SendPacket(CurrentRoom.SecondUser.Socket, bp.getData()); } } else if (CurrentRoom.SecondUser.Username == Message) { CurrentRoom.SecondUser.Player.PlayAgain = true; if (!CurrentRoom.FirstUser.Player.PlayAgain) { BasicPacket bp = new BasicPacket(GameProtocol.PlayAgain()); Othello.Server.SendPacket(CurrentRoom.FirstUser.Socket, bp.getData()); } } if (CurrentRoom.isAblePlayAgain()) { CurrentRoom.PlayAgain(); CurrentRoom.resetPlayAgain(); } } }
public void PlayAgain() { MessageRoomPacket packet = new MessageRoomPacket(GameProtocol.PlayAgain(), Singleton.Instance.RoomID, Singleton.Instance.Me.Username); Singleton.Instance.Connection.SendPacket(packet.getData()); PlayAgainButton.enabled = false; PlayAgainButton.GetComponent <Image>().color = Color.red; GameOverPopUpText.text = "Waiting a response from your opponent."; }