void Refresh(NetworkPlayer networkPlayer) { Game game = GameManager.instance.game; Clear(); Debug.Log("[LobbyPlayerDisplayer] Refresh"); int current = 0; foreach (var player in game.GetPlayers()) { LobbyPlayerEntry entry = Instantiate(entryPrefab); entry.Initalize(player.Value); entry.transform.SetParent(transform); if (player.Key == Network.player) { entry.SetColor(ownColor); } else { entry.SetColor(current % 2 == 0 ? colorEven : colorOdd); } current++; } }
public void AddLobbyPlayerEntry(string name, int id) { LobbyPlayerEntry lpe = Instantiate <LobbyPlayerEntry>(LobbyPlayerEntryPrefab, JoinedPlayersPanel); lpe.Init(name, id); _lobbyPlayerEntries.Add(lpe); }
private void UpdateEntry(LobbyPlayerEntry entry) { RectTransform trans = entry.GetComponent <RectTransform>(); entry.transform.SetParent(transform);// = transform; trans.anchoredPosition = new Vector2(1, startingHeight + gap * -entry.playerNumber); trans.localScale = Vector2.one; }
private void CreatePlayerLobbyEntryGameObject() { var data = new object[1]; data[0] = photonView.viewID; var playerLobbyEntry = PhotonNetwork.Instantiate( PlayerEntryPrefab.name, Vector3.zero, Quaternion.identity, 0, data); _lobbyPlayerEntry = playerLobbyEntry.GetComponent <LobbyPlayerEntry>(); }
public void CreateUIEntry(bool isLocal) { GameObject go = Instantiate(lobbyEntryPrefab.gameObject); lobbyEntryPrefab = go.GetComponent <LobbyPlayerEntry>(); if (lobbyEntryPrefab == null) { return; } lobbyEntryPrefab.player = this; lobbyEntryPrefab.playerNumber = playerNumber; if (isLocal) { lobbyEntryPrefab.localPlayer = true; } Lobby.Instance.AddPlayer(this); }
public void RemoveEntry(LobbyPlayerEntry entry) { playerEntries.Remove(entry); }
public void AddEntry(LobbyPlayerEntry entry) { playerEntries.Add(entry); UpdateEntries(); }