lstwoMODS Core • Custom UI
Creating Windows
Sometimes regular mods aren’t enough. For that you can create a custom window.
You can create one by creating a class extending BaseWindow:
public class MyWindow : BaseWindow
{
public MyWindow()
{
Name = "My Window";
TitleIcon = Lucide.Hexagon;
}
public override Group ConstructUI()
{
return new Group(Name);
}
public override void RefreshUI()
{
}
} Then you can instantiate it in your Plugin’s Awake method:
private static MyWindow myWindow;
private void Awake()
{
myWindow = new MyWindow();
} The window should now appear in game and you can start adding UI elements to the Window:
public class MyWindow : BaseWindow
{
public static Ref<float> MyFloat = new();
private static bool initialized;
public MyWindow()
{
Name = "My Window";
TitleIcon = Lucide.Hexagon;
if(initialized)
{
return;
}
MyFloat.Changed += num =>
{
Player.Speed = num;
}
initialized = true;
}
public override Group ConstructUI()
{
return new Group(Name,
new DragFloat("My Float").WithValue(MyFloat)
);
}
public override void RefreshUI()
{
MyFloat.Value = Player.Speed;
}
}