public new void SetNextPlayer() { string[] playersOrder = NetworkCustomProperties.GetRoomProperty(NetworkCustomProperties.PLAYERS_ORDER) as string[]; string nextPlayer = null; if (this.currentPlayerController == null && players.Count > 0) { this.currentPlayerController = getPlayerByName(playersOrder[0]); nextPlayer = playersOrder[0]; } else if (this.currentPlayerController != null) { var currentIndex = 0; foreach (string playerC in playersOrder) { if (currentPlayerController.Player.GetPlayerName().Equals(playerC)) { break; } currentIndex++; } if (currentIndex == playersOrder.Length - 1) { this.currentPlayerController = getPlayerByName(playersOrder[0]); nextPlayer = playersOrder[0]; } else { this.currentPlayerController = getPlayerByName(playersOrder[currentIndex + 1]); nextPlayer = playersOrder[currentIndex + 1]; } } NetworkCustomProperties.AddRoomProperty(NetworkCustomProperties.NEXT_PLAYER, nextPlayer); }
private void Cmd_ShuffleData() { Debug.Log("Cmd_ShuffleData"); PickUpPlayersOrder(); string[] playersOrder = new string[players.Count]; for (var i = 0; i < players.Count; i++) { PlayerController pc = players[i]; playersOrder[i] = pc.Player.GetPlayerName(); } ShuffleTerritories(); NetworkCustomProperties.AddRoomProperty(NetworkCustomProperties.PLAYERS_ORDER, playersOrder); }
public void HandleReadyButton() { int playersReady = (int)NetworkCustomProperties.GetRoomProperty(NetworkCustomProperties.ROOM_PLAYERS_READY); if (readyButton.isOn) { playersReady++; } else if (playersReady > 0) { playersReady--; } NetworkCustomProperties.AddPlayerProperty(NetworkCustomProperties.PLAYER_IS_READY, readyButton.isOn); NetworkCustomProperties.AddRoomProperty(NetworkCustomProperties.ROOM_PLAYERS_READY, playersReady); }