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

+3
View File
@@ -78,6 +78,9 @@ internal static class AutoConstructUI
ConstructCountText.color = new Color(1f, 1f, 1f, 0.4f);
ConstructCountText.alignment = TextAnchor.MiddleLeft;
ConstructCountText.fontSize = 16;
ConstructCountText.fontStyle = FontStyle.Normal;
ConstructCountText.horizontalOverflow = HorizontalWrapMode.Overflow;
ConstructCountText.verticalOverflow = VerticalWrapMode.Overflow;
rectTrans = ConstructCountText.rectTransform;
rectTrans.SetParent(ConstructCountPanel.transform);
rectTrans.sizeDelta = new Vector2(150f, 20f);
+9
View File
@@ -77,6 +77,12 @@ internal static class MenuButtonUI
var parent = src.transform.parent;
var btn = GameObject.Instantiate(src, parent);
btn.name = "button-uxassist-config";
btn.button.enabled = true;
btn.button.interactable = true;
btn.text.color = Color.white;
btn.text.fontStyle = FontStyle.Normal;
btn.selectBg.color = new Color(1f, 1f, 1f, 0f);
btn.selectBar.color = new Color(1f, 1f, 1f, 0f);
var l = btn.text.GetComponent<Localizer>();
if (l != null)
{
@@ -103,10 +109,13 @@ internal static class MenuButtonUI
_buttonOnPlanetGlobe = b.gameObject;
var rect = (RectTransform)_buttonOnPlanetGlobe.transform;
var btn = _buttonOnPlanetGlobe.GetComponent<UIButton>();
global::UXAssist.UI.Util.ResetButton(btn);
var img = _buttonOnPlanetGlobe.transform.Find("button-2/icon")?.GetComponent<Image>();
if (img != null)
{
img.sprite = icon;
img.color = Color.white;
img.enabled = icon != null;
}
if (_buttonOnPlanetGlobe != null && btn != null)
+7 -4
View File
@@ -187,6 +187,9 @@ internal static class MilkyWayUI
txt.color = new Color(1f, 1f, 1f, 0.4f);
txt.alignment = TextAnchor.MiddleLeft;
txt.fontSize = 15;
txt.fontStyle = FontStyle.Normal;
txt.horizontalOverflow = HorizontalWrapMode.Overflow;
txt.verticalOverflow = VerticalWrapMode.Overflow;
txt.rectTransform.sizeDelta = new Vector2(0, 18);
return txt;
}
@@ -266,10 +269,10 @@ internal static class MilkyWayUI
textFields[i * 4 + 1].text = _topTenPlayerData[i].name;
textFields[i * 4 + 2].text = SeedToString(_topTenPlayerData[i].seedKey);
textFields[i * 4 + 3].text = String.Format("{0}W", ToKMG(_topTenPlayerData[i].genCap * 60L));
maxWidth0 = Math.Max(maxWidth0, textFields[i * 4].preferredWidth);
maxWidth1 = Math.Max(maxWidth1, textFields[i * 4 + 1].preferredWidth);
maxWidth2 = Math.Max(maxWidth2, textFields[i * 4 + 2].preferredWidth);
maxWidth3 = Math.Max(maxWidth3, textFields[i * 4 + 3].preferredWidth);
maxWidth0 = Math.Max(maxWidth0, global::UXAssist.UI.Util.GetPreferredWidth(textFields[i * 4]));
maxWidth1 = Math.Max(maxWidth1, global::UXAssist.UI.Util.GetPreferredWidth(textFields[i * 4 + 1]));
maxWidth2 = Math.Max(maxWidth2, global::UXAssist.UI.Util.GetPreferredWidth(textFields[i * 4 + 2]));
maxWidth3 = Math.Max(maxWidth3, global::UXAssist.UI.Util.GetPreferredWidth(textFields[i * 4 + 3]));
button.gameObject.SetActive(true);
textFields[i * 4].gameObject.SetActive(true);
textFields[i * 4 + 1].gameObject.SetActive(true);