Exemple #1
0
    // Opens the new screen
    private void OpenNewScreen(string newPanelID, string lastSelection)
    {
        GameObject newScreen = Instantiate(dMenuScreens[newPanelID].goScreenPanel, tMenuParent);

        newScreen.SetActive(false);
        sCurrentPanel     = newPanelID;
        goCurrentPanelObj = newScreen;

        currentScreenManager = newScreen.GetComponent <UIMenuScreenManager>();

        if (currentScreenManager != null)
        {
            currentScreenManager.SetMenuManager(this);
            currentScreenManager.gameObject.SetActive(true);

            currentScreenManager.OpenScreen(lastSelection);
        }
    }
Exemple #2
0
    // Initialization
    protected virtual void Awake()
    {
        playerInput = ReInput.players.GetPlayer(0);

        // If we need to clear on awake, then loop through all of the menu windows and destroy them
        if (bClearMenuParentOnAwake)
        {
            int windowCount = tMenuParent.childCount;

            if (windowCount > 0)
            {
                for (int i = 0; i < windowCount; i++)
                {
                    Destroy(tMenuParent.GetChild(i).gameObject);
                }
            }
        }

        // Set Current Panel if starting instantiated
        if (bStartInstantiated)
        {
            sCurrentPanel        = dMenuScreens.First().Key;
            goCurrentPanelObj    = Instantiate(dMenuScreens.First().Value.goScreenPanel, tMenuParent);
            currentScreenManager = goCurrentPanelObj.GetComponent <UIMenuScreenManager>();

            if (currentScreenManager != null)
            {
                currentScreenManager.SetMenuManager(this);
                currentScreenManager.gameObject.SetActive(true);

                if (!bStartNotSelected)
                {
                    currentScreenManager.OpenScreen(null);
                }
            }
        }

        prevScreens = new Stack <string>();
        prevSelectedScreenUINames = new Stack <string>();

        currentWindows = new Stack <UIMenuWindowManager>();
    }