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

UXAssist and CheatEnabler new release

This commit is contained in:
2024-08-22 17:16:55 +08:00
parent fec947e71a
commit 7430f20181
14 changed files with 178 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
using System;
using BepInEx.Configuration;
using UITools;
using UnityEngine;
using UnityEngine.UI;
@@ -57,6 +58,8 @@ public class MyCheckBox : MonoBehaviour
cb.labelText = child.GetComponent<Text>();
cb.labelText.fontSize = fontSize;
cb.SetLabelText(label);
var width = cb.labelText.preferredWidth;
cb.labelText.rectTransform.sizeDelta = new Vector2(width, rect.sizeDelta.y);
}
//value

View File

@@ -14,6 +14,11 @@ public class MyConfigWindow : MyWindowWithTabs
{
return MyWindowManager.CreateWindow<MyConfigWindow>("UXAConfigWindow", "UXAssist Config");
}
public static void DestroyInstance(MyConfigWindow win)
{
MyWindowManager.DestroyWindow(win);
}
public override void _OnCreate()
{
@@ -27,6 +32,7 @@ public class MyConfigWindow : MyWindowWithTabs
public override void _OnDestroy()
{
_windowTrans = null;
}
public override bool _OnInit()

View File

@@ -388,6 +388,14 @@ public static class MyWindowManager
Windows.Add(win);
return (T)win;
}
public static void DestroyWindow(ManualBehaviour win)
{
if (win == null) return;
Windows.Remove(win);
win._Free();
win._Destroy();
}
/*
public static void SetRect(ManualBehaviour win, RectTransform rect)
@@ -409,7 +417,7 @@ public static class MyWindowManager
}
*/
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnDestroy")]
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
public static void UIRoot__OnDestroy_Postfix()
{
foreach (var win in Windows)
@@ -420,7 +428,7 @@ public static class MyWindowManager
Windows.Clear();
}
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnOpen")]
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnOpen))]
public static void UIRoot__OnOpen_Postfix()
{
if (_initialized) return;
@@ -442,7 +450,7 @@ public static class MyWindowManager
}
*/
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnUpdate")]
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
public static void UIRoot__OnUpdate_Postfix()
{
if (GameMain.isPaused || !GameMain.isRunning)
@@ -455,7 +463,7 @@ public static class MyWindowManager
}
}
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "ShutAllFunctionWindow")]
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame.ShutAllFunctionWindow))]
public static void UIGame_ShutAllFunctionWindow_Postfix()
{
foreach (var win in Windows)