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
@@ -20,18 +20,30 @@ public class MyFlatButton : MonoBehaviour
|
||||
var btn = go.GetComponent<UIButton>();
|
||||
go.GetComponent<Image>().sprite = panel.buttonDefaultSprite;
|
||||
btn.gameObject.name = "my-flatbutton";
|
||||
go.SetActive(false);
|
||||
Util.ResetButton(btn);
|
||||
btn.highlighted = false;
|
||||
var img = btn.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = panel.buttonDefaultSprite;
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 13f / 255f);
|
||||
img.color = new Color(1f, 1f, 1f, 13f / 255f);
|
||||
img.enabled = true;
|
||||
}
|
||||
|
||||
img = btn.gameObject.transform.Find("frame")?.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 0f);
|
||||
img.color = new Color(1f, 1f, 1f, 0f);
|
||||
img.enabled = true;
|
||||
}
|
||||
|
||||
var text = btn.gameObject.transform.Find("Text")?.GetComponent<Text>();
|
||||
if (text)
|
||||
{
|
||||
text.text = "";
|
||||
text.color = Color.white;
|
||||
text.fontStyle = FontStyle.Normal;
|
||||
}
|
||||
|
||||
btn.button.onClick.RemoveAllListeners();
|
||||
@@ -53,6 +65,7 @@ public class MyFlatButton : MonoBehaviour
|
||||
|
||||
cb.rectTrans = rect;
|
||||
cb.uiButton = go.GetComponent<UIButton>();
|
||||
Util.ResetButton(cb.uiButton);
|
||||
|
||||
cb.labelText = go.transform.Find("Text")?.GetComponent<Text>();
|
||||
cb.uiButton.onClick += onClick;
|
||||
|
||||
Reference in new issue
Block a user