fix(uxassist): preserve title-screen background rendering

Require native hide-UI mode before suppressing the space scene, and exclude menu demos and combat cutscenes. Share the visibility check between render hooks and planet simulators.
This commit is contained in:
soarqin committed 2026-09-29 21:49:31 +08:00
1 parent a4ac2efe4b
commit b08eaf13b7
3 files changed
+14 -20

No files matched your search

+2
View File
@@ -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 窗口后背景仍不显示的情况。
* `宇宙视图行星/星系矿脉数量显示`:将矿脉数量移至矿物名称左侧,避免与游戏新版按钮重叠。
* `设置提示`:修复问号按钮的游戏内提示不显示的问题。
* `自动巡航`:统一设置滑条的起始位置,并缩小滑条与数值之间的间距。
+11 -20
View File
@@ -228,36 +228,27 @@ public class PersistPatch : PatchImpl<PersistPatch>
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<CodeInstruction> GameLogic_LateUpdate_Transpiler(IEnumerable<CodeInstruction> 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