diff --git a/AGENTS.md b/AGENTS.md index 52e9bc4..0db88f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,6 +40,7 @@ - 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. - Planet vein utilization counters belong before resource labels, not beside native icons or highlight controls. Restore original label layout when rows are reused or the feature is disabled. - UI-only options must preserve native progression, statistics, and event delivery. Suppress presentation handlers rather than bypassing authoritative game-state setters. +- Space-scene rendering suppression must require the native in-game hide-UI state and exclude menu demos and combat cutscenes. A hidden player model alone does not imply hidden scenery; use the same eligibility check for drawing and planet-simulator visibility. - 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. - LiveStreamAssist production reads must schedule the native extra-info calculator for queried factories independently of the statistics UI. Deduplicate and throttle refreshes, let active native batches finish, and clear pending factory indices and deadlines at session boundaries. - LiveStreamAssist `ReflectionReader` caches bounded per-type member metadata and clears it during API uninitialization; do not cache mutable game values or arbitrary request results. diff --git a/UXAssist/CHANGELOG.md b/UXAssist/CHANGELOG.md index 16f9c75..9461b63 100644 --- a/UXAssist/CHANGELOG.md +++ b/UXAssist/CHANGELOG.md @@ -4,6 +4,7 @@ ## Changlog * 1.6.1 + * Fix the title-screen background turning black, even when the UXAssist window is closed. * `Planet vein utilization`: Move vein-group counts to the left of resource names to avoid overlapping the game's new buttons. * `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. @@ -421,6 +422,7 @@ ## 更新日志 * 1.6.1 + * 修复标题画面背景变黑的问题,包括关闭 UXAssist 窗口后背景仍不显示的情况。 * `宇宙视图行星/星系矿脉数量显示`:将矿脉数量移至矿物名称左侧,避免与游戏新版按钮重叠。 * `设置提示`:修复问号按钮的游戏内提示不显示的问题。 * `自动巡航`:统一设置滑条的起始位置,并缩小滑条与数值之间的间距。 diff --git a/UXAssist/Patches/PersistPatch.cs b/UXAssist/Patches/PersistPatch.cs index 9209987..4d55d7a 100644 --- a/UXAssist/Patches/PersistPatch.cs +++ b/UXAssist/Patches/PersistPatch.cs @@ -228,36 +228,27 @@ public class PersistPatch : PatchImpl return matcher.InstructionEnumeration(); } - // Disable rendering when Player is hidden (Press F11 twice) - // Harmony transpiler: GameLogic_LateUpdate_Transpiler - // Target: GameLogic.LateUpdate, GameLogic.Draw, GameLogic.DrawPost - // Fallback: None — patch will fail loudly if the target method body changes. - [HarmonyTranspiler] + private static bool ShouldHideSpaceScene() + { + return !DSPGame.IsMenuDemo && !DSPGame.IsCombatCutscene && + UIRoot.instance?.uiGame?.hideAllUI0 == true && + GameMain.localPlanet == null && GameMain.mainPlayer?.controller?.modelVisible == false; + } + + [HarmonyPrefix] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LateUpdate))] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.Draw))] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.DrawPost))] - private static IEnumerable GameLogic_LateUpdate_Transpiler(IEnumerable instructions, ILGenerator generator) + private static bool GameLogic_Render_Prefix() { - var matcher = new CodeMatcher(instructions, generator); - matcher.Start(); - matcher.CreateLabel(out var label); - matcher.InsertAndAdvance( - Transpilers.EmitDelegate(bool () => - { - return GameMain.localPlanet == null && !GameMain.mainPlayer.controller.modelVisible; - }), - new CodeInstruction(OpCodes.Brfalse, label), - new CodeInstruction(OpCodes.Ret) - ); - - return matcher.InstructionEnumeration(); + return !ShouldHideSpaceScene(); } [HarmonyPostfix] [HarmonyPatch(typeof(UniverseSimulator), nameof(UniverseSimulator.SetPlanetSimulator))] private static void UniverseSimulator_SetPlanetSimulator_Postfix(UniverseSimulator __instance, PlanetSimulator sim) { - if (GameMain.localPlanet == null && !GameMain.mainPlayer.controller.modelVisible) sim.gameObject.SetActive(false); + if (ShouldHideSpaceScene()) sim.gameObject.SetActive(false); } #region Cluster Upload Result