using System; using System.Collections.Generic; using System.Globalization; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using UXAssist.Common; namespace UXAssist.UI; // MyWindow modified from LSTM: https://github.com/hetima/DSP_LSTM/blob/main/LSTM/MyWindowCtl.cs public class MyWindow : ManualBehaviour { private float _maxX; protected float MaxY; protected const float TitleHeight = 48f; protected const float TabWidth = 105f; protected const float TabHeight = 27f; protected const float Margin = 30f; protected const float Spacing = 10f; public event Action OnFree; private static GameObject _baseObject; public static void InitBaseObject() { if (_baseObject) return; var go = Instantiate(UIRoot.instance.uiGame.inserterWindow.gameObject); go.SetActive(false); go.name = "my-window"; Destroy(go.GetComponent()); for (var i = 0; i < go.transform.childCount; i++) { var child = go.transform.GetChild(i).gameObject; if (child.name != "panel-bg" && child.name != "shadow") { Destroy(child); } } _baseObject = go; } public static T Create(string name, string title = "") where T : MyWindow { var go = Instantiate(_baseObject, UIRoot.instance.uiGame.transform.parent); go.name = name; go.SetActive(false); MyWindow win = go.AddComponent(); if (!win) return null; var btn = go.transform.Find("panel-bg")?.gameObject.GetComponentInChildren