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

Work in progress

This commit is contained in:
2023-10-31 01:54:32 +08:00
parent 88f1fb22b8
commit 5d58a2a8fa
9 changed files with 169 additions and 7 deletions

View File

@@ -80,14 +80,19 @@ public class MyWindow: ManualBehaviour
btn.UpdateTip();
return btn;
}
public UIButton AddButton(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "button", UnityAction onClick = null)
{
return AddButton(x, y, 150f, parent, text, fontSize, objName, onClick);
}
public UIButton AddButton(float x, float y, float width, RectTransform parent, string text = "", int fontSize = 16, string objName = "button", UnityAction onClick = null)
{
var panel = UIRoot.instance.uiGame.statWindow.performancePanelUI;
var btn = Instantiate(panel.cpuActiveButton);
btn.gameObject.name = objName;
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
rect.sizeDelta = new Vector2(150, rect.sizeDelta.y);
rect.sizeDelta = new Vector2(width, rect.sizeDelta.y);
var l = btn.gameObject.transform.Find("button-text").GetComponent<Localizer>();
var t = btn.gameObject.transform.Find("button-text").GetComponent<Text>();
if (l != null)