diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj index 072fd2f..d2a051c 100644 --- a/CheatEnabler/CheatEnabler.csproj +++ b/CheatEnabler/CheatEnabler.csproj @@ -28,7 +28,7 @@ - + diff --git a/CheatEnabler/PlayerFunctions.cs b/CheatEnabler/PlayerFunctions.cs index 78603be..1982e55 100644 --- a/CheatEnabler/PlayerFunctions.cs +++ b/CheatEnabler/PlayerFunctions.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; namespace CheatEnabler; @@ -49,4 +50,51 @@ public static class PlayerFunctions } GameMain.mainPlayer.controller.actionSail.StartFastTravelToUPosition(targetUPos); } + + private static void PurgePropertySystem(PropertySystem propertySystem) + { + var propertyDatas = propertySystem.propertyDatas; + for (var i = 0; i < propertyDatas.Count;) + { + if (propertyDatas[i].totalProduction.Any(idcnt => idcnt.count > 0) || propertyDatas[i].totalConsumption.Any(idcnt => idcnt.count > 0)) + { + i++; + } + else + { + propertyDatas.RemoveAt(i); + } + } + } + + public static void RemoveAllMetadataConsumptions() + { + var propertySysten = DSPGame.propertySystem; + if (propertySysten == null) return; + PurgePropertySystem(propertySysten); + var itemCnt = new int[6]; + foreach (var cons in propertySysten.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006))) + { + itemCnt[cons.id - 6001] += cons.count; + } + + if (itemCnt.All(cnt => cnt == 0)) return; + UIMessageBox.Show("Remove all metadata consumption records".Translate(), "".Translate(), "取消".Translate(), "确定".Translate(), 2, null, () => + { + foreach (var data in propertySysten.propertyDatas) + { + for (var i = 0; i < data.totalConsumption.Count; i++) + { + if (data.totalConsumption[i].count == 0) continue; + var id = data.totalConsumption[i].id; + data.totalConsumption[i] = new IDCNT(id, 0); + } + } + }); + } + + public static void RemoveCurrentMetadataConsumptions() + { + + } } diff --git a/CheatEnabler/UIConfigWindow.cs b/CheatEnabler/UIConfigWindow.cs index 25e5895..b466fc0 100644 --- a/CheatEnabler/UIConfigWindow.cs +++ b/CheatEnabler/UIConfigWindow.cs @@ -27,6 +27,8 @@ public static class UIConfigWindow "Click tech on tree while holding:\n Shift: Tech level + 1\n Ctrl: Tech level + 10\n Ctrl + Shift: Tech level + 100\n Alt: Tech level to MAX\n\nNote: all direct prerequisites will be unlocked as well.", "按住以下组合键点击科技树:\n Shift:科技等级+1\n Ctrl:科技等级+10\n Ctrl+Shift:科技等级+100\n Alt:科技等级升到最大\n\n注意:所有直接前置科技也会被解锁"); I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号"); + I18N.Add("Remove all metadata consumption records", "Remove all metadata consumption records", "移除所有元数据消耗记录"); + I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前游戏的元数据消耗记录"); I18N.Add("Finish build immediately", "Finish build immediately", "建造秒完成"); I18N.Add("Architect mode", "Architect mode", "建筑师模式"); I18N.Add("Build without condition", "Build without condition check", "无条件建造"); @@ -89,7 +91,11 @@ public static class UIConfigWindow MyWindow.AddTipsButton(x, y, tab1, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips"); x = 300f; y = 10f; - _resignGameBtn = wnd.AddButton(x, y, 200f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; }); + _resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; }); + y += 36f; + wnd.AddButton(x, y, 300f, tab1, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", PlayerFunctions.RemoveAllMetadataConsumptions); + y += 36f; + wnd.AddButton(x, y, 300f, tab1, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", PlayerFunctions.RemoveCurrentMetadataConsumptions); var tab2 = wnd.AddTab(_windowTrans, "Factory"); x = 0f; diff --git a/Dustbin/Dustbin.csproj b/Dustbin/Dustbin.csproj index b242cc8..5e2bcb3 100644 --- a/Dustbin/Dustbin.csproj +++ b/Dustbin/Dustbin.csproj @@ -32,7 +32,7 @@ - + diff --git a/DustbinPreloader/DustbinPreloader.csproj b/DustbinPreloader/DustbinPreloader.csproj index 10755dd..5ce7af8 100644 --- a/DustbinPreloader/DustbinPreloader.csproj +++ b/DustbinPreloader/DustbinPreloader.csproj @@ -22,7 +22,7 @@ - + diff --git a/HideTips/HideTips.cs b/HideTips/HideTips.cs index 39fc84e..55a1623 100644 --- a/HideTips/HideTips.cs +++ b/HideTips/HideTips.cs @@ -20,7 +20,7 @@ public class HideTips : BaseUnityPlugin private static bool _noResearchCompletionPopups = true; private static bool _noResearchCompletionTips; private static bool _skipPrologue = true; -// private static bool _hideMenuDemo; + // private static bool _hideMenuDemo; private static Harmony _patch; @@ -34,7 +34,7 @@ public class HideTips : BaseUnityPlugin _noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value; _noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value; _skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value; -// _hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value; + // _hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value; if (!_cfgEnabled) return; Harmony.CreateAndPatchAll(typeof(HideTips)); /* @@ -50,7 +50,7 @@ public class HideTips : BaseUnityPlugin _patch?.UnpatchSelf(); _patch = null; } - + [HarmonyPrefix] [HarmonyPatch(typeof(VFPreload), nameof(VFPreload.Start))] private static void VFPreload_Start_Prefix(VFPreload __instance) @@ -59,7 +59,7 @@ public class HideTips : BaseUnityPlugin } [HarmonyPostfix] - [HarmonyPatch(typeof(UIBuildMenu), "_OnCreate")] + [HarmonyPatch(typeof(UIBuildMenu), nameof(UIBuildMenu._OnCreate))] private static void ClearRandReminderTips(UIBuildMenu __instance) { if (!_noRandomReminderTips) return; @@ -70,48 +70,52 @@ public class HideTips : BaseUnityPlugin randTip._Free(); } } + __instance.randRemindTips = Array.Empty(); } [HarmonyPostfix] - [HarmonyPatch(typeof(UIGameMenu), "_OnCreate")] + [HarmonyPatch(typeof(UIGameMenu), nameof(UIGameMenu._OnCreate))] private static void UIGameMenu__OnCreate_Postfix(UIGameMenu __instance) { + if (!_noRandomReminderTips) return; __instance.randTipButton0.pop = __instance.randTipButton0.popCount; __instance.randTipButton1.pop = __instance.randTipButton1.popCount; __instance.randTipButton2.pop = __instance.randTipButton2.popCount; } [HarmonyPrefix] - [HarmonyPatch(typeof(UITutorialTip), "PopupTutorialTip")] - private static bool UITutorialTip_PopupTutorialTip_Prefix() + [HarmonyPatch(typeof(UITutorialTip), nameof(UITutorialTip.PopupTutorialTip))] + private static bool UITutorialTip_PopupTutorialTip_Prefix(int tutorialId) { - return !_noTutorialTips; + if (!_noTutorialTips) return true; + GameMain.history.UnlockTutorial(tutorialId); + return false; } [HarmonyPrefix] - [HarmonyPatch(typeof(UIVariousPopupGroup), "CreateAchievementPopupCard")] + [HarmonyPatch(typeof(UIVariousPopupGroup), nameof(UIVariousPopupGroup.CreateAchievementPopupCard))] private static bool UIVariousPopupGroup_CreateAchievementPopupCard_Prefix() { return !_noAchievementCardPopups; } [HarmonyPrefix] - [HarmonyPatch(typeof(UIVariousPopupGroup), "CreateMilestonePopupCard")] + [HarmonyPatch(typeof(UIVariousPopupGroup), nameof(UIVariousPopupGroup.CreateMilestonePopupCard))] private static bool UIVariousPopupGroup_CreateMilestonePopupCard_Prefix() { return !_noMilestoneCardPopups; } [HarmonyPrefix] - [HarmonyPatch(typeof(UIResearchResultWindow), "SetTechId")] + [HarmonyPatch(typeof(UIResearchResultWindow), nameof(UIResearchResultWindow.SetTechId))] private static bool UIResearchResultWindow_SetTechId_Prefix() { return !_noResearchCompletionPopups; } - + [HarmonyTranspiler] - [HarmonyPatch(typeof(UIGeneralTips), "OnTechUnlocked")] + [HarmonyPatch(typeof(UIGeneralTips), nameof(UIGeneralTips.OnTechUnlocked))] private static IEnumerable UIGeneralTips_OnTechUnlocked_Transpiler(IEnumerable instructions, ILGenerator generator) { var matcher = new CodeMatcher(instructions, generator); @@ -134,7 +138,7 @@ public class HideTips : BaseUnityPlugin } [HarmonyPrefix] - [HarmonyPatch(typeof(DSPGame), "StartGame", typeof(GameDesc))] + [HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartGame), typeof(GameDesc))] private static bool DSPGame_StartGame_Prefix(GameDesc _gameDesc) { if (!_skipPrologue) return true; @@ -174,7 +178,7 @@ class HideMenuDemo GameMain.universeSimulator = UnityEngine.Object.Instantiate(Configs.builtin.universeSimulatorPrefab); GameMain.universeSimulator.spaceAudio = new GameObject("Space Audio") { - transform = + transform = { parent = GameMain.universeSimulator.transform } @@ -182,7 +186,7 @@ class HideMenuDemo GameMain.Begin(); return false; } - + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")] private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result) @@ -190,7 +194,7 @@ class HideMenuDemo __result = true; return false; } - + [HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPatch(typeof(DSPGame), "LateUpdate")] [HarmonyPatch(typeof(GameMain), "LateUpdate")] @@ -212,4 +216,4 @@ class HideMenuDemo return false; } } -*/ +*/ \ No newline at end of file diff --git a/HideTips/HideTips.csproj b/HideTips/HideTips.csproj index 57d91c9..073b7ce 100644 --- a/HideTips/HideTips.csproj +++ b/HideTips/HideTips.csproj @@ -6,7 +6,7 @@ HideTips org.soardev.hidetips DSP MOD - HideTips - 1.0.3 + 1.0.4 true latest https://nuget.bepinex.dev/v3/index.json @@ -23,7 +23,7 @@ - + diff --git a/HideTips/README.md b/HideTips/README.md index fd02649..6f47d4a 100644 --- a/HideTips/README.md +++ b/HideTips/README.md @@ -4,6 +4,9 @@ #### 隐藏/屏蔽各种引导提示/消息 ## Changelog +* 1.0.4 + + Remove `Disable title screen demo scene loading`, as it is buggy in recent updates. + + Fix a bug that when tutorials are not added to the guides panel when they are hidden by this MOD. * 1.0.3 + Add config entries to disable research completion tips/popup windows + Add a note to README for mod compatibility on `Disable title screen demo scene loading`. @@ -17,10 +20,12 @@ ## Usage * Tips/messages that can be hidden: random-reminder, tutorial, achievement/milestone card, research completion tips/popup windows. * Skip prologue for new game. -* Disable title screen demo scene loading. Be note that this may conflict with some mods, disable this if you get any error popup on title screen. * Each type of tips/messages is configurable individually. ## 更新日志 +* 1.0.4 + + 移除`关闭标题画面的演示场景加载`设置,因为在最近的更新中有较多bug。 + + 修复了一个bug,当教程指引被这个MOD隐藏时,它们不会被添加到教程面板。 * 1.0.3 + 增加设置项以关闭研究完成的提示/弹窗 + 在README中增加了一个关于`关闭标题画面的演示场景加载`设置的兼容性说明 @@ -34,5 +39,4 @@ ## 使用说明 * 可以屏蔽的消息:随机提醒,教程,成就/里程碑卡片,研究完成的提示/弹窗。 * 跳过新游戏引导动画。 -* 关闭标题画面的演示场景加载。注意这可能会和其他mod冲突,如果在标题画面出现错误弹窗请关闭这个设置。 * 各种屏蔽功能都可以在配置文件里开关。 diff --git a/HideTips/package/manifest.json b/HideTips/package/manifest.json index 3d7980d..bdcb15d 100644 --- a/HideTips/package/manifest.json +++ b/HideTips/package/manifest.json @@ -1,6 +1,6 @@ { "name": "HideTips", - "version_number": "1.0.3", + "version_number": "1.0.4", "website_url": "https://github.com/soarqin/DSP_Mods/tree/master/HideTips", "description": "Hide/Disable various tutorial tips/messages / 隐藏/屏蔽各种引导提示/消息", "dependencies": [ diff --git a/LabOpt/LabOpt.csproj b/LabOpt/LabOpt.csproj index c4e6b32..3e272c0 100644 --- a/LabOpt/LabOpt.csproj +++ b/LabOpt/LabOpt.csproj @@ -23,7 +23,7 @@ - + diff --git a/LabOptPreloader/LabOptPreloader.csproj b/LabOptPreloader/LabOptPreloader.csproj index ac2a5f7..b987d87 100644 --- a/LabOptPreloader/LabOptPreloader.csproj +++ b/LabOptPreloader/LabOptPreloader.csproj @@ -22,7 +22,7 @@ - + diff --git a/MechaDronesTweaks/MechaDronesTweaks.csproj b/MechaDronesTweaks/MechaDronesTweaks.csproj index 7f23acf..8ff472d 100644 --- a/MechaDronesTweaks/MechaDronesTweaks.csproj +++ b/MechaDronesTweaks/MechaDronesTweaks.csproj @@ -23,7 +23,7 @@ - + diff --git a/OCBatchBuild/OCBatchBuild.csproj b/OCBatchBuild/OCBatchBuild.csproj index 5b4e548..111c72a 100644 --- a/OCBatchBuild/OCBatchBuild.csproj +++ b/OCBatchBuild/OCBatchBuild.csproj @@ -23,7 +23,7 @@ - + diff --git a/OverclockEverything/OverclockEverything.csproj b/OverclockEverything/OverclockEverything.csproj index 4d1920a..4503ccf 100644 --- a/OverclockEverything/OverclockEverything.csproj +++ b/OverclockEverything/OverclockEverything.csproj @@ -25,7 +25,7 @@ - + diff --git a/PoolOpt/PoolOpt.csproj b/PoolOpt/PoolOpt.csproj index cca532d..815a30f 100644 --- a/PoolOpt/PoolOpt.csproj +++ b/PoolOpt/PoolOpt.csproj @@ -23,7 +23,7 @@ - + diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index be8a8ad..7f0ec1b 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -25,7 +25,7 @@ - + diff --git a/UniverseGenTweaks/UniverseGenTweaks.csproj b/UniverseGenTweaks/UniverseGenTweaks.csproj index 7415a8d..4009c41 100644 --- a/UniverseGenTweaks/UniverseGenTweaks.csproj +++ b/UniverseGenTweaks/UniverseGenTweaks.csproj @@ -28,7 +28,7 @@ - + diff --git a/UserCloak/UserCloak.csproj b/UserCloak/UserCloak.csproj index 05c66a8..b0060ad 100644 --- a/UserCloak/UserCloak.csproj +++ b/UserCloak/UserCloak.csproj @@ -23,7 +23,7 @@ - +