コード例 #1
0
        private void WebGameCreateAiPlayerContainer(PlayerCreationEntity playerCreationEntity)
        {
            var createdObject   = Instantiate(WebGameNewPlayerAiPrefab, WebGamePlayersContainer.transform);
            var playerContainer = createdObject.GetComponent <PlayersContainerScript>();
            var color           = playerCreationEntity.GetColor();

            playerContainer.SetColor(color);
            playerContainer.SetTeam(playerCreationEntity.Team);
            playerContainer.SetUnitsNumber(playerCreationEntity.UnitsNumber);
        }
コード例 #2
0
        public static void AddBotToRoomHashtable(PlayerCreationEntity player)
        {
            var aiPlayers = CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.AiPlayers);

            aiPlayers.Add(player.GetColor().ToString(), player.AsDistionary());
            var hash = new Hashtable
            {
                { PhotonPropertiesNames.AiPlayers, aiPlayers }
            };

            PhotonNetwork.CurrentRoom.SetCustomProperties(hash);
        }
コード例 #3
0
        public static void RemoveHumanFromRoomHashtable(PlayerCreationEntity player)
        {
            var humanPlayers = CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.HumanPlayers);

            humanPlayers.Remove(player.GetColor().ToString());
            var hash = new Hashtable
            {
                { PhotonPropertiesNames.HumanPlayers, humanPlayers }
            };

            PhotonNetwork.CurrentRoom.SetCustomProperties(hash);
        }
コード例 #4
0
        public void LoadFromServer()
        {
            ResetMatch();
            PlayersToCreate.Clear();

            var aiPlayers    = CustomPropertiesHelper.CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.AiPlayers);
            var humanPlayers = CustomPropertiesHelper.CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.HumanPlayers);

            foreach (var el in aiPlayers)
            {
                var dict = (Dictionary <string, object>)el.Value;
                PlayersToCreate.Add(PlayerCreationEntity.FromDictionary(dict));
            }

            foreach (var el in humanPlayers)
            {
                var dict = (Dictionary <string, object>)el.Value;
                PlayersToCreate.Add(PlayerCreationEntity.FromDictionary(dict));
            }
        }
コード例 #5
0
        private void WebGameRefreshHostGuestList()
        {
            foreach (Transform child in WebGamePlayersContainer.transform)
            {
                Destroy(child.gameObject);
            }
            var aiPlayers    = CustomPropertiesHelper.CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.AiPlayers);
            var humanPlayers = CustomPropertiesHelper.CurrentRoomGetCustomPropertyPlayers(PhotonPropertiesNames.HumanPlayers);

            foreach (var el in aiPlayers)
            {
                var dict = (Dictionary <string, object>)el.Value;
                WebGameCreateAiPlayerContainer(PlayerCreationEntity.FromDictionary(dict));
            }

            foreach (var el in humanPlayers)
            {
                var dict = (Dictionary <string, object>)el.Value;
                WebGameCreateHumanPlayerContainer(PlayerCreationEntity.FromDictionary(dict));
            }
        }