diff --git a/UXAssist/CHANGELOG.md b/UXAssist/CHANGELOG.md index 7de6eb9..5f95860 100644 --- a/UXAssist/CHANGELOG.md +++ b/UXAssist/CHANGELOG.md @@ -3,6 +3,8 @@ ## Changlog +* 1.6.4 + * `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save. * 1.6.3 * `Quick build Mining Machines`: * Add a Factory-tab button to arrange ordinary Mining Machines densely around the nearest solid vein group. Each miner covers at least 3 nodes from that group, without including nearby groups. Layouts are not limited by stock; missing miners remain as ghosts awaiting materials. Placement respects construction range and does not include belts or power facilities. Click again to cancel a search. @@ -443,6 +445,8 @@ ## 更新日志 +* 1.6.4 + * `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。 * 1.6.3 * `快速铺设采矿机`: * 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。 diff --git a/UXAssist/Patches/TechPatch.cs b/UXAssist/Patches/TechPatch.cs index 5c75d88..4a2cf08 100644 --- a/UXAssist/Patches/TechPatch.cs +++ b/UXAssist/Patches/TechPatch.cs @@ -222,11 +222,22 @@ public static class TechPatch foreach (var item in nodes) { var node = item.Value; + var postTechArray = node.techProto.postTechArray; + // A new session can initialize nodes while the peace-mode graph is still filtered. + var arrowCount = node.arrows.Length; + if (arrowCount < postTechArray.Length) + { + System.Array.Resize(ref node.arrows, postTechArray.Length); + for (var i = arrowCount; i < postTechArray.Length; i++) + { + node.arrows[i] = UnityEngine.Object.Instantiate(node.arrowPrefab, node.arrowPrefab.parent); + node.arrows[i].SetAsFirstSibling(); + } + } foreach (var arrow in node.arrows) { arrow.gameObject.SetActive(false); } - var postTechArray = node.techProto.postTechArray; var active = postTechArray.Length > 0; node.connGroup.gameObject.SetActive(active); node.connImages = active ? node.connGroup.GetComponentsInChildren(true) : []; diff --git a/UXAssist/README.md b/UXAssist/README.md index d35db12..169aed0 100644 --- a/UXAssist/README.md +++ b/UXAssist/README.md @@ -169,6 +169,7 @@ * Buy out techs with their prerequisites * This enables batch buying out techs with their prerequisites. Buy-out buttons are shown for locked techs/upgrades. * Hide battle-related techs in Peace mode + * Battle-related techs and their connections return when disabling the option or loading a Combat-mode save; switching saves does not require restarting the game. * Unlock all techs with metadata * Use the config-panel button to confirm the metadata cost and buy out eligible techs in a batch; unlimited upgrade chains are excluded. * Combat @@ -374,6 +375,7 @@ * 买断科技也同时买断所有前置科技 * 可批量买断科技及其前置科技,未解锁的科技和升级会显示买断按钮。 * 在和平模式下隐藏战斗相关科技 + * 关闭选项或加载战斗模式存档后恢复相关科技及连线,切换存档无需重启游戏。 * 使用元数据解锁所有科技 * 在配置面板点击按钮并确认元数据消耗,批量买断符合条件的科技;不包含无限升级科技链。 * 战斗 diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index 8d75202..4018ca9 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -3,7 +3,7 @@ org.soardev.uxassist DSP MOD - UXAssist - 1.6.3 + 1.6.4 UXAssist UXAssist true diff --git a/UXAssist/package/manifest.json b/UXAssist/package/manifest.json index 9eb19e7..bd66bc3 100644 --- a/UXAssist/package/manifest.json +++ b/UXAssist/package/manifest.json @@ -1,6 +1,6 @@ { "name": "UXAssist", - "version_number": "1.6.3", + "version_number": "1.6.4", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist", "description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁", "dependencies": [