示例#1
0
    public override void OnPlayerEnteredRoom(Player newPlayer)
    {
        Debug.Log(newPlayer.NickName + " joined to" + PhotonNetwork.CurrentRoom.Name
                  + "\n"
                  + PhotonNetwork.CurrentRoom.PlayerCount
                  + " / " + PhotonNetwork.CurrentRoom.MaxPlayers + " players in room"
                  + "\n"
                  + "Weapon: " + (string)newPlayer.CustomProperties["Weapon"]);

        playersInRoomText.text = PhotonNetwork.CurrentRoom.PlayerCount
                                 + " / " + PhotonNetwork.CurrentRoom.MaxPlayers + " Players";

        GameObject           tempListing = Instantiate(insideRoomPlayerPrefab, playerListContainer);
        PlayerListingManager PLM         = tempListing.GetComponent <PlayerListingManager>();

        PLM.playerNameText.text = newPlayer.NickName;

        if (newPlayer.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber)
        {
            PLM.youIndicator.gameObject.SetActive(true);
            PLM.playerWeaponText.text = gameObject.GetComponent <PlayFabManager>().GetReceivedWeaponData();
        }
        else
        {
            PLM.youIndicator.gameObject.SetActive(false);
            PLM.playerWeaponText.text = (string)newPlayer.CustomProperties["Weapon"];
        }

        playerListGameObjects.Add(newPlayer.ActorNumber, tempListing);
    }
示例#2
0
    private void AddPlayerListing(Player player)
    {
        PlayerListingManager listing = Instantiate(playerListing, content);

        if (listing != null)
        {
            listing.SetPlayerInfo(player);
            playerListingList.Add(listing);
        }
    }
示例#3
0
    public override void OnJoinedRoom()
    {
        ClearRoomListView();
        cachedRoomList.Clear();

        Debug.Log(PhotonNetwork.NickName + " joined to " + PhotonNetwork.CurrentRoom.Name
                  + "\n"
                  + PhotonNetwork.CurrentRoom.PlayerCount
                  + " / " + PhotonNetwork.CurrentRoom.MaxPlayers + " players in room"
                  + "\n"
                  + "Weapon: " + gameObject.GetComponent <PlayFabManager>().GetReceivedWeaponData());

        if (PhotonNetwork.LocalPlayer.IsMasterClient)
        {
            startGameButton.SetActive(true);
        }
        else
        {
            startGameButton.SetActive(false);
        }

        gameObject.GetComponent <PlayFabManager>().ActivatePanel(gameObject.GetComponent <PlayFabManager>().insideRoomPanel);

        if (playerListGameObjects == null)
        {
            playerListGameObjects = new Dictionary <int, GameObject>();
        }

        roomNameText.text      = PhotonNetwork.CurrentRoom.Name;
        playersInRoomText.text = PhotonNetwork.CurrentRoom.PlayerCount
                                 + " / " + PhotonNetwork.CurrentRoom.MaxPlayers + " Players";

        foreach (Player player in PhotonNetwork.PlayerList)
        {
            GameObject           tempListing = Instantiate(insideRoomPlayerPrefab, playerListContainer);
            PlayerListingManager PLM         = tempListing.GetComponent <PlayerListingManager>();
            PLM.playerNameText.text = player.NickName;

            if (player.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber)
            {
                PLM.youIndicator.gameObject.SetActive(true);
                PLM.playerWeaponText.text = gameObject.GetComponent <PlayFabManager>().GetReceivedWeaponData();
            }
            else
            {
                PLM.youIndicator.gameObject.SetActive(false);
                PLM.playerWeaponText.text = (string)player.CustomProperties["Weapon"];
            }

            playerListGameObjects.Add(player.ActorNumber, tempListing);
        }
    }