コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }