示例#1
0
    /// <summary>
    /// Show or hide the main menu.
    /// </summary>
    /// <param name="value"></param>
    private void ShowMainMenu(bool value = true)
    {
        // Enabling or disabling the main menu canvas automatically enables or disables
        // the actions referenced by the InputSystemUIInputModule sitting on the canvas. We've not
        // restricted them by a set of devices or set a binding mask on them so the actions will
        // go and grab whatever devices are present and matching the bindings we have. This means
        // that every local device can be used to drive the main menu.
        //
        // NOTE: On consoles, we do not require sign-in at this point. Even if the device is not
        //       paired to a user, we allow it to drive the UI. When it comes to starting an actual
        //       game, that's when we will care about pairing devices to users.

        mainMenuCamera.gameObject.SetActive(value);
        mainMenuCanvas.gameObject.SetActive(value);

        // If we enable the main menu, automatically select the start button.
        if (value)
        {
            EventSystem.current.SetSelectedGameObject(startGameButton);
        }

        ////TODO: move this into UI module doing it automatically
        if (value)
        {
            uiInputModule.EnableAllActions();
        }
        else
        {
            uiInputModule.DisableAllActions();
        }
    }
示例#2
0
    //Back to the first screen from character select
    public void toMain()
    {
        joiningPlayers = false;
        manager.DisableJoining();
        inputModule.EnableAllActions();
        inputModule.UpdateModule();

        characterSelect.SetActive(false);
        mainMenu.SetActive(true);
    }