1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 03:33:29 +08:00

WIP for UXAssist new features

This commit is contained in:
2025-04-13 20:05:20 +08:00
parent cdd71006b8
commit 5674d601ec
7 changed files with 302 additions and 112 deletions

View File

@@ -42,7 +42,7 @@ public class MyWindow : ManualBehaviour
_baseObject = go;
}
public static T Create<T>(string name, string title = "") where T : MyWindow
{
var go = Instantiate(_baseObject, UIRoot.instance.uiGame.transform.parent);
@@ -236,7 +236,7 @@ public class MyWindow : ManualBehaviour
MaxY = Math.Max(MaxY, y + cb.Height);
return cb;
}
public MyComboBox AddComboBox(float x, float y, RectTransform parent, string label = "", int fontSize = 15)
{
var comboBox = MyComboBox.CreateComboBox(x, y, parent).WithPrompt(label).WithFontSize(fontSize);
@@ -271,6 +271,12 @@ public class MyWindow : ManualBehaviour
}
}
public class RangeValueMapper<T>(int min, int max) : ValueMapper<T>
{
public override int Min => min;
public override int Max => max;
}
public MySlider AddSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, ValueMapper<T> valueMapper, string format = "G", float width = 0f)
{
var slider = MySlider.CreateSlider(x, y, parent, OnConfigValueChanged(config), valueMapper.Min, valueMapper.Max, format, width);
@@ -362,7 +368,7 @@ public class MyWindow : ManualBehaviour
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
return inputField;
}
public InputField AddInputField(float x, float y, float width, RectTransform parent, ConfigEntry<string> config, int fontSize = 16, string objName = "input")
{
var stationWindow = UIRoot.instance.uiGame.stationWindow;