Example #1
0
        internal void CloseMenu(bool reopen = false, bool isSubMenu = false)
        {
            isMenuClosing = true;
            OnCloseMenu?.Invoke(this, null);
            switch (isSubMenu)
            {
            case false:
                if (openMenu != null)
                {
                    SuperView.Remove(openMenu);
                }
                SetNeedsDisplay();
                if (previousFocused != null && openMenu != null && previousFocused.ToString() != openCurrentMenu.ToString())
                {
                    previousFocused?.SuperView?.SetFocus(previousFocused);
                }
                openMenu = null;
                if (lastFocused is Menu)
                {
                    lastFocused = null;
                }
                LastFocused = lastFocused;
                lastFocused = null;
                if (LastFocused != null)
                {
                    if (!reopen)
                    {
                        selected = -1;
                    }
                    LastFocused.SuperView?.SetFocus(LastFocused);
                }
                else
                {
                    SuperView.SetFocus(this);
                    isMenuClosed = true;
                    PositionCursor();
                }
                isMenuClosed = true;
                break;

            case true:
                selectedSub = -1;
                SetNeedsDisplay();
                RemoveAllOpensSubMenus();
                openCurrentMenu.previousSubFocused?.SuperView?.SetFocus(openCurrentMenu.previousSubFocused);
                openSubMenu = null;
                break;
            }
            isMenuClosing = false;
            MenuOpen      = false;
        }
 /// <summary>
 /// On close scene
 /// </summary>
 public void OnCloseScene()
 {
     OnCloseMenu?.Invoke();
 }