Exemplo n.º 1
0
    private void Update()
    {
        // Close the current popup if escape is pressed.
        if (Input.GetButtonDown("Cancel"))
        {
            if (PopupWindow.getPopupsOpen() == 0)
            {
                // Open the Pause screen if there is a world loaded.
                if (Main.instance.isPlaying())
                {
                    PopupPause popup = Main.instance.findPopup <PopupPause>();
                    if (popup != null)
                    {
                        popup.open();
                    }
                }
            }
            else
            {
                // Close all of the Popup windows that are open
                for (int i = PopupWindow.openPopups.Count - 1; i >= 0; i--)
                {
                    PopupWindow popup = PopupWindow.openPopups[i];
                    if (popup.closeableWithEscape)
                    {
                        popup.close();
                    }
                }
            }
        }

        // Hide/show the ui if the toggle key is pressed.
        if (Input.GetKeyDown(this.toggleKey))
        {
            this.uiHolder.gameObject.SetActive(!this.uiHolder.gameObject.activeSelf);
        }
    }
Exemplo n.º 2
0
    //=====================================================

    void Awake()
    {
        Instance    = this;
        m_bIsActive = false;
    }