From 9d9a12c1affb6b2a2617df81195deaa7040d0635 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Sun, 21 Sep 2025 18:21:46 +0800 Subject: [PATCH] more fixes to make sure nothing working wrong on game --- CheatEnabler/Patches/DysonSpherePatch.cs | 2 +- CheatEnabler/Patches/FactoryPatch.cs | 2 +- CheatEnabler/Patches/GamePatch.cs | 14 +-- CheatEnabler/Patches/ResourcePatch.cs | 24 ++-- HideTips/HideTips.cs | 16 +-- UXAssist/Common/WinApi.cs | 2 +- UXAssist/Patches/FactoryPatch.cs | 4 +- UXAssist/Patches/GamePatch.cs | 142 +---------------------- UXAssist/Patches/LogisticsPatch.cs | 2 +- UXAssist/Patches/PersistPatch.cs | 23 ---- UXAssist/UI/MyWindow.cs | 4 +- UXAssist/UIConfigWindow.cs | 5 +- UXAssist/UXAssist.cs | 2 - UniverseGenTweaks/EpicDifficulty.cs | 2 +- 14 files changed, 39 insertions(+), 205 deletions(-) diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs index 809f0fe..574bb65 100644 --- a/CheatEnabler/Patches/DysonSpherePatch.cs +++ b/CheatEnabler/Patches/DysonSpherePatch.cs @@ -295,7 +295,7 @@ public class DysonSpherePatch : PatchImpl } [HarmonyPrefix] - [HarmonyPatch(typeof(DysonSwarm), "GameTick")] + [HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.GameTick))] public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time) { var index = __instance.starData.index; diff --git a/CheatEnabler/Patches/FactoryPatch.cs b/CheatEnabler/Patches/FactoryPatch.cs index 959980c..2d97c66 100644 --- a/CheatEnabler/Patches/FactoryPatch.cs +++ b/CheatEnabler/Patches/FactoryPatch.cs @@ -495,7 +495,7 @@ public class FactoryPatch : PatchImpl } [HarmonyPostfix] - [HarmonyPatch(typeof(StorageComponent), "GetItemCount", typeof(int))] + [HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.GetItemCount), typeof(int))] public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result) { if (__result > 99) return; diff --git a/CheatEnabler/Patches/GamePatch.cs b/CheatEnabler/Patches/GamePatch.cs index 21ca9f7..6daaee9 100644 --- a/CheatEnabler/Patches/GamePatch.cs +++ b/CheatEnabler/Patches/GamePatch.cs @@ -64,19 +64,19 @@ public static class GamePatch } [HarmonyPrefix] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")] - [HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyBeforeGameSave))] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnAssemblerRecipePick))] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnGameBegin))] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnMechaForgeTaskComplete))] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUnlockTech))] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUseConsole))] private static bool DisableAbnormalLogic() { return false; } [HarmonyPostfix] - [HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")] + [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.InitDeterminators))] private static void DisableAbnormalDeterminators(AbnormalityLogic __instance) { _savedDeterminators = __instance.determinators; diff --git a/CheatEnabler/Patches/ResourcePatch.cs b/CheatEnabler/Patches/ResourcePatch.cs index 952203c..878ab2f 100644 --- a/CheatEnabler/Patches/ResourcePatch.cs +++ b/CheatEnabler/Patches/ResourcePatch.cs @@ -62,18 +62,18 @@ public static class ResourcePatch private class FastMining : PatchImpl { [HarmonyTranspiler] - [HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))] - [HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))] - [HarmonyPatch(typeof(ItemProto), "GetPropValue")] - [HarmonyPatch(typeof(PlanetTransport), "GameTick")] - [HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")] - [HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")] - [HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")] - [HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")] - [HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")] - [HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")] - [HarmonyPatch(typeof(UIStationStorage), "RefreshValues")] - [HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")] + [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))] + [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))] + [HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))] + [HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))] + [HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))] + [HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))] + [HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.OnPlanetDataSet))] + [HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.RefreshDynamicProperties))] + [HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.OnStarDataSet))] + [HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.RefreshDynamicProperties))] + [HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.RefreshValues))] + [HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))] private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { var matcher = new CodeMatcher(instructions, generator); diff --git a/HideTips/HideTips.cs b/HideTips/HideTips.cs index 55a1623..ac18995 100644 --- a/HideTips/HideTips.cs +++ b/HideTips/HideTips.cs @@ -152,7 +152,7 @@ public class HideTips : BaseUnityPlugin class HideMenuDemo { [HarmonyPriority(Priority.First), HarmonyPrefix] - [HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))] + [HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))] private static bool DSPGame_StartDemoGame_Prefix() { if (DSPGame.Game != null) @@ -188,7 +188,7 @@ class HideMenuDemo } [HarmonyPriority(Priority.First), HarmonyPrefix] - [HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")] + [HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))] private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result) { __result = true; @@ -196,18 +196,18 @@ class HideMenuDemo } [HarmonyPriority(Priority.First), HarmonyPrefix] - [HarmonyPatch(typeof(DSPGame), "LateUpdate")] - [HarmonyPatch(typeof(GameMain), "LateUpdate")] - [HarmonyPatch(typeof(GameMain), "FixedUpdate")] - [HarmonyPatch(typeof(GameMain), "Update")] - [HarmonyPatch(typeof(GameCamera), "LateUpdate")] + [HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))] + [HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))] + [HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))] + [HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))] + [HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))] private static bool DSPGame_LateUpdate_Prefix() { return !DSPGame.IsMenuDemo; } [HarmonyPriority(Priority.First), HarmonyPrefix] - [HarmonyPatch(typeof(GameMain), "Begin")] + [HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))] private static bool GameMain_Begin_Prefix() { if (!DSPGame.IsMenuDemo) return true; diff --git a/UXAssist/Common/WinApi.cs b/UXAssist/Common/WinApi.cs index 9b7c4a1..a345f90 100644 --- a/UXAssist/Common/WinApi.cs +++ b/UXAssist/Common/WinApi.cs @@ -268,7 +268,7 @@ public static class WinApi return result; - int CountBitsSet(ulong mask) + static int CountBitsSet(ulong mask) { var count = 0; while (mask != 0) diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs index 41b0642..6c6af36 100644 --- a/UXAssist/Patches/FactoryPatch.cs +++ b/UXAssist/Patches/FactoryPatch.cs @@ -358,7 +358,7 @@ public class FactoryPatch : PatchImpl } [HarmonyTranspiler] - [HarmonyPatch(typeof(StarSimulator), "LateUpdate")] + [HarmonyPatch(typeof(StarSimulator), nameof(StarSimulator.LateUpdate))] private static IEnumerable StarSimulator_LateUpdate_Transpiler(IEnumerable instructions, ILGenerator generator) { var matcher = new CodeMatcher(instructions, generator); @@ -384,7 +384,7 @@ public class FactoryPatch : PatchImpl } [HarmonyTranspiler] - [HarmonyPatch(typeof(PlanetSimulator), "LateUpdate")] + [HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateUpdate))] private static IEnumerable PlanetSimulator_LateUpdate_Transpiler(IEnumerable instructions, ILGenerator generator) { // var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized)); diff --git a/UXAssist/Patches/GamePatch.cs b/UXAssist/Patches/GamePatch.cs index 49eba74..5f364dc 100644 --- a/UXAssist/Patches/GamePatch.cs +++ b/UXAssist/Patches/GamePatch.cs @@ -19,8 +19,6 @@ public class GamePatch : PatchImpl public static ConfigEntry EnableWindowResizeEnabled; public static ConfigEntry LoadLastWindowRectEnabled; - public static ConfigEntry MouseCursorScaleUpMultiplier; - // public static ConfigEntry AutoSaveOptEnabled; public static ConfigEntry ConvertSavesFromPeaceEnabled; public static ConfigEntry LastWindowRect; @@ -87,11 +85,6 @@ public class GamePatch : PatchImpl FixLastWindowRect(); } }; - MouseCursorScaleUpMultiplier.SettingChanged += (_, _) => - { - MouseCursorScaleUp.NeedReloadCursors = true; - MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1); - }; // AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath(); @@ -123,8 +116,6 @@ public class GamePatch : PatchImpl } } EnableWindowResize.Enable(EnableWindowResizeEnabled.Value); - MouseCursorScaleUp.NeedReloadCursors = false; - MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1); // AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); Enable(true); @@ -136,8 +127,6 @@ public class GamePatch : PatchImpl { Enable(false); EnableWindowResize.Enable(false); - MouseCursorScaleUp.NeedReloadCursors = false; - MouseCursorScaleUp.Enable(false); // AutoSaveOpt.Enable(false); ConvertSavesFromPeace.Enable(false); } @@ -160,7 +149,7 @@ public class GamePatch : PatchImpl [HarmonyPostfix] [HarmonyPriority(Priority.First)] - [HarmonyPatch(typeof(GameConfig), "gameSaveFolder", MethodType.Getter)] + [HarmonyPatch(typeof(GameConfig), nameof(GameConfig.gameSaveFolder), MethodType.Getter)] public static void GameConfig_gameSaveFolder_Postfix(ref string __result) { if (!ProfileBasedSaveFolderEnabled.Value || string.IsNullOrEmpty(WindowFunctions.ProfileName)) return; @@ -298,7 +287,7 @@ public class GamePatch : PatchImpl var matcher = new CodeMatcher(instructions, generator); var label1 = generator.DefineLabel(); matcher.MatchForward(false, - new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Screen), nameof(Screen.SetResolution), [typeof(int), typeof(int), typeof(bool), typeof(int)])) + new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Screen), nameof(Screen.SetResolution), [typeof(int), typeof(int), typeof(FullScreenMode), typeof(RefreshRate)])) ).Advance(1).Labels.Add(label1); matcher.Start().Insert( Transpilers.EmitDelegate(() => @@ -601,131 +590,4 @@ public class GamePatch : PatchImpl return false; } } - - [PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)] - private class MouseCursorScaleUp : PatchImpl - { - public static bool NeedReloadCursors; - - protected override void OnEnable() - { - if (!NeedReloadCursors) return; - if (!UICursor.loaded) return; - UICursor.loaded = false; - UICursor.LoadCursors(); - } - - protected override void OnDisable() - { - if (!NeedReloadCursors) return; - if (!UICursor.loaded) return; - UICursor.loaded = false; - UICursor.LoadCursors(); - } - - [HarmonyTranspiler] - [HarmonyPatch(typeof(UICursor), nameof(UICursor.LoadCursors))] - private static IEnumerable UICursor_LoadCursors_Transpiler(IEnumerable instructions, ILGenerator generator) - { - var matcher = new CodeMatcher(instructions, generator); - /* - matcher.MatchForward(false, - new CodeMatch(OpCodes.Ldc_I4_S), - new CodeMatch(OpCodes.Newarr) - ); - var startPos = matcher.Pos; - matcher.Advance(2).MatchForward(false, - new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorTexs))) - ); - var endPos = matcher.Pos + 1; - matcher.Start().Advance(startPos).RemoveInstructions(endPos - startPos); - matcher.InsertAndAdvance( - Transpilers.EmitDelegate(() => - { - var pluginfolder = Util.PluginFolder; - UICursor.cursorTexs = - [ - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-transfer.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-in.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-out.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-a.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-b.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-ban.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-delete.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-reform.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-dyson-node-create.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-painter.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eyedropper.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eraser.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-upgrade.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-downgrade.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-blank.png"), - Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-remove.png") - ]; - }) - ); - */ - matcher.MatchForward(false, - new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorHots))), - new CodeMatch(OpCodes.Ldc_I4_1), - new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.loaded))) - ).Advance(1).InsertAndAdvance( - Transpilers.EmitDelegate(() => - { - var multiplier = MouseCursorScaleUpMultiplier.Value; - for (var i = 0; i < UICursor.cursorTexs.Length; i++) - { - var cursor = UICursor.cursorTexs[i]; - if (cursor == null) continue; - var newWidth = 32 * multiplier; - var newHeight = 32 * multiplier; - if (cursor.width == newWidth && cursor.height == newHeight) continue; - UICursor.cursorTexs[i] = ResizeTexture2D(cursor, newWidth, newHeight); - } - - if (multiplier <= 1) return; - for (var i = UICursor.cursorHots.Length - 1; i >= 0; i--) - { - UICursor.cursorHots[i] = new Vector2(UICursor.cursorHots[i].x * multiplier, UICursor.cursorHots[i].y * multiplier); - } - }) - ).MatchForward(false, - new CodeMatch(OpCodes.Ldc_I4_0), - new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)])) - ).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1)); - return matcher.InstructionEnumeration(); - - Texture2D ResizeTexture2D(Texture2D texture2D, int targetWidth, int targetHeight) - { - var oldActive = RenderTexture.active; - var rt = new RenderTexture(targetWidth, targetHeight, 32) - { - antiAliasing = 8 - }; - RenderTexture.active = rt; - Graphics.Blit(texture2D, rt); - rt.ResolveAntiAliasedSurface(); - var result = new Texture2D(targetWidth, targetHeight, texture2D.format, false); - result.ReadPixels(new Rect(0, 0, targetWidth, targetHeight), 0, 0); - result.filterMode = FilterMode.Trilinear; - result.Apply(); - RenderTexture.active = oldActive; - rt.Release(); - return result; - } - } - - [HarmonyTranspiler] - [HarmonyPatch(typeof(UICursor), nameof(UICursor.cursorIndexApply), MethodType.Setter)] - private static IEnumerable UICursor_set_cursorIndexApply_Transpiler(IEnumerable instructions, ILGenerator generator) - { - var matcher = new CodeMatcher(instructions, generator); - matcher.Start().MatchForward(false, - new CodeMatch(OpCodes.Ldc_I4_0), - new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)])) - ).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1)); - return matcher.InstructionEnumeration(); - } - } } \ No newline at end of file diff --git a/UXAssist/Patches/LogisticsPatch.cs b/UXAssist/Patches/LogisticsPatch.cs index bd861e6..5f59108 100644 --- a/UXAssist/Patches/LogisticsPatch.cs +++ b/UXAssist/Patches/LogisticsPatch.cs @@ -850,7 +850,7 @@ public static class LogisticsPatch var sliderBgPrefab = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Station Window/storage-box-0/slider-bg"); - _tipPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tip-prefab"), _stationTipsRoot.transform); + _tipPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tips/vein-tip-prefab"), _stationTipsRoot.transform); _tipPrefab.name = "tipPrefab"; Object.Destroy(_tipPrefab.GetComponent()); var image = _tipPrefab.GetComponent(); diff --git a/UXAssist/Patches/PersistPatch.cs b/UXAssist/Patches/PersistPatch.cs index 717037c..6537b85 100644 --- a/UXAssist/Patches/PersistPatch.cs +++ b/UXAssist/Patches/PersistPatch.cs @@ -41,29 +41,6 @@ public class PersistPatch : PatchImpl return matcher.InstructionEnumeration(); } - // Patch to fix the issue that warning popup on VeinUtil upgraded to level 8000+ - [HarmonyTranspiler] - [HarmonyPatch(typeof(ABN_VeinsUtil), nameof(ABN_VeinsUtil.CheckValue))] - private static IEnumerable ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable instructions, ILGenerator generator) - { - var matcher = new CodeMatcher(instructions, generator); - matcher.MatchForward(false, - new CodeMatch(OpCodes.Ldelem_R8), - new CodeMatch(OpCodes.Conv_R4), - new CodeMatch(OpCodes.Add), - new CodeMatch(OpCodes.Stloc_1) - ); - // loc1 = Mathf.Round(n * 1000f) / 1000f; - matcher.Advance(3).Insert( - new CodeInstruction(OpCodes.Ldc_R4, 1000f), - new CodeInstruction(OpCodes.Mul), - new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Mathf), nameof(Mathf.Round))), - new CodeInstruction(OpCodes.Ldc_R4, 1000f), - new CodeInstruction(OpCodes.Div) - ); - return matcher.InstructionEnumeration(); - } - // Bring popup tip window to top layer [HarmonyTranspiler] [HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))] diff --git a/UXAssist/UI/MyWindow.cs b/UXAssist/UI/MyWindow.cs index 26187c2..ee068f6 100644 --- a/UXAssist/UI/MyWindow.cs +++ b/UXAssist/UI/MyWindow.cs @@ -613,7 +613,7 @@ public abstract class MyWindowManager /* //_Create -> _Init - [HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnCreate")] + [HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))] public static void UIGame__OnCreate_Postfix() { } @@ -638,7 +638,7 @@ public abstract class MyWindowManager } /* - [HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnFree")] + [HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnFree))] public static void UIGame__OnFree_Postfix() { foreach (var win in Windows) diff --git a/UXAssist/UIConfigWindow.cs b/UXAssist/UIConfigWindow.cs index cbe8207..50214e6 100644 --- a/UXAssist/UIConfigWindow.cs +++ b/UXAssist/UIConfigWindow.cs @@ -27,7 +27,6 @@ public static class UIConfigWindow I18N.Add("Tech/Combat/UI", "Tech/Combat/UI", "科研/战斗/UI"); I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)"); I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小"); - I18N.Add("Scale up mouse cursor", "Scale up mouse cursor", "放大鼠标指针"); /* I18N.Add("Better auto-save mechanism", "Better auto-save mechanism", "更好的自动存档机制"); I18N.Add("Better auto-save mechanism tips", "Auto saves are stored in 'Save\\AutoSaves' folder, filenames are combined with cluster address and date-time", "自动存档会以星区地址和日期时间组合为文件名存储在'Save\\AutoSaves'文件夹中"); @@ -294,6 +293,7 @@ public static class UIConfigWindow private static void CreateUI(MyConfigWindow wnd, RectTransform trans) { + UnityEngine.UI.Text txt; _windowTrans = trans; wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist"); var tab1 = wnd.AddTab(trans, "General"); @@ -302,9 +302,6 @@ public static class UIConfigWindow wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize"); y += 36f; wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit"); - y += 36f; - var txt = wnd.AddText2(x + 2f, y, tab1, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor"); - wnd.AddSlider(x + txt.preferredWidth + 7f, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f); /* y += 30f; wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism"); diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index 1deac52..3b9fd12 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -69,8 +69,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave "Load last window position and size when game starts"); GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f), "Last window position and size"); - GamePatch.MouseCursorScaleUpMultiplier = Config.Bind("Game", "MouseCursorScaleUpMultiplier", 1, - "Mouse cursor scale up multiplier"); GamePatch.ProfileBasedSaveFolderEnabled = Config.Bind("Game", "ProfileBasedSaveFolder", false, "Profile-based save folder"); GamePatch.ProfileBasedOptionEnabled = Config.Bind("Game", "ProfileBasedOption", false, diff --git a/UniverseGenTweaks/EpicDifficulty.cs b/UniverseGenTweaks/EpicDifficulty.cs index c1e5f06..bdcc9fe 100644 --- a/UniverseGenTweaks/EpicDifficulty.cs +++ b/UniverseGenTweaks/EpicDifficulty.cs @@ -153,7 +153,7 @@ public static class EpicDifficulty } [HarmonyTranspiler] - [HarmonyPatch(typeof(GameDesc), "get_oilAmountMultiplier")] + [HarmonyPatch(typeof(GameDesc), nameof(GameDesc.oilAmountMultiplier), MethodType.Getter)] private static IEnumerable GameDesc_get_oilAmountMultiplier_Transpiler(IEnumerable instructions, ILGenerator generator) { var matcher = new CodeMatcher(instructions, generator);