Ejemplo n.º 1
0
    void OnPlayersListUpdate(List <PlayerInfo> players)
    {
        Debug.Log("ListOfPlayers " + players.Count.ToString());
        ClearList();
        bool allPlayersReady = true;

        foreach (PlayerInfo player in players)
        {
            PlayerListView playerView = GameObject.Instantiate <PlayerListView>(playerListViewPrefab, content);
            playerView.Init(this, player.number, player.name, player.isLocal, player.isReady);

            if (!player.isReady)
            {
                allPlayersReady = false;
            }

            allPlayers.Add(player.number, playerView);
        }

        roomInfoView.Init(NetworkLobbyHelper.GetCurrentRoomInfo());

        if (allPlayersReady)
        {
            //All players ready - start game!
            lobbyView.OnStartGameButtonClicked();
        }
    }
Ejemplo n.º 2
0
    private void OnPlayersListUpdate(List <PlayerInfo> players)
    {
        OMSRoomInfo roomInfo = NetworkLobbyHelper.GetCurrentRoomInfo();

        if (roomInfo.currentPlayers == roomInfo.maximumPlayers)
        {
            //Start the game automatically when all players are ready
            StartGame();
        }
    }
Ejemplo n.º 3
0
    private void StartGame()
    {
        OMSRoomInfo roomInfo = NetworkLobbyHelper.GetCurrentRoomInfo();

        NetworkLobbyHelper.StartGame(roomInfo.scenarioName);
    }