示例#1
0
        public static bool GetIsWindowTheTopmostOpenMasterMenuWindow(ArcenUI_Window Window)
        {
            ArcenUI_Window bottomWindow = GetCurrentBottommostMasterMenu();

            ToggleableWindowController     topmostWindow;
            WindowTogglingButtonController buttonThatOpensIt;

            if (!(Window.Controller is ToggleableWindowController))
            {
                if (Window.Controller == bottomWindow.Controller)
                {
                    GetTopmostOpenMasterMenuWindow(bottomWindow, out topmostWindow, out buttonThatOpensIt);
                    if (topmostWindow == null)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            ToggleableWindowController controllerAsType = (ToggleableWindowController)Window.Controller;

            if (!controllerAsType.IsOpen)
            {
                return(false);
            }
            GetTopmostOpenMasterMenuWindow(bottomWindow, out topmostWindow, out buttonThatOpensIt);
            if (topmostWindow == null || Window != topmostWindow.Window)
            {
                return(false);
            }
            return(true);
        }
 public void Close()
 {
     if (!this.IsOpen)
     {
         return;
     }
     this.IsOpen = false;
     if (this.Window != null)
     {
         for (int i = 0; i < this.Window.Elements.Count; i++)
         {
             ArcenUI_Element element = this.Window.Elements[i];
             if (!(element.Controller is WindowTogglingButtonController))
             {
                 continue;
             }
             WindowTogglingButtonController otherControllerAsType  = (WindowTogglingButtonController)element.Controller;
             ToggleableWindowController     otherRelatedController = otherControllerAsType.GetRelatedController();
             if (!otherRelatedController.IsOpen)
             {
                 continue;
             }
             otherRelatedController.Close();
         }
     }
 }
        public override void HandleClick()
        {
            ToggleableWindowController controller = this.GetRelatedController();

            if (controller.IsOpen)
            {
                controller.Close();
            }
            else
            {
                controller.Open();
                if (this.Window != null && this.Window.Controller is WindowControllerAbstractBase)
                {
                    ((WindowControllerAbstractBase)this.Window.Controller).CloseWindowsOtherThanThisOne(controller);
                }
            }
        }
 public void CloseWindowsOtherThanThisOne(ToggleableWindowController controller)
 {
     for (int i = 0; i < this.Window.Elements.Count; i++)
     {
         ArcenUI_Element element = this.Window.Elements[i];
         if (!(element.Controller is WindowTogglingButtonController))
         {
             continue;
         }
         WindowTogglingButtonController otherControllerAsType  = (WindowTogglingButtonController)element.Controller;
         ToggleableWindowController     otherRelatedController = otherControllerAsType.GetRelatedController();
         if (otherRelatedController == controller)
         {
             continue;
         }
         if (!otherRelatedController.IsOpen)
         {
             continue;
         }
         otherRelatedController.Close();
     }
 }
示例#5
0
        public static void GetTopmostOpenMasterMenuWindow(ArcenUI_Window WindowToSearch, out ToggleableWindowController windowControllerThatIsOpen, out WindowTogglingButtonController buttonControllerThatWillCloseIt)
        {
            bool reverseSearch = false;// WindowToSearch.Controller != Window_InGameMasterMenu.Instance;

            List <ArcenUI_Element> elements = WindowToSearch.Elements;

            windowControllerThatIsOpen      = null;
            buttonControllerThatWillCloseIt = null;
            for (int i = reverseSearch ? elements.Count - 1 : 0;
                 reverseSearch?i >= 0 : i < elements.Count;
                 i += reverseSearch ? -1 : 1)
            {
                ArcenUI_Element element = elements[i];
                if (element.Type != ArcenUI_ElementType.Button)
                {
                    continue;
                }
                if (!(element.Controller is WindowTogglingButtonController))
                {
                    continue;
                }
                WindowTogglingButtonController controllerAsType        = (WindowTogglingButtonController)element.Controller;
                ToggleableWindowController     relatedWindowController = controllerAsType.GetRelatedController();
                if (!relatedWindowController.IsOpen)
                {
                    continue;
                }
                GetTopmostOpenMasterMenuWindow(relatedWindowController.Window, out windowControllerThatIsOpen, out buttonControllerThatWillCloseIt);
                if (windowControllerThatIsOpen == null)
                {
                    windowControllerThatIsOpen      = relatedWindowController;
                    buttonControllerThatWillCloseIt = controllerAsType;
                }
                return;
            }
        }