public void SetupPlayer() { BoltConsole.Write("SetupPlayer", Color.green); LobbyPlayerList._instance.AddPlayer(this); localPlayer = this; nameInput.interactable = true; remoteIcone.gameObject.SetActive(false); localIcone.gameObject.SetActive(true); removePlayerButton.gameObject.SetActive(false); removePlayerButton.interactable = false; ChangeReadyButtonColor(JoinColor); readyButton.transform.GetChild(0).GetComponent <Text>().text = "JOIN"; readyButton.interactable = true; //we switch from simple name display to name input colorButton.interactable = true; nameInput.interactable = true; nameInput.onEndEdit.RemoveAllListeners(); nameInput.onEndEdit.AddListener(OnNameChanged); colorButton.onClick.RemoveAllListeners(); colorButton.onClick.AddListener(OnColorClicked); readyButton.onClick.RemoveAllListeners(); readyButton.onClick.AddListener(OnReadyClicked); OnClientReady(state.Ready); }
public override void Disconnected(BoltConnection connection) { LobbyPhotonPlayer player = connection.GetLobbyPlayer(); if (player != null) { BoltLog.Info("Disconnected"); player.RemovePlayer(); } }
public void AddPlayer(LobbyPhotonPlayer player) { if (_players.Contains(player)) { return; } _players.Add(player); player.transform.SetParent(playerListContentTransform, false); addButtonRow.transform.SetAsLastSibling(); PlayerListModified(); }
public override void EntityAttached(BoltEntity entity) { BoltConsole.Write("EntityAttached"); if (!entity.isControlled) { LobbyPhotonPlayer photonPlayer = entity.gameObject.GetComponent <LobbyPhotonPlayer>(); if (photonPlayer != null) { photonPlayer.SetupOtherPlayer(); } } }
public override void Connected(BoltConnection connection) { if (BoltNetwork.IsClient) { BoltConsole.Write("Connected Client: " + connection, Color.blue); infoPanel.gameObject.SetActive(false); ChangeTo(lobbyPanel); } else if (BoltNetwork.IsServer) { BoltConsole.Write("Connected Server: " + connection, Color.blue); BoltEntity entity = BoltNetwork.Instantiate(BoltPrefabs.PlayerInfo); LobbyPhotonPlayer lobbyPlayer = entity.GetComponent <LobbyPhotonPlayer>(); lobbyPlayer.connection = connection; connection.UserData = lobbyPlayer; connection.SetStreamBandwidth(1024 * 1024); entity.AssignControl(connection); } }
public void RemovePlayer(LobbyPhotonPlayer player) { _players.Remove(player); PlayerListModified(); }