private void RefreshFromDedicatedServer() { if (SteamClientDSConfig.Server == null) { Debug.LogError("There is no server information stored on this client."); return; } for (int i = this._grid.transform.childCount - 1; i >= 0; i--) { UnityEngine.Object.Destroy(this._grid.GetChild(i).gameObject); } SteamClientDSConfig.playerCount = 0; int nMaxPlayers = SteamClientDSConfig.Server.m_nMaxPlayers; IPlayerState state = LocalPlayer.Entity.GetState<IPlayerState>(); CoopServerInfo instance = CoopServerInfo.Instance; NetworkArray_Integer clients = instance.state.Clients; NetworkArray_String playerNames = instance.state.PlayerNames; for (int j = 0; j < playerNames.Length; j++) { if (!playerNames[j].NullOrEmpty()) { SteamClientDSConfig.playerCount++; int connectionId = clients[j - 1]; this.AddPlayerRow(playerNames[j], connectionId, CoopSteamClientStarter.IsAdmin && playerNames[j] != LocalPlayer.State.name); } } this.UpdatePlayerCountText(SteamClientDSConfig.playerCount + "/" + SteamClientDSConfig.Server.m_nMaxPlayers); }
private void AnyArmorChanged(GameObject[] armorType, NetworkArray_Integer stateArray) { for (int i = 0; i < Mathf.Min(stateArray.Length, armorType.Length); i++) { if (armorType[i]) { armorType[i].SetActive(stateArray[i] == 1); } } }