-
Notifications
You must be signed in to change notification settings - Fork 3
Home
There are 3 sources of documentation: this wiki page, example mod, and xml file (see bellow).
for external mods that want to register UUI buttons please look at the example mod: https://github.com/kianzarrin/UnifiedUI/blob/master/ExampleMod/ExampleMod.cs#L79 https://github.com/kianzarrin/UnifiedUI/blob/46588dce57bc45ac73602284a6441c375fa9bd50/ExampleMod/UIKeymappingsPanel.cs#L27
please contact me on discord to ask about your specific use case.
you can download the library UnifeidUIlib.dll
and its documentation UnifedUILib.xml
from:
- the steam WS mod page
- the releases here on github
- nuget: https://www.nuget.org/packages/UnifiedUILib
a 40x40 foreground icon texture with transparent background to blend into background texture such as Hovered, Pressed, and Normal.
using UnifiedUI.Helpers;
string iconPath = UserMod.instance.GetFullPath("Resources", "icon.png"); // returns Path/To/Mod/Resources/icon.png
var button = UUIHelpers.RegisterToolButton(
name: "MyModButton",
groupName: null, // default group
tooltip: "some tooltip",
tool: mytool,
icon: UUIHelpers.LoadTexture(iconPath),
hotkeys: new UUIHotKeys { ActivationKey= ModSettings.Hotkey });
- pressing the ActivationHotkey enables your mod (your mod should not handle the hotkey anymore).
- if your tool is active, UUI will prevent other mods from using their
activationKey
if it collides with yourIn tool HotKey
- HotKeys may be modified in UUI, so don't forget to add the following line: UIKeymappingsPanel.cs:27
User may change keybind inside UUI settings to resolve hotkey conflict with another mod. Therefore your code needs to update the keybind text when this happens. use this code: https://github.com/kianzarrin/UnifiedUI/blob/46588dce57bc45ac73602284a6441c375fa9bd50/ExampleMod/UIKeymappingsPanel.cs#L27
using UnifiedUI.Helpers;
string iconPath = UserMod.instance.GetFullPath("Resources", "icon.png"); // returns Path/To/Mod/Resources/icon.png
var customButton = UUIHelpers.RegisterCustomButton(
name: "MyModButton",
groupName: null, // default group
tooltip: "some tooltip",
icon: UUIHelpers.LoadTexture(iconPath),
onToggle:(value)=> value ? MyWindow.Open() : MyWindow.Close();
onToolChanged: null,
hotkeys: new UUIHotKeys { ActivationKey= ModSettings.Hotkey });
MyWindow.Start() => customButton.IsActive = true;
MyWindow.OnDestroy() => customButton.IsActive = false;
If you do not wish to register button and only wish to register hotkeys.
var activeKeys = new Dictionary<SavedInputKey, Func<bool>>(){
{hotkey1,()=>true},
{hotkey2,()=>true},
}
UUIHelpers.RegisterHotkeys(
onToggle: ToggleMod,
activationKey: new SavedInputKey(...),
activeKeys: activeKeys );