mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): correct auto-cruise sail frame, braking and lifecycle
visual_uvel subtracted the unblended planet velocity. PlayerMove_Sail and PlayerNavigation.DetermineSailVelocity both fade that reference frame out with altitude and drop it entirely above 600 m, and PlayerController.UpdateRotation runs after the whole action loop and turns visual_uvel into the mecha heading and the speed readout, so the mecha visibly misaimed while sailing near a planet. Apply the same blend, and stop writing uRotation from the sail postfix, which the game recomputes immediately afterwards anyway. Fixed targets had no approach deceleration: the cruise always aimed at maxSailSpeed and simply stopped at the arrival radius. PlayerMove_Sail only hands over to PlayerMove_Fly below 75 m/s of planet-relative speed, so the mecha could never land. Cap the speed from the remaining distance, apply the brake directly as the original does instead of folding it into the turn interpolation (which weakened it by up to 1/t), and release warp early enough for that brake to settle, since the game's own warp guard only covers planets and never stars. Yield to the game's own autopilot: PlayerNavigation zeroes the movement input inside PlayerMove_Sail and PlayerMove_Fly and drives uVelocity itself, so both were fighting over the same state. AutoConstructPatch already did this. Guard SpaceSector.dfHives, which Init never allocates and Import only allocates when the save carries hive data; the game null-checks it everywhere for that reason and this ran on every sailing tick. Follow AutoCruiseEnabled with the Harmony patches so disabling the feature no longer leaves a transpiler on the hot PlayerController.GameTick installed, and require a resolvable target before starting so the feature cannot emit a started and a stopped popup in the same frame. Refresh the toggle button label wherever Checked is set directly, since MyCheckButton.Checked only updates the colours and the label lives on the OnChecked handlers; toggling by shortcut left it stale. Rename the user-facing strings to auto-cruise so they stop colliding with the game's own navigation feature, and clean up the region: fix the misspelled safety-radius constants, invert and rename the precondition helper, drop the unused Obstacle.Radius, raise the degenerate-vector epsilon, and convert the file's mixed tab indentation to spaces.
This commit is contained in:
1 parent
3a840e7b2d
commit
b5cb9aefb9
5 files changed
+1005
-925
No files matched your search
@@ -142,7 +142,7 @@ The sync is implemented as an inline PowerShell `Exec` step inside the `ZipMod`
|
||||
|
||||
## Key Architectural Patterns
|
||||
|
||||
- Auto-construct motion recovery treats only actual movement keys as manual override, yields to active auto-navigation, clears stale move orders before flight ascent, returns before issuing a same-frame route after switching from walking to flying, and performs one stop-equivalent recovery when a route circles without radial progress. Planner candidates use fixed angular fan sectors with near and far representatives instead of retaining only globally nearest ghosts. Arrival follows the game's surface-direction order semantics. Site selection follows a nearest-cluster route: it prefers the best local candidate within a build-area-scaled horizon and falls back to the nearest candidate, rather than selecting a distant high-density cluster and forcing return flights. A site is held only while its first construction-drone wave remains below capacity and its current throughput is not meaningfully beaten by a nearby candidate; it must not wait merely to exhaust every ghost in range, because waiting extends drone round trips and mecha power use. Normal route changes still brake and wait for tangential flight speed to settle, but recovery detours, their continuation points, and the resumed final route bypass flight settling so they can take over before the mecha stops. Refinement destinations are selected from the scanned ghost positions. After a destination is chosen, eligible ghosts in its approach corridor are reduced to the closest route-prefix ghost so travel cannot bypass nearer construction work. Obstacle probing is only allowed to initiate a detour after stuck or orbit evidence; it detects overlapping colliders, derives a horizontal footprint radius from the collider bounds, tests tangent candidates at several radii and sides, chooses the least-blocked horizontal fallback when no fully clear tangent exists, and a completed detour resumes the final construction route instead of resetting the plan.
|
||||
- Auto-construct motion recovery treats only actual movement keys as manual override (through the shared `PlayerInputUtil.HasManualMovementInput`), yields to active auto-navigation, clears stale move orders before flight ascent, returns before issuing a same-frame route after switching from walking to flying, and performs one stop-equivalent recovery when a route circles without radial progress. Planner candidates use fixed angular fan sectors with near and far representatives instead of retaining only globally nearest ghosts; a sector's near/far separation is measured as a real distance between the two representatives, and a displaced near representative is demoted to the far slot so the pair does not depend on prebuild iteration order. Arrival follows the game's surface-direction order semantics. Site selection follows a nearest-cluster route: it prefers the best local candidate within a build-area-scaled horizon and falls back to the nearest candidate, rather than selecting a distant high-density cluster and forcing return flights. A site is held only while its first construction-drone wave remains below capacity and its current throughput is not meaningfully beaten by a nearby candidate; it must not wait merely to exhaust every ghost in range, because waiting extends drone round trips and mecha power use. Normal route changes still brake and wait for tangential flight speed to settle, but recovery detours, their continuation points, and the resumed final route bypass flight settling so they can take over before the mecha stops. Refinement destinations are selected from the scanned ghost positions. After a destination is chosen, eligible ghosts in its approach corridor are reduced to the closest route-prefix ghost so travel cannot bypass nearer construction work; the corridor half-width is compared as a sine against the candidate's out-of-plane component, never as an angle against a sine. Obstacle probing is only allowed to initiate a detour after stuck or orbit evidence; it detects overlapping colliders, derives a horizontal footprint radius from the collider bounds, tests tangent candidates at several radii and sides, chooses the least-blocked horizontal fallback when no fully clear tangent exists, and a completed detour resumes the final construction route instead of resetting the plan. Distances between surface positions are great-circle distances, not chord lengths.
|
||||
|
||||
- **Shared library:** `UXAssist` acts as a common library. `CheatEnabler` and `UniverseGenTweaks` reference `UXAssist.csproj` directly to reuse `Common/`, `UI/`, and config panel infrastructure.
|
||||
- **Centralized mod-feature lifecycle:** `UXAssist.Common.ModFeatures.ModFeatureRegistry` holds shared static lists of mod features discovered across all mods. **Only UXAssist drives the shared deferred lifecycle** (`StartAll`/`UninitAll`/`OnInputUpdateAll`/`OnUpdateAll`); these dispatchers are `internal` so dependent mods (separate assemblies, no `InternalsVisibleTo`) cannot call them and re-trigger other mods' features. A feature's `Init` runs **eagerly** when it is registered (via `Discover`/`Register`), preserving the original `Awake`-phase timing that keybind registration and other early setup rely on — the game's `UIOptionWindow._OnCreate` copies registered keybinds only after all plugins have finished loading. Dependent mods only call `ModFeatureRegistry.Discover(Assembly.GetExecutingAssembly())` (and optionally `Register<T>()`) in their `Awake`. UXAssist begins the deferred lifecycle from its own `Start`; if a dependent feature is discovered after that transition, the registry starts it immediately after initialization so it cannot miss `Start`. The registry also guards start idempotency per feature (start at most once; uninit resets) and per-frame re-entrancy (`Time.frameCount`) for the update dispatchers, as defense-in-depth.
|
||||
@@ -156,12 +156,15 @@ The sync is implemented as an inline PowerShell `Exec` step inside the `ZipMod`
|
||||
- **Immediate-build beacon timing:** Signal Towers do not share the Planetary Shield initialization race. `DataPool<BeaconComponent>.Add()` resets the value-type component, `NewBeaconComponent` synchronously assigns its entity and already-created power-node IDs, and no UI opens from `beacons.count` or reads tick-created resources. Holo Beacons use `MarkerComponent`; `NewMarkerComponent` also initializes and registers their UI-visible state synchronously.
|
||||
- **Illegal Dyson shell generation:** Estimated triangle vertex counts mirror the original `DysonShell.GenerateGeometry` rasterization as closely as possible, but can still differ from the final frame-generated shell polygon at numerical boundaries. Max-output generation must treat `QuickAddDysonShell` failure as a candidate rejection and try the next candidate rather than assuming the estimate is exact.
|
||||
- **Fail-soft patch application:** `PatchImpl<T>.Enable(true)` applies Harmony patches inside a try/catch. Runtime patching can fail through no fault of ours (Harmony re-runs other mods' transpilers on shared target methods), and an escaping exception would abort the calling `ConfigEntry.SettingChanged` delegate chain, desyncing config UI from config values. On failure it logs a `LogError` with the feature type name, rolls back via `UnpatchSelf()`, and leaves `_patch` null so a later `Enable(true)` can retry.
|
||||
- **Convergent in-game UI state:** In-game overlay widgets whose visibility depends on game state (e.g. `AutoConstructUI`) must not rely solely on one-shot event-driven refreshes (`SettingChanged` handlers, patch `OnEnable`/`OnDisable`), because a thrown exception earlier in a delegate chain or a failed patch application silently drops the refresh. `AutoConstructUI.OnUpdate()` reconciles button visibility and the pending-construction count with actual game state every 30 frames (also effective while paused); the `AutoConstructPatch` postfix on `PlayerAction_Rts.GameTick` only implements the fly-to-target behavior, and `AutoConstructPatch.OnEnable` logs its visibility predicate inputs once per enable as a remote-diagnosis aid.
|
||||
- **Auto-construct planner:** `AutoConstructPatch` keeps a construction-site plan while drones work, chooses among a fixed candidate set using the native 120-target construction capacity, total drone travel cost, and player travel cost, then refines the strongest candidates to an actual ghost nearest the target-group center. Candidate scoring uses the planned flight altitude when evaluating build-range coverage. It replans before the current site is empty when the remaining local workload no longer covers the next flight. Candidate evaluation has fixed limits and uses allocation-free arrays; local construction checks scan actual hash entries instead of trusting stale module counters and include ghosts whose materials can be delivered from the mecha package.
|
||||
- **Convergent in-game UI state:** In-game overlay widgets whose visibility depends on game state (e.g. `AutoConstructUI`) must not rely solely on one-shot event-driven refreshes (`SettingChanged` handlers, patch `OnEnable`/`OnDisable`), because a thrown exception earlier in a delegate chain or a failed patch application silently drops the refresh. `AutoConstructUI.OnUpdate()` reconciles button visibility and the pending-construction count with actual game state every 30 frames (also effective while paused); the `AutoConstructPatch` postfix on `PlayerAction_Rts.GameTick` only implements the fly-to-target behavior, and `AutoConstructPatch.OnEnable` logs its visibility predicate inputs as a remote-diagnosis aid, throttled to once per game session unless the button object itself is missing. `MyCheckButton.Checked` only refreshes the button colours: its label lives on `OnChecked` handlers, so any path that sets `Checked` directly (periodic reconcile, shortcut key, `ConfigEntry.SettingChanged`) must refresh the label too.
|
||||
- **Auto-construct planner:** `AutoConstructPatch` keeps a construction-site plan while drones work, chooses among a fixed candidate set using the native 120-target construction capacity, total drone travel cost, and player travel cost, then refines the strongest candidates to an actual ghost nearest the target-group center. Candidate scoring uses the planned flight altitude when evaluating build-range coverage, so arrival must release any detour altitude (`AvoidanceAltitude`) and restore `ConstructionFlightAltitude`; otherwise the drones cannot reach part of the ghosts the score was based on. The angular fan axes are derived in the planet-local frame (`player.uRotation` is universal and must be inverse-rotated by `planet.runtimeRotation`), because prebuild and player positions are planet-local. It replans before the current site is empty when the remaining local workload no longer covers the next flight. Candidate evaluation has fixed limits and uses allocation-free arrays; local construction checks scan actual hash entries instead of trusting stale module counters and include ghosts whose materials can be delivered from the mecha package. Ghost eligibility mirrors the material-delivery filter in `ConstructionModuleComponent.GameTick` (`ItemProto.constructableIdHash` plus `PlanetFactory.HasEnemyBuildingNear`), because a ghost the game will never deliver items to can never launch a drone and would park the mecha on a site that makes no progress; the enemy-proximity probe is skipped entirely when the planet has no Dark Fog ground bases.
|
||||
- **Auto-construct flight settling:** `BeginFlightSettling`/`UpdateFlightSettling`/`EndFlightSettling` implement a two-stage wait: a fixed tick countdown that covers the latency between `Player.ClearOrders()` and `PlayerMove_Fly` decaying `rtsVelocity`, followed by a residual-speed check bounded by a timeout. The residual check must be gated on the separate `_flightSettlePending` flag, not on the countdown, or it becomes unreachable the moment the countdown reaches zero. A route deferred by this wait is re-issued with `bypassBrake` so it cannot be deferred again after a timeout and stall the mecha. `Player.Order(OrderNode.Stop, false)` followed by `Player.ClearOrders()` is a no-op that only adds a stray order gizmo at the planet centre: the actual braking comes from `PlayerMove_Fly` decaying `rtsVelocity` whenever there is no unreached order.
|
||||
- **Auto-construct configuration split:** `FactoryConfigProvider.AutoConstructEnabled` gates the `AutoConstructPatch` Harmony patch; `AutoConstructButtonEnabled` only controls button visibility. Do not tie patch activation to the button config — hiding the button would then silently disable the feature, and the button is the only in-game way to toggle it.
|
||||
- **Auto-construct final pass:** When at most eight eligible construction ghosts remain, the planner bypasses site-hold hysteresis and routes directly to the nearest remaining ghost. The final-pass count is capped at nine during the existing prebuild scan, so large construction queues do not incur an additional unbounded performance cost.
|
||||
- **Auto-construct maintenance:** Planner scan reset, final-pass nearest-ghost routing, and route-arrival/recovery transitions use shared state helpers; no-op UI lifecycle forwarding is removed.
|
||||
- **Auto-navigation:** UXAssist now exposes one auto-cruise implementation through `PlayerPatch.AutoNavigation`; the former legacy cruise path and algorithm-selection branch are removed. The shared `ToggleAutoCruise` key and in-game button control the session state. The configuration entry is presented as `Enable auto-cruise`, and its navigation options are grouped beneath it as indented 13-point sub-options. Steering follows the original `PlayerMove_Sail.GameTick` interpolation cap of 1.6 degrees per tick for the ordinary sail velocity and explicitly chooses a stable turn plane for antiparallel velocity and target directions. During warp, the added displacement uses `currentWarpVelocity` along mecha heading; after the game's heading update, a postfix tops up the warp heading toward the requested direction so the actual heading reaches the same 1.6-degree-per-tick minimum instead of lagging behind the ordinary velocity vector. Auto-navigation also reduces `warpSpeedControl` toward the game's 0.2 floor as heading error grows; manual warp speed controls take precedence. Target resolution is validated once and applied atomically for both the UI and tick path; moving-target velocity is converted to universal coordinates; direct sail steering only runs while the player is sailing. Target state and reusable obstacle data are reset through one navigation lifecycle path. Satellite targets use a target corridor: an orbiting parent is ignored when the direct player-to-target segment is clear, shrinks its avoidance radius so it cannot contain the target, and otherwise follows a current-heading-selected tangent around the parent before returning to the satellite.
|
||||
- **Auto-cruise flight input:** In the original `PlayerMove_Fly.GameTick`, `PlayerController.input0.y = 1` matches manual forward movement and `input1.y = 1` matches manual upward thrust. The auto-cruise `Fly` handler must preserve these signs so the mecha leaves a planet with the same orientation and motion as manual control.
|
||||
- **Auto-cruise:** UXAssist exposes one auto-cruise implementation through `PlayerPatch.AutoNavigation`; the former legacy cruise path and algorithm-selection branch are removed. Its Harmony patches follow `AutoCruiseEnabled`, so a user who disables the feature does not keep a transpiler on the hot `PlayerController.GameTick` installed. The shared `ToggleAutoCruise` key and in-game button control the session state, and starting requires a resolvable target so the feature cannot emit a "started" and a "stopped" popup in the same frame. All user-facing strings say auto-cruise / `自动巡航`; do not reintroduce `自动导航`, which collides with the game's own `PlayerNavigation` autopilot and its `太空导航` indicators. Auto-cruise yields to that autopilot (`player.navigation.navigating`) instead of fighting it over `uVelocity`. The configuration entry is presented as `Enable auto-cruise`, and its navigation options are grouped beneath it as indented 13-point sub-options. Steering follows the original `PlayerMove_Sail.GameTick` interpolation cap of 1.6 degrees per tick for the ordinary sail velocity and explicitly chooses a stable turn plane for antiparallel velocity and target directions. During warp, the added displacement uses `currentWarpVelocity` along mecha heading; after the game's heading update, a postfix tops up the warp heading toward the requested direction so the actual heading reaches the same 1.6-degree-per-tick minimum instead of lagging behind the ordinary velocity vector. Auto-cruise also reduces `warpSpeedControl` toward the game's 0.2 floor as heading error grows; manual warp speed controls take precedence. Target resolution is validated once and applied atomically for both the UI and tick path; moving-target velocity is converted to universal coordinates; direct sail steering only runs while the player is sailing. Target state and reusable obstacle data are reset through one navigation lifecycle path. Satellite targets use a target corridor: an orbiting parent is ignored when the direct player-to-target segment is clear, shrinks its avoidance radius so it cannot contain the target, and otherwise follows a current-heading-selected tangent around the parent before returning to the satellite. `SpaceSector.dfHives` is only allocated by `SetForNewGame` and by `Import` when the save carries hive data, so obstacle collection must null-check it exactly like the game does.
|
||||
- **Auto-cruise sail reference frame and braking:** `PlayerMove_Sail.GameTick` and `PlayerNavigation.DetermineSailVelocity` blend the planet frame velocity by altitude (`Clamp01((600 - altitude) / 450)`) and it is fully gone above 600 m. `visual_uvel` must use that same blend, because `PlayerController.UpdateRotation` runs after the whole action loop and turns `visual_uvel` into the mecha heading and the speed readout; subtracting the unblended planet velocity visibly misaims the mecha near a planet. For the same reason the mod does not write `uRotation` from the sail postfix — the game recomputes it immediately afterwards. Braking must be applied directly (the original's 0.008-per-tick decay branch), not folded into the turn interpolation, which would weaken it by up to `1/t`. Fixed targets are speed-capped on approach (`GetApproachSpeedLimit`) so the mecha reaches the arrival radius below the 75 m/s planet-relative speed that `PlayerMove_Sail` requires before handing over to `PlayerMove_Fly`, and warp is released early enough for that brake to settle — the game's own warp guard only covers planets, never stars.
|
||||
- **Auto-cruise flight input:** In the original `PlayerMove_Fly.GameTick`, `PlayerController.input0.y = 1` matches manual forward movement and `input1.y = 1` matches manual upward thrust. In `PlayerMove_Walk`, `input0.z` is the jump axis: the first press jumps and sets `flyUpChance`, the next one calls `SwitchToFly`, so holding it lifts off within two ticks. The auto-cruise handlers must preserve these axes and signs so the mecha leaves a planet with the same orientation and motion as manual control.
|
||||
- **Shortcut input timing:** UXAssist dispatches mod shortcuts from a postfix of the original `VFInput.OnUpdate`, after DSP has refreshed its current modifier and UI input state. Do not move shortcut polling back to an independent plugin `Update()` or a logic-tick callback: CommonAPI `PressKeyBind.keyValue` combines Unity's current-frame `Input.GetKeyDown()` with `CombineKey` modifier caches refreshed by `VFInput.OnUpdate`. Polling before that refresh can miss a shortcut when a modifier changes in the same frame, which is easier to encounter at low frame rates. Keep the typing/menu guards and per-frame registry guards.
|
||||
- **UI clone initialization and text measurement:** UXAssist UI factories and dependent mods' direct UI clones treat runtime DSP objects as style sources only; after `Instantiate`, they explicitly reset stateful `UIButton`, `Text`, `Image`, `InputField`, `Slider`, and `UIComboBox` fields that can otherwise carry source state. Use `UXAssist.UI.Util.GetPreferredWidth` for dynamic text width because it invalidates DSP's custom text-generator cache before reading `preferredWidth`; do not replace it with a generic `TextGenerator` or canvas-wide rebuild without validating the rendered result.
|
||||
- **Transpiler patches:** Performance-critical mods (LabOpt, MechaDronesTweaks) use `[HarmonyTranspiler]` to rewrite IL instructions directly for maximum efficiency. All transpilers in UXAssist, CheatEnabler, and UniverseGenTweaks carry a standard header comment (`// Harmony transpiler:`, `// Target:`, `// Fallback:`) documenting the target method and fallback behavior. `UXAssist.Common.Patching.TranspilerGuard` provides a reusable `CodeMatcher.Finish` helper that returns original instructions when a matcher becomes invalid.
|
||||
|
||||
+12
-10
@@ -154,16 +154,17 @@ public static class I18NKeys
|
||||
public const string ShortcutKeysForShowingStarsName = "Shortcut keys for showing stars' name";
|
||||
public const string AutoBoost = "Auto boost";
|
||||
public const string DistanceToUseWarp = "Distance to use warp";
|
||||
public const string StopAutoNavigationOnManualInput = "Stop auto-navigation on manual input";
|
||||
public const string StopAutoCruiseOnManualInput = "Stop auto-cruise on manual input";
|
||||
public const string UseWarp = "Use warp";
|
||||
public const string UseWarpMinimalEnergy = "Use warp minimal energy";
|
||||
public const string AutoBoostMinimalEnergy = "Auto boost minimal energy";
|
||||
public const string DarkFogHiveFollowDistance = "Dark Fog Hive follow distance";
|
||||
public const string DarkFogCarrierFollowDistance = "Dark Fog Carrier follow distance";
|
||||
public const string AutoNavigationActive = "Auto-navigation active";
|
||||
public const string AutoNavigationEnableHint = "Press {0} to enable auto-navigation";
|
||||
public const string AutoNavigationStarted = "Auto-navigation started";
|
||||
public const string AutoNavigationStopped = "Auto-navigation stopped";
|
||||
public const string AutoCruiseActive = "Auto-cruise active";
|
||||
public const string AutoCruiseEnableHint = "Press {0} to enable auto-cruise";
|
||||
public const string AutoCruiseStarted = "Auto-cruise started";
|
||||
public const string AutoCruiseStopped = "Auto-cruise stopped";
|
||||
public const string AutoCruiseNoTarget = "Auto-cruise needs a navigation target";
|
||||
public const string TreatStackItemsAsSingleInMonitorComponents = "Treat stack items as single in monitor components";
|
||||
public const string InitializeThisPlanet = "Initialize This Planet";
|
||||
public const string InitializeThisPlanetConfirm = "Initialize This Planet Confirm";
|
||||
@@ -418,16 +419,17 @@ You can set 2 shortcut keys in Settings panel:
|
||||
I18N.Add(ShortcutKeysForShowingStarsName, "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
|
||||
I18N.Add(AutoBoost, "Auto boost", "自动加速");
|
||||
I18N.Add(DistanceToUseWarp, "Distance to use warp (AU)", "使用曲速的距离(AU)");
|
||||
I18N.Add(StopAutoNavigationOnManualInput, "Stop auto-navigation on manual input", "手动输入时停止自动导航");
|
||||
I18N.Add(StopAutoCruiseOnManualInput, "Stop auto-cruise on manual input", "手动输入时停止自动巡航");
|
||||
I18N.Add(UseWarp, "Use warp", "启用曲速");
|
||||
I18N.Add(UseWarpMinimalEnergy, "Minimum energy to use warp (MJ)", "使用曲速最低能量(MJ)");
|
||||
I18N.Add(AutoBoostMinimalEnergy, "Minimum energy for auto boost (MJ)", "自动加速最低能量(MJ)");
|
||||
I18N.Add(DarkFogHiveFollowDistance, "Dark Fog Hive follow distance (AU)", "黑雾巢穴跟踪距离(AU)");
|
||||
I18N.Add(DarkFogCarrierFollowDistance, "Dark Fog Carrier follow distance (m)", "黑雾火种跟踪距离(m)");
|
||||
I18N.Add(AutoNavigationActive, "Auto-navigation active", "自动导航中");
|
||||
I18N.Add(AutoNavigationEnableHint, "Press {0} to enable auto-navigation", "按 {0} 启用自动导航");
|
||||
I18N.Add(AutoNavigationStarted, "Auto-navigation started", "自动导航启动");
|
||||
I18N.Add(AutoNavigationStopped, "Auto-navigation stopped", "自动导航关闭");
|
||||
I18N.Add(AutoCruiseActive, "Auto-cruise active", "自动巡航中");
|
||||
I18N.Add(AutoCruiseEnableHint, "Press {0} to enable auto-cruise", "按 {0} 启用自动巡航");
|
||||
I18N.Add(AutoCruiseStarted, "Auto-cruise started", "自动巡航启动");
|
||||
I18N.Add(AutoCruiseStopped, "Auto-cruise stopped", "自动巡航关闭");
|
||||
I18N.Add(AutoCruiseNoTarget, "Auto-cruise needs a navigation target", "自动巡航需要先设置导航目标");
|
||||
I18N.Add(TreatStackItemsAsSingleInMonitorComponents, "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品");
|
||||
I18N.Add(InitializeThisPlanet, "Initialize this planet", "初始化本行星");
|
||||
I18N.Add(InitializeThisPlanetConfirm, "This operation will destroy all buildings and revert terrains on this planet, are you sure?", "此操作将会摧毁本行星上的所有建筑并恢复地形,确定吗?");
|
||||
|
||||
@@ -29,19 +29,7 @@ internal static class AutoCruiseUI
|
||||
rectTrans.localScale = new Vector3(1f, 1f, 1f);
|
||||
|
||||
UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
ToggleAutoCruiseChecked();
|
||||
ToggleAutoCruise.OnChecked += ToggleAutoCruiseChecked;
|
||||
static void ToggleAutoCruiseChecked()
|
||||
{
|
||||
if (ToggleAutoCruise.Checked)
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.DisableAutoCruise);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.EnableAutoCruise);
|
||||
}
|
||||
}
|
||||
ToggleAutoCruise.OnChecked += UpdateToggleAutoCruiseLabel;
|
||||
ToggleAutoCruise.OnChecked += Patches.PlayerPatch.AutoNavigation.Toggle;
|
||||
}
|
||||
|
||||
@@ -50,7 +38,19 @@ internal static class AutoCruiseUI
|
||||
if (ToggleAutoCruise == null) return;
|
||||
var active = Patches.PlayerPatch.AutoCruiseEnabled.Value
|
||||
&& Patches.PlayerPatch.AutoNavigation.HasNavigationTarget();
|
||||
// MyCheckButton.Checked only refreshes the colours; the label lives on the OnChecked
|
||||
// handlers. Auto-cruise can also be toggled by its shortcut or stopped automatically on
|
||||
// arrival, so the label has to be refreshed here as well or it goes stale.
|
||||
ToggleAutoCruise.Checked = Patches.PlayerPatch.AutoNavigation.IsActive;
|
||||
UpdateToggleAutoCruiseLabel();
|
||||
ToggleAutoCruise.gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
private static void UpdateToggleAutoCruiseLabel()
|
||||
{
|
||||
if (ToggleAutoCruise == null) return;
|
||||
ToggleAutoCruise.SetLabelText(ToggleAutoCruise.Checked
|
||||
? I18NKeys.DisableAutoCruise
|
||||
: I18NKeys.EnableAutoCruise);
|
||||
}
|
||||
}
|
||||
+971
-896
File diff suppressed because it is too large.
Load diff
@@ -700,7 +700,7 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
var autoCruiseCheckBox = wnd.AddCheckBox(x, y, tab4, PlayerPatch.AutoCruiseEnabled, I18NKeys.EnableAutoCruise);
|
||||
y += 27f;
|
||||
var autoStopCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.StopOnArrivalAndInput, I18NKeys.StopAutoNavigationOnManualInput, 13);
|
||||
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);
|
||||
y += 27f;
|
||||
|
||||
Reference in new issue
Block a user