mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(UXAssist): reset cloned UI state
This commit is contained in:
1 parent
f611f2f9b3
commit
574919f1f0
21 files changed
+308
-58
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user