Ejemplo n.º 1
0
    void Update()
    {
        multiplayerMenuUI.hideCodeButton.gameObject.SetActive(networkingController.GetIsInMultiplayer() && showingJoinCode);
        multiplayerMenuUI.copyCodeButton.gameObject.SetActive(networkingController.GetIsInMultiplayer() && showingJoinCode);
        multiplayerMenuUI.showCodeButton.gameObject.SetActive(networkingController.GetIsInMultiplayer() && !showingJoinCode);
        multiplayerMenuUI.playerListObject.SetActive(networkingController.GetIsInMultiplayer());

        multiplayerMenuUI.singlePlayerGameObject.SetActive(!networkingController.GetIsInMultiplayer());
        multiplayerMenuUI.playerNumberGameObject.SetActive(networkingController.GetIsInMultiplayer());
        multiplayerMenuUI.joinCodeGameObject.SetActive(networkingController.GetIsInMultiplayer() && showingJoinCode);

        multiplayerMenuUI.newUserCanBuildObject.SetActive(networkingController.GetIsInMultiplayer() && PhotonNetwork.isMasterClient);


        // multiplayerMenuUI.reportPlayerButton.gameObject.SetActive(networkingController.GetIsInMultiplayer());
        // multiplayerMenuUI.kickPlayerButton.gameObject.SetActive(networkingController.GetIsInMultiplayer() && PhotonNetwork.isMasterClient);

        // multiplayerMenuUI.multiplayerStatusField.text = networkingController.GetIsInMultiplayer() ? multiplayerNotice : singleplayerNotice;

        if (!networkingController.GetIsInMultiplayer())
        {
            return;
        }

        RefreshUserList();

        if (playerControlsManager.GetMyPlayerNumber() == 0)
        {
            multiplayerMenuUI.playerNumberField.text = "";
        }
        else
        {
            multiplayerMenuUI.playerNumberField.text = "You are Player " + playerControlsManager.GetMyPlayerNumber();
        }
    }
Ejemplo n.º 2
0
    public void Show(VoosActor actor)
    {
        // Start with player 0 to avoid warnings/etc.
        AssignPlayerToActor(0, actor.GetName());

        string name = actor.GetDisplayName();
        List <PopupButton.Params> buttons = new List <PopupButton.Params>();

        int myPlayerNumber = playerControlsManager.GetMyPlayerNumber();

        int maxPlayerSlotNumber = 4; // Show at least player 1-4, unless there are more players.

        foreach (VirtualPlayerManager.VirtualPlayerInfo player in virtualPlayerManager.EnumerateVirtualPlayers())
        {
            maxPlayerSlotNumber = Mathf.Max(player.slotNumber, maxPlayerSlotNumber);
        }
        for (int i = 1; i <= maxPlayerSlotNumber; i++)
        {
            int thisNumber = i; // For closures below
            buttons.Add(new PopupButton.Params
            {
                getLabel = () => $"Player {thisNumber}" + ((thisNumber == myPlayerNumber) ? " (myself)" : ""),
                onClick  = () => OnClickedPlayerNumber(actor, thisNumber)
            });
        }
        buttons.Add(new PopupButton.Params {
            getLabel = () => "Nobody for now", onClick = () => OnClickedPlayerNumber(actor, 0)
        });
        buttons.Add(new PopupButton.Params {
            getLabel = () => "It's an NPC", onClick = () => OnClickedIsNpc(actor)
        });
        popups.Show(new DynamicPopup.Popup
        {
            getMessage = () => $"Who will control this {name}?",
            buttons    = buttons,
        });
    }