Class TimbnUI
Reads and drives the game's own screens, such as which window is open and the fade to black. See the plugin's UI property for things a plugin shows that have to be taken down again.
public static class TimbnUI
- Inheritance
-
TimbnUI
- Inherited Members
Properties
ActiveWindow
The game window on top, such as the inventory, a chest, or the pause menu, or null when the player is in the world with nothing open.
public static LazyWidgetBase? ActiveWindow { get; }
Property Value
- LazyWidgetBase
IsScreenFading
True while the screen is fading to or from black. A hotkey or a scripted change should wait until it ends.
public static bool IsScreenFading { get; }
Property Value
Methods
IsWindowOpen<TWindow>()
Whether the game window on top is of the given type, such as the building window.
public static bool IsWindowOpen<TWindow>() where TWindow : LazyWidgetBase
Returns
- bool
True when that window is open and on top.
Type Parameters
TWindowThe window's type.
Examples
if (TimbnUI.IsWindowOpen<UIBuildingWindow>())
BuildPins.Draw();
Notify(string)
Shows a line of text in the game's own notification popup, the one it uses for things like a closed shop. The text is looked up by its localization key, so add it with Text.Add or a lang file. It can name an item or an NPC with the game's #(id) markup.
public static void Notify(string key)
Parameters
keystringThe text's localization key.
Examples
TimbnUI.Notify("my_mod_parcel_lost");
Notify(string, string)
Shows a line of text in the game's notification popup like Notify(string), with an icon beside it.
public static void Notify(string key, string iconId)
Parameters
keystringThe text's localization key.
iconIdstringAn icon shown beside the text, such as an item's i_cup_beer or one added with Sprites.AddPng.
Examples
TimbnUI.Notify("my_mod_bar_open", "i_cup_beer");
NotifyOnce(string)
Shows a line of text in the game's notification popup like Notify(string), unless the same text is on screen already, for a warning that would otherwise stack up every frame.
public static void NotifyOnce(string key)
Parameters
keystringThe text's localization key.
Examples
TimbnUI.NotifyOnce("my_mod_conveyor_loop");