mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(UXAssist): fix UI color issue imported in 574919f
This commit is contained in:
1 parent
87061d5235
commit
4b2f9c67dc
16 files changed
+14
-48
No files matched your search
@@ -158,3 +158,4 @@ The sync is implemented as an inline PowerShell `Exec` step inside the `ZipMod`
|
||||
- **Mod-compatibility reflection:** Use `UXAssist.Common.ModCompat.ModCompatHelper` for BepInEx plugin detection, external mod type/method/field resolution, and property-setter lookup. Preserve the old public type identity with a forwarding or inherited compatibility facade when a refactor moves a type that external mods may locate through reflection; build and verify that the legacy reflection target forwards to the refactored implementation. Use `UXAssist.Common.Utils.DysonSphereReflection` for the DSPOptimizations-compatible `DysonSphereLayer` private fields (`totalNodeSP`, `totalFrameSP`, `totalCP`) instead of resolving them locally in each consumer.
|
||||
- **Build quality gates:** Root `.editorconfig` defines suggestion-only C# style conventions. `Directory.Build.props` enables `TreatWarningsAsErrors` with `NoWarn>0618` for the expected obsolete-API usage, so any new warning fails the build. `.github/workflows/build.yml` runs a Release build and packages the three main mods on every push/PR.
|
||||
- **Save persistence:** Mods that need to persist data use the `IModCanSave` interface from DSPModSave.
|
||||
- **Cloned UI button reset:** `UXAssist.UI.Util.ResetButton` calls the original `UIButton.Init` before resetting copied interaction state, preserving the original `Transition.normalColor` values. Do not replace cloned UI styles with guessed colors such as `Color.white`; clear runtime state while retaining the source's default style.
|
||||
@@ -79,10 +79,7 @@ internal static class MenuButtonUI
|
||||
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)
|
||||
{
|
||||
@@ -114,7 +111,6 @@ internal static class MenuButtonUI
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = icon;
|
||||
img.color = Color.white;
|
||||
img.enabled = icon != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
var itemIcon = Object.Instantiate(tipIconPrefab.gameObject, new Vector3(0, 0, 0), Quaternion.identity, _tipPrefab.transform);
|
||||
itemIcon.name = "icon" + index;
|
||||
var itemIconImage = itemIcon.GetComponent<Image>();
|
||||
itemIconImage.color = Color.white;
|
||||
itemIconImage.enabled = true;
|
||||
rectTrans = (RectTransform)itemIcon.transform;
|
||||
rectTrans.sizeDelta = new Vector2(30f, 30f);
|
||||
@@ -402,7 +401,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
var text = countText.GetComponent<Text>();
|
||||
text.fontSize = 18;
|
||||
text.text = "";
|
||||
text.color = Color.white;
|
||||
text.alignment = TextAnchor.UpperRight;
|
||||
text.fontStyle = FontStyle.Normal;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
@@ -419,7 +417,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
stateLocal.name = "iconLocal" + index;
|
||||
var stateLocalImage = stateLocal.GetComponent<Image>();
|
||||
stateLocalImage.material = null;
|
||||
stateLocalImage.color = Color.white;
|
||||
stateLocalImage.enabled = true;
|
||||
rectTrans = (RectTransform)stateLocal.transform;
|
||||
rectTrans.sizeDelta = new Vector2(16f, 16f);
|
||||
@@ -431,7 +428,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
stateRemote.name = "iconRemote" + index;
|
||||
var stateRemoteImage = stateRemote.GetComponent<Image>();
|
||||
stateRemoteImage.material = null;
|
||||
stateRemoteImage.color = Color.white;
|
||||
stateRemoteImage.enabled = true;
|
||||
rectTrans = (RectTransform)stateRemote.transform;
|
||||
rectTrans.sizeDelta = new Vector2(20f, 20f);
|
||||
@@ -443,7 +439,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
|
||||
var iconPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Top Tips/Entity Briefs/brief-info-top/brief-info/content/icons/icon"), _tipPrefab.transform);
|
||||
var iconPrefabImage = iconPrefab.GetComponent<Image>();
|
||||
iconPrefabImage.color = Color.white;
|
||||
iconPrefabImage.enabled = true;
|
||||
Object.Destroy(iconPrefab.transform.Find("count-text").gameObject);
|
||||
Object.Destroy(iconPrefab.transform.Find("bg").gameObject);
|
||||
|
||||
@@ -730,7 +730,6 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
UiTipText = Object.Instantiate(originText, originText.transform.parent);
|
||||
UiTipText.gameObject.SetActive(false);
|
||||
UiTipText.rectTransform.anchoredPosition = new Vector2(0f, 160f);
|
||||
UiTipText.color = Color.white;
|
||||
UiTipText.fontStyle = FontStyle.Normal;
|
||||
UiTipText.text = I18NKeys.AutoNavigationActive.Translate();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -125,7 +125,6 @@ public static class GalaxySelectUIPatch
|
||||
var origText = orig.transform.parent.GetComponent<Text>();
|
||||
title = Object.Instantiate(origText, origText.transform.parent);
|
||||
title.text = "";
|
||||
title.color = Color.white;
|
||||
title.fontStyle = FontStyle.Normal;
|
||||
title.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
title.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
@@ -144,7 +143,6 @@ public static class GalaxySelectUIPatch
|
||||
slider.onValueChanged.RemoveAllListeners();
|
||||
text = slider.transform.FindChildRecur("Text").GetComponent<Text>();
|
||||
text.text = "";
|
||||
text.color = Color.white;
|
||||
text.fontStyle = FontStyle.Normal;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
text.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
|
||||
Reference in new issue
Block a user