예제 #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();
        }
    }
예제 #2
0
    IEnumerator TimerTick()
    {
        GetCurrentTimer();
        SetLabel();
        do
        {
            yield return(new WaitForSeconds(1));

            if (PhotonNetwork.isMasterClient)
            {
                timeLeft--;
                NetworkLobbyHelper.SetCurrentTimer(timeLeft);
            }
            else
            {
                GetCurrentTimer();
            }
            SetLabel();
        } while (timeLeft > 0);

        lobbyView.OnStartGameButtonClicked();
    }