fix(UXAssist): reset cloned UI state

This commit is contained in:
soarqin committed 2026-09-02 18:47:37 +08:00
1 parent f611f2f9b3
commit 574919f1f0
21 files changed
+308 -58

No files matched your search

+24
View File
@@ -1,10 +1,34 @@
using UnityEngine;
using UnityEngine.UI;
namespace UXAssist.UI;
public static class Util
{
public static float GetPreferredWidth(Text text)
{
// DSP caches preferred sizes in its custom text generator, separately from Unity's layout queue.
text.SetLayoutDirty();
return text.preferredWidth;
}
public static void ResetButton(UIButton button)
{
if (!button) return;
button.enabled = true;
button.highlighted = false;
button.updating = true;
button.data = 0;
button.tips = default;
if (button.button)
{
button.button.enabled = true;
button.button.interactable = true;
}
button.MReset();
}
public static RectTransform NormalizeRectWithTopLeft(Component cmp, float left, float top, Transform parent = null)
{
if (cmp.transform is not RectTransform rect) return null;