fix(UXAssist): fix UI color issue imported in 574919f

This commit is contained in:
soarqin committed 2026-09-11 00:41:28 +08:00
1 parent 87061d5235
commit 4b2f9c67dc
16 files changed
+14 -48

No files matched your search

-1
View File
@@ -72,7 +72,6 @@ public static class LayoutHelper
if (t != null)
{
t.text = text.Translate();
t.color = Color.white;
t.fontStyle = FontStyle.Normal;
t.horizontalOverflow = HorizontalWrapMode.Overflow;
t.verticalOverflow = VerticalWrapMode.Overflow;
-2
View File
@@ -47,7 +47,6 @@ public class MyCheckButton : MonoBehaviour
{
txt.text = "";
txt.alignment = TextAnchor.MiddleCenter;
txt.color = Color.white;
txt.fontStyle = FontStyle.Normal;
txt.rectTransform.anchorMax = new Vector2(0f, 1f);
txt.rectTransform.anchorMin = new Vector2(0f, 1f);
@@ -95,7 +94,6 @@ public class MyCheckButton : MonoBehaviour
{
cb.labelText.text = "";
cb.labelText.fontSize = fontSize;
cb.labelText.color = Color.white;
cb.labelText.fontStyle = FontStyle.Normal;
}
}
+12 -16
View File
@@ -17,10 +17,9 @@ public class MyCheckBox : MonoBehaviour
private bool _checked;
private static GameObject _baseObject;
private static readonly Color BoxColor = new(1f, 1f, 1f, 100f / 255f);
private static readonly Color CheckColor = new(1f, 1f, 1f, 1f);
private static readonly Color TextColor = new(178f / 255f, 178f / 255f, 178f / 255f, 168f / 255f);
private static Color _boxColor;
private static Color _checkColor;
private static Color _textColor;
public static void InitBaseObject()
{
@@ -32,13 +31,12 @@ public class MyCheckBox : MonoBehaviour
var boxImage = go.GetComponent<Image>();
if (boxImage)
{
boxImage.color = BoxColor;
boxImage.enabled = true;
}
var checkImage = go.transform.Find("checked")?.GetComponent<Image>();
if (checkImage)
{
checkImage.color = CheckColor;
_checkColor = checkImage.color;
checkImage.enabled = false;
}
var comp = go.transform.Find("text");
@@ -48,13 +46,14 @@ public class MyCheckBox : MonoBehaviour
if (txt)
{
txt.text = "";
txt.color = TextColor;
_textColor = txt.color;
txt.alignment = TextAnchor.MiddleLeft;
txt.fontStyle = FontStyle.Normal;
}
var localizer = comp.GetComponent<Localizer>();
if (localizer) DestroyImmediate(localizer);
}
if (boxImage) _boxColor = boxImage.color;
_baseObject = go;
}
@@ -86,9 +85,7 @@ public class MyCheckBox : MonoBehaviour
cb.boxImage = go.transform.GetComponent<Image>();
cb.checkImage = go.transform.Find("checked")?.GetComponent<Image>();
Util.ResetButton(cb.uiButton);
cb.boxImage.color = BoxColor;
cb.boxImage.enabled = true;
cb.checkImage.color = CheckColor;
cb.checkImage.enabled = false;
Util.NormalizeRectWithTopLeft(cb.checkImage, 0f, 0f);
@@ -100,7 +97,6 @@ public class MyCheckBox : MonoBehaviour
{
cb.labelText.text = "";
cb.labelText.fontSize = fontSize;
cb.labelText.color = TextColor;
cb.labelText.alignment = TextAnchor.MiddleLeft;
cb.labelText.fontStyle = FontStyle.Normal;
cb.UpdateLabelTextWidth();
@@ -141,15 +137,15 @@ public class MyCheckBox : MonoBehaviour
if (uiButton) uiButton.enabled = on;
if (on)
{
if (boxImage) boxImage.color = BoxColor;
if (checkImage) checkImage.color = CheckColor;
if (labelText) labelText.color = TextColor;
if (boxImage) boxImage.color = _boxColor;
if (checkImage) checkImage.color = _checkColor;
if (labelText) labelText.color = _textColor;
}
else
{
if (boxImage) boxImage.color = BoxColor.RGBMultiplied(0.5f);
if (checkImage) checkImage.color = CheckColor.RGBMultiplied(0.5f);
if (labelText) labelText.color = TextColor.RGBMultiplied(0.5f);
if (boxImage) boxImage.color = _boxColor.RGBMultiplied(0.5f);
if (checkImage) checkImage.color = _checkColor.RGBMultiplied(0.5f);
if (labelText) labelText.color = _textColor.RGBMultiplied(0.5f);
}
}
-4
View File
@@ -42,7 +42,6 @@ public class MyComboBox : MonoBehaviour
txtComp.font = fontSource.font;
txtComp.fontSize = fontSource.fontSize;
txtComp.fontStyle = fontSource.fontStyle;
txtComp.color = Color.white;
}
txtComp = rect.Find("Main Button/Text")?.GetComponent<Text>();
if (txtComp)
@@ -50,7 +49,6 @@ public class MyComboBox : MonoBehaviour
txtComp.font = fontSource.font;
txtComp.fontSize = fontSource.fontSize;
txtComp.fontStyle = fontSource.fontStyle;
txtComp.color = Color.white;
}
}
cbctrl.onSubmit.RemoveAllListeners();
@@ -59,8 +57,6 @@ public class MyComboBox : MonoBehaviour
cbctrl.isDroppedDown = false;
cbctrl.m_Input.text = "";
cbctrl.m_Text.text = "";
cbctrl.m_Input.textComponent.color = Color.white;
cbctrl.m_Text.color = Color.white;
cbctrl.m_DropDownContent.anchoredPosition = Vector2.zero;
cbctrl.m_DropDownList.gameObject.SetActive(false);
cbctrl.m_EmptyItemRes.gameObject.SetActive(false);
-3
View File
@@ -33,8 +33,6 @@ public class MyCornerComboBox : MonoBehaviour
cbctrl.isDroppedDown = false;
cbctrl.m_Input.text = "";
cbctrl.m_Text.text = "";
cbctrl.m_Input.textComponent.color = Color.white;
cbctrl.m_Text.color = Color.white;
cbctrl.m_DropDownContent.anchoredPosition = Vector2.zero;
cbctrl.m_DropDownList.gameObject.SetActive(false);
cbctrl.m_EmptyItemRes.gameObject.SetActive(false);
@@ -46,7 +44,6 @@ public class MyCornerComboBox : MonoBehaviour
}
cbctrl.Items.Clear();
cbctrl.ItemButtons.Clear();
cbctrl.m_ListItemRes.GetComponentInChildren<Text>().color = Color.white;
_baseObject = go;
}
-3
View File
@@ -27,14 +27,12 @@ public class MyFlatButton : MonoBehaviour
if (img != null)
{
img.sprite = panel.buttonDefaultSprite;
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(1f, 1f, 1f, 0f);
img.enabled = true;
}
@@ -42,7 +40,6 @@ public class MyFlatButton : MonoBehaviour
if (text)
{
text.text = "";
text.color = Color.white;
text.fontStyle = FontStyle.Normal;
}
-1
View File
@@ -64,7 +64,6 @@ public class MyKeyBinder : MonoBehaviour
Util.ResetButton(kb.setDefaultUIButton);
Util.ResetButton(kb.setNoneKeyUIButton);
kb.functionText.text = "";
kb.functionText.color = Color.white;
kb.functionText.fontStyle = FontStyle.Normal;
kb.keyText.text = "";
kb.keyText.color = uikeyEntry.builtinColor;
-1
View File
@@ -51,7 +51,6 @@ public class MySideSlider : MonoBehaviour
sl.labelText = go.transform.Find("value").GetComponent<Text>();
sl.labelText.text = "";
sl.labelText.color = Color.white;
sl.labelText.fontStyle = FontStyle.Normal;
sl.labelText.alignment = textWidth <= 0f ? TextAnchor.MiddleLeft : TextAnchor.MiddleRight;
if (sl.labelText.transform is RectTransform rectTrans2)
-1
View File
@@ -52,7 +52,6 @@ public class MySlider : MonoBehaviour
if (sl.labelText)
{
sl.labelText.text = "";
sl.labelText.color = Color.white;
sl.labelText.alignment = TextAnchor.MiddleCenter;
sl.labelText.fontStyle = FontStyle.Normal;
sl.labelText.fontSize = 14;
-4
View File
@@ -391,7 +391,6 @@ public class MyWindow : ManualBehaviour
var rect = Util.NormalizeRectWithTopLeft(inputField, x, y, parent);
rect.sizeDelta = new Vector2(210, rect.sizeDelta.y);
inputField.text = text;
inputField.textComponent.color = Color.white;
inputField.textComponent.fontStyle = FontStyle.Normal;
inputField.textComponent.fontSize = fontSize;
@@ -458,7 +457,6 @@ public class MyWindowWithTabs : MyWindow
var btn = Instantiate(src);
Util.ResetButton(btn);
btn.gameObject.GetComponent<Image>().sprite = swarmPanel.buttonDefaultSprite;
btn.gameObject.GetComponent<Image>().color = Color.white;
btn.gameObject.GetComponent<Image>().enabled = true;
btn.name = "tab-btn-" + index;
btn.highlighted = false;
@@ -480,7 +478,6 @@ public class MyWindowWithTabs : MyWindow
shadow.effectColor = new Color(0f, 0f, 0f, 0.4f);
shadow.effectDistance = new Vector2(1f, -1f);
btnText.text = label.Translate();
btnText.color = Color.white;
btnText.fontSize = 16;
btnText.fontStyle = FontStyle.Normal;
btn.data = index;
@@ -505,7 +502,6 @@ public class MyWindowWithTabs : MyWindow
var image = img.GetComponent<Image>();
if (image)
{
image.color = Color.white;
image.enabled = true;
}
Destroy(img.Find("tri").gameObject);
+1
View File
@@ -16,6 +16,7 @@ public static class Util
public static void ResetButton(UIButton button)
{
if (!button) return;
button.Init();
button.enabled = true;
button.highlighted = false;
button.updating = true;