Table of Contents
A ModHelperComponent for a custom Window that can be opened in game and behaves similarly to a desktop Window
public class ModHelperWindow : BTD_Mod_Helper.Api.Components.ModHelperPanel
Inheritance UnityEngine.MonoBehaviour ModHelperComponent ModHelperPanel ModHelperWindow
Whether in game hotkeys should not happen while this window is being actively interacted with
public bool blockHotkeysWhileFocused;
Whether the options menu can be opened from right clicking on window content
public bool blockRightClickOnContent;
The button in the topRightGroup that can Close() the window
public ModHelperButton closeButton;
The content panel of the Window where most UI should be added to
public ModHelperPanel content;
The CanvasGroup of the content
public CanvasGroup contentCanvas;
The button on the dock for the window, or null if this window doesn't use one
public ModHelperDockButton dockButton;
How close the mouse needs to be for resizing
public const int EdgeThreshold = 10;
The icon of this window, if it has one
public ModHelperImage icon;
Whether this window is locked
public bool locked;
The main inset panel of the Window
public ModHelperPanel main;
The default visual margin between elements
public const int Margin = 25;
The button in the topRightGroup that will Minimize the window
public ModHelperButton minButton;
The minimum height of this window when resizing
public float minHeight;
The minimum width of this window when resizing
public float minWidth;
Whether resizing is blocked for this window
public bool noResizing;
The options menu for the window
public ModHelperPopupMenu rightClickMenu;
The CanvasGroup at the root of this Window
public CanvasGroup rootCanvas;
The button in the topRightGroup that toggles the rightClickMenu
public ModHelperButton settingsButton;
The title of this window, if it has one
public ModHelperText title;
The top row of the window
public ModHelperPanel topBar;
The height of the topBar of the window
public int topBarHeight;
The center group of the top bar, which is by default empty
public ModHelperPanel topCenterGroup;
The left side group of the top bar, which by default features the Icon and window name
public ModHelperPanel topLeftGroup;
The right side group of the top bar, which by default features the Close / Options / Minimize buttons
public ModHelperPanel topRightGroup;
The color option within the options menu
public BTD_Mod_Helper.Api.Components.ModHelperPopupOption ColorOption { get; }
Whether the window is currently focused, it's on top of all other windows and the user is interacting with it instead of the game
public bool IsFocused { get; set; }
Whether this window is minimized or not
public bool IsMinimized { get; }
The lock / unlock option within the options menu
public BTD_Mod_Helper.Api.Components.ModHelperPopupOption LockOption { get; }
The ModWindow definition used for this window, if any
public BTD_Mod_Helper.Api.UI.ModWindow ModWindow { get; set; }
The current WindowColor theme of this window
public BTD_Mod_Helper.Api.UI.ModWindowColor WindowColor { get; set; }
Applies the current window color to a game object and keeps track of it as part of this window
public void ApplyWindowColor(GameObject gobject, BTD_Mod_Helper.Api.UI.ModWindowColor.PanelType type);
gobject
UnityEngine.GameObject
Game object that has an Image component
type
PanelType
panel type
Closes this Window
public void Close();
Creates a ModHelperWindow gameobject and adds it to the appropriate parent object for Windows.
Also creates a corresponding ModHelperDockButton within the ModHelperDock
public static BTD_Mod_Helper.Api.Components.ModHelperWindow Create(BTD_Mod_Helper.Api.Components.Info info, int topBarHeight=50, string icon=null, string title=null, float iconScale=1f, string dockTitle=null);
info
Info
the position / size / name info
topBarHeight
System.Int32
the height of the top bar
icon
System.String
the icon to display, or null for none
title
System.String
the title to display, or null for none
iconScale
System.Single
visual scale for the icon
dockTitle
System.String
title for the dock button
ModHelperWindow
the created ModHelperWindow
Creates a ModHelperWindow gameobject from a ModWindow definition
public static BTD_Mod_Helper.Api.Components.ModHelperWindow Create(BTD_Mod_Helper.Api.UI.ModWindow modWindow);
modWindow
ModWindow
ModWindow definition
ModHelperWindow
the created ModHelperWindow
Open the Options Menu for this window at the current mouse position. Will handle changing the menu's position
if it would be off screen
public void OpenRightClickMenu();
Toggles whether this window is Locked, and cant be moved / resized / left clicked normally
public void ToggleLocked();
Toggles whether this window is minimized to the dock
public void ToggleMinimized();
Updates the WindowColor theme for this window
public void UpdateWindowColor(string newColor);
newColor
System.String
new WindowColor theme