public IEnumerator AddPlayerAndSetupCourutine() { LobbyPlayerList list = null; while (true) { while (list == null) { list = LobbyPlayerList.singleton; yield return(new WaitForSeconds(0.1f)); } if (list.gameObject.activeSelf) { list.AddPlayer(this); if (isLocalPlayer) { SetupLocalPlayer(); } else { SetupOtherPlayer(); } yield break; } else { yield return(new WaitForSeconds(0.1f)); } } }
public override void OnClientEnterLobby() { base.OnClientEnterLobby(); playerList = LobbyPlayerList.Instance; //if (LobbyNetworkManager.s_Singleton != null) LobbyNetworkManager.s_Singleton.OnPlayersNumberModified(1); playerList.AddPlayer(this); //playerList.DisplayDirectServerWarning(isServer && LobbyManager.s_Singleton.matchMaker == null); if (isLocalPlayer) { SetupLocalPlayer(); } else { SetupOtherPlayer(); } //setup the player data on UI. The value are SyncVar so the player //will be created with the right value currently on server OnMyName(playerName); OnMyColor(playerColor); /* if (isServer) * {*/ //} }
public void Start() { _instance = this; _layout = playerListContentTransform.GetComponent<VerticalLayoutGroup>(); // Evita que se destruya el objeto del menu que contiene la lista de jugadores // derivados de la clase NetworkLobbyPlayer DontDestroyOnLoad(gameObject); }
private void HandleNewPlayer(NetConnection sender, LobbyPlayerGreeting player) { long remoteId = sender == null ? -1 : sender.RemoteUniqueIdentifier; PlayersByConnection[remoteId] = new PlayerConnection { Connection = sender, PlayerName = player.PlayerName }; var lobbyPlayerList = new LobbyPlayerList { PlayerNames = PlayersByConnection.Values.Select(p => p.PlayerName).ToArray() }; PlayerListChanged?.Invoke(this, lobbyPlayerList); Broadcast(lobbyPlayerList); }
private void Awake() { Instance = this; }
/** * Get components */ public void OnEnable() { _instance = this; _layout = playerListContentTransform.GetComponent <VerticalLayoutGroup>(); }
public void OnEnable() { _instance = this; _layout = playerListContentTransform.GetComponent<VerticalLayoutGroup>(); }
protected virtual void Awake() { instance = this; }
// Use this for initialization void Start() { singleton = this; }
public void Awake() { _instance = this; }