コード例 #1
0
    private void CreatePlayerUI(PhotonPlayer player)
    {
        string key = player.UserId;

        DestroyPlayerUI(key);

        PunTeams.Team team      = player.GetTeam();
        Transform     container = waitingPlayerListContainer;
        Dictionary <string, UIPhotonWaitingPlayer> uiDict = waitingPlayers;

        switch (team)
        {
        case PunTeams.Team.red:
            container = waitingPlayerTeamAListContainer;
            uiDict    = waitingTeamAPlayers;
            break;

        case PunTeams.Team.blue:
            container = waitingPlayerTeamBListContainer;
            uiDict    = waitingTeamBPlayers;
            break;
        }
        UIPhotonWaitingPlayer newEntry = Instantiate(waitingPlayerPrefab, container);

        newEntry.SetData(this, player);
        newEntry.gameObject.SetActive(true);
        uiDict.Add(key, newEntry);

        players[player.UserId] = player;
    }
コード例 #2
0
    private void CreatePlayerUI(Player player)
    {
        string key = player.UserId;

        if (string.IsNullOrEmpty(key))
        {
            key = SimplePhotonNetworkManager.OFFLINE_USER_ID;
        }
        DestroyPlayerUI(key);

        byte      team      = SimplePhotonNetworkManager.Singleton.GetTeam(player);
        Transform container = waitingPlayerListContainer;
        Dictionary <string, UIPhotonWaitingPlayer> uiDict = waitingPlayers;

        switch (team)
        {
        case 1:
            container = waitingPlayerTeamAListContainer;
            uiDict    = waitingTeamAPlayers;
            break;

        case 2:
            container = waitingPlayerTeamBListContainer;
            uiDict    = waitingTeamBPlayers;
            break;
        }
        UIPhotonWaitingPlayer newEntry = Instantiate(waitingPlayerPrefab, container);

        newEntry.SetData(this, player);
        newEntry.gameObject.SetActive(true);
        uiDict.Add(key, newEntry);

        players[key] = player;
    }