Пример #1
0
    // Closes the most recent window if one is available
    public void CloseTopWindow()
    {
        if (currentWindows.Count == 0)
        {
            return;
        }

        UIMenuWindowManager window       = currentWindows.Pop();
        GameObject          lastSelected = prevSelectedWindowUIObjects.Pop();

        EventSystem.current.SetSelectedGameObject(lastSelected);
        PlayCancelSound();
        Destroy(window.gameObject);
    }
Пример #2
0
    // Opens a new window
    public void OpenWindow(string name)
    {
        if (!dMenuWindows.ContainsKey(name))
        {
            return;
        }

        GameObject newWindow = Instantiate(dMenuWindows[name].goWindowPanel, tMenuParent);

        currentWindowManager = newWindow.GetComponent <UIMenuWindowManager>();
        prevSelectedWindowUIObjects.Push(EventSystem.current.currentSelectedGameObject);

        if (currentWindowManager != null)
        {
            currentWindows.Push(currentWindowManager);
            currentWindowManager.SetMenuManager(this);
            EventSystem.current.SetSelectedGameObject(currentWindowManager.goFirstSelectedUI);
        }
    }