fix(uxassist): restore native tips and align auto-cruise sliders

This commit is contained in:
soarqin committed 2026-09-26 16:15:20 +08:00
1 parent 439b5053d8
commit 94a6833aae
4 files changed
+27 -47

No files matched your search

+2 -2
View File
@@ -36,7 +36,7 @@
- Use `ModCompatHelper` for external plugin/type/member resolution and preserve legacy public type identities when refactoring reflection targets. Use `DysonSphereReflection` for DSPOptimizations-compatible Dyson sphere fields.
- Performance-sensitive Harmony transpilers must include the standard target/fallback header and use `TranspilerGuard` when a matcher can fail; returning original instructions is the fallback. Match named enum members and semantic calls or fields instead of hard-coded enum values or local-variable slots. Validate injected stack operand types and branch destinations, not just successful matching.
- `PatchImpl<T>.Enable(true)` must remain fail-soft: log, unpatch, and leave the patch unset if Harmony application fails so config delegate chains remain consistent.
- Overlay UI state must converge from actual game state on periodic updates, not depend only on one-shot event or patch callbacks. Treat replacement of a planet transport as a lifecycle boundary and clear its dependent overlays once. Station IDs are reusable indices, and a stable planet ID or factory reference does not imply stable transport ownership. Cloned controls must reset runtime state while retaining source styles; use `UXAssist.UI.Util.GetPreferredWidth` for dynamic text and `ResetButton` for cloned buttons. Shared button sizing must use anchor-relative child positions so text and icons remain aligned after a button pivot changes.
- Overlay UI state must converge from actual game state on periodic updates, not depend only on one-shot event or patch callbacks. Treat replacement of a planet transport as a lifecycle boundary and clear its dependent overlays once. Station IDs are reusable indices, and a stable planet ID or factory reference does not imply stable transport ownership. Cloned controls must reset runtime state while retaining source styles; use `UXAssist.UI.Util.GetPreferredWidth` for dynamic text and `ResetButton` for cloned buttons. Preserve the source tip settings when resetting cloned help buttons so the game's native tips work; do not replace them with separate dialogs. Shared button sizing must use anchor-relative child positions so text and icons remain aligned after a button pivot changes.
- Logistics station overlays must refresh through the native UI lifecycle, independently of typing guards. Reconcile cached tips against live station/entity identities and recycle local tips when stations are removed.
- UI-only options must preserve native progression, statistics, and event delivery. Suppress presentation handlers rather than bypassing authoritative game-state setters.
- LiveStreamAssist browser overlays must use single-flight polling and discard stale work after connection changes. Compound queries must reject mixed session IDs; cache only positive production indices so newly tracked items remain discoverable.
@@ -58,7 +58,7 @@
- `PlayerPatch.AutoNavigation` is the only auto-cruise implementation. Its Harmony patches follow `AutoCruiseEnabled`; use auto-cruise terminology in user-facing text rather than the game's native autopilot terminology. Keep persistent status and the current configured shortcut on the auto-cruise button, without a separate HUD label; fix its left edge so adaptive width grows rightward without overlapping the auto-construct button.
- Use one navigation lifecycle path for target state and reusable obstacle data. Require a resolvable target, yield to `player.navigation.navigating`, and reject an active native autopilot before reporting that auto-cruise started.
- Preserve native movement and braking conventions; manual warp input takes precedence.
- Use `MySideSlider` consistently for auto-cruise numeric settings. Keep each slider and its value label on a shared vertical center with explicit anchors and pivots, without additional row offsets.
- Use `MySideSlider` consistently for auto-cruise numeric settings. Align slider starts to the widest localized row label and size tracks so their value labels sit nearby. Keep each slider and its value label on a shared vertical center with explicit anchors and pivots, without additional row offsets.
## Review Standard
+4
View File
@@ -4,6 +4,8 @@
## Changlog
* 1.6.1
* `Settings help`: Restore the game's native tips on question-mark buttons.
* `Auto-cruise`: Align the settings sliders and reduce spacing between their tracks and values.
* `Real-time logistic stations info panel`: Fix lingering panels after dismantling stations or initializing a planet, and keep panels updating while typing.
* `Do not render factory entities (except belts and sorters)`: Fix the option not taking effect after updating to DSP 0.10.35.29057.
* 1.6.0
@@ -418,6 +420,8 @@
## 更新日志
* 1.6.1
* `设置提示`:修复问号按钮的游戏内提示不显示的问题。
* `自动巡航`:统一设置滑条的起始位置,并缩小滑条与数值之间的间距。
* `物流站实时信息面板`:修复拆除物流站或初始化本行星后面板残留的问题,输入文字时也会保持刷新。
* `不渲染工厂建筑实体(除了传送带和分拣器)`:修复更新到戴森球计划 0.10.35.29057 后该选项不生效的问题。
* 1.6.0
+2
View File
@@ -39,8 +39,10 @@ public static class LayoutHelper
var dst = UnityEngine.Object.Instantiate(src);
dst.gameObject.name = objName;
var btn = dst.GetComponent<UIButton>();
var tipSettings = btn.tips;
Util.ResetButton(btn);
Util.NormalizeRectWithTopLeft(btn, x, y, parent);
btn.tips = tipSettings;
btn.tips.topLevel = true;
btn.tips.tipTitle = label;
btn.tips.tipText = tip;
+19 -45
View File
@@ -703,63 +703,37 @@ public static class UIConfigWindow
var autoStopCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.StopOnArrivalAndInput, I18NKeys.StopAutoCruiseOnManualInput, 13);
y += 27f;
var useWarpCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.UseWarper, I18NKeys.UseWarp, 13);
var autoCruiseSliderLabelWidth = 0f;
y += 27f;
var warpEnergyY = y;
txt = wnd.AddText2(x + 20f, y, tab4, I18NKeys.UseWarpMinimalEnergy, 13, "use-warp-minimal-energy");
var warpEnergySlider = wnd.AddSideSlider(
x + 20f + UI.Util.GetPreferredWidth(txt) + 5f,
y,
tab4,
PlayerPatch.UseWarperMinimalEnergy,
new EnergyMapper( ),
"0",
200f,
- 100f).WithFontSize(13);
autoCruiseSliderLabelWidth = Mathf.Max(autoCruiseSliderLabelWidth, UI.Util.GetPreferredWidth(txt));
y += 27f;
var newNavDistanceY = y;
txt = wnd.AddText2(x + 20f, y, tab4, I18NKeys.DistanceToUseWarp, 13, "text-new-navigation-distance-to-warp");
var newNavDistanceSlider = wnd.AddSideSlider(
x + 20f + UI.Util.GetPreferredWidth(txt) + 5f,
y,
tab4,
PlayerPatch.UseWarperDistance,
new DistanceMapper( ),
"0.0",
200f,
-100f).WithFontSize(13);
autoCruiseSliderLabelWidth = Mathf.Max(autoCruiseSliderLabelWidth, UI.Util.GetPreferredWidth(txt));
y += 27f;
var speedUpCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.UseSpeedUp, I18NKeys.AutoBoost, 13);
y += 27f;
var speedUpEnergyY = y;
txt = wnd.AddText2(x + 20f, y, tab4, I18NKeys.AutoBoostMinimalEnergy, 13, "auto-boost-minimal-energy");
var speedUpEnergySlider = wnd.AddSideSlider(
x + 20f + UI.Util.GetPreferredWidth(txt) + 5f,
y,
tab4,
PlayerPatch.UseSpeedUpMinimalEnergy,
new EnergyMapper( ),
"0",
200f,
- 100f).WithFontSize(13);
autoCruiseSliderLabelWidth = Mathf.Max(autoCruiseSliderLabelWidth, UI.Util.GetPreferredWidth(txt));
y += 27f;
var dfHiveY = y;
txt = wnd.AddText2(x + 20f, y, tab4, I18NKeys.DarkFogHiveFollowDistance, 13, "dark-fog-hive-follow-distance");
var dfHiveSlider = wnd.AddSideSlider(
x + 20f + UI.Util.GetPreferredWidth(txt) + 5f,
y,
tab4,
PlayerPatch.DFHiveFollowDistance,
new DistanceMapperHive( ),
"0.0",
200f,
- 100f).WithFontSize(13);
autoCruiseSliderLabelWidth = Mathf.Max(autoCruiseSliderLabelWidth, UI.Util.GetPreferredWidth(txt));
y += 27f;
var dfCarrierY = y;
txt = wnd.AddText2(x + 20f, y, tab4, I18NKeys.DarkFogCarrierFollowDistance, 13, "dark-fog-carrier-follow-distance");
var dfCarrierSlider = wnd.AddSideSlider(
x + 20f + UI.Util.GetPreferredWidth(txt) + 5f,
y,
tab4,
PlayerPatch.DFCarrierFollowDistance,
new DistanceMapperCarrier( ),
"0.0",
200f,
- 100f).WithFontSize(13);
autoCruiseSliderLabelWidth = Mathf.Max(autoCruiseSliderLabelWidth, UI.Util.GetPreferredWidth(txt));
var sliderX = x + 20f + autoCruiseSliderLabelWidth + 5f;
const float sliderWidth = 160f;
var warpEnergySlider = wnd.AddSideSlider(sliderX, warpEnergyY, tab4, PlayerPatch.UseWarperMinimalEnergy, new EnergyMapper(), "0", sliderWidth, -100f).WithFontSize(13);
var newNavDistanceSlider = wnd.AddSideSlider(sliderX, newNavDistanceY, tab4, PlayerPatch.UseWarperDistance, new DistanceMapper(), "0.0", sliderWidth, -100f).WithFontSize(13);
var speedUpEnergySlider = wnd.AddSideSlider(sliderX, speedUpEnergyY, tab4, PlayerPatch.UseSpeedUpMinimalEnergy, new EnergyMapper(), "0", sliderWidth, -100f).WithFontSize(13);
var dfHiveSlider = wnd.AddSideSlider(sliderX, dfHiveY, tab4, PlayerPatch.DFHiveFollowDistance, new DistanceMapperHive(), "0.0", sliderWidth, -100f).WithFontSize(13);
var dfCarrierSlider = wnd.AddSideSlider(sliderX, dfCarrierY, tab4, PlayerPatch.DFCarrierFollowDistance, new DistanceMapperCarrier(), "0.0", sliderWidth, -100f).WithFontSize(13);
PlayerPatch.AutoCruiseEnabled.SettingChanged += NavSettingChanged;
PlayerPatch.UseWarper.SettingChanged += NavSettingChanged;