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 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(); } }
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; } }