diff --git a/AssemblyFromGame/Assembly-CSharp.dll b/AssemblyFromGame/Assembly-CSharp.dll new file mode 100644 index 0000000..551e263 Binary files /dev/null and b/AssemblyFromGame/Assembly-CSharp.dll differ diff --git a/AssemblyFromGame/UnityEngine.UI.dll b/AssemblyFromGame/UnityEngine.UI.dll new file mode 100644 index 0000000..bc55588 Binary files /dev/null and b/AssemblyFromGame/UnityEngine.UI.dll differ diff --git a/CheatEnabler/CheatEnabler.csproj b/CheatEnabler/CheatEnabler.csproj index 64c7cb6..4f405da 100644 --- a/CheatEnabler/CheatEnabler.csproj +++ b/CheatEnabler/CheatEnabler.csproj @@ -16,15 +16,14 @@ - - + + - diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs index 0d003e8..809f0fe 100644 --- a/CheatEnabler/Patches/DysonSpherePatch.cs +++ b/CheatEnabler/Patches/DysonSpherePatch.cs @@ -4,7 +4,6 @@ using System.Reflection.Emit; using BepInEx.Configuration; using HarmonyLib; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace CheatEnabler.Patches; @@ -134,12 +133,12 @@ public class DysonSpherePatch : PatchImpl { UpdateSailLifeTime(); UpdateSailsCacheForThisGame(); - GameLogic.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; } protected override void OnDisable() { - GameLogic.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; } private static void UpdateSailLifeTime() diff --git a/CheatEnabler/Patches/FactoryPatch.cs b/CheatEnabler/Patches/FactoryPatch.cs index 793d20b..959980c 100644 --- a/CheatEnabler/Patches/FactoryPatch.cs +++ b/CheatEnabler/Patches/FactoryPatch.cs @@ -8,7 +8,6 @@ using HarmonyLib; using UnityEngine; using UnityEngine.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace CheatEnabler.Patches; @@ -94,14 +93,14 @@ public class FactoryPatch : PatchImpl ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value); Enable(true); CargoTrafficPatch.Enable(true); - GameLogic.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild; - GameLogic.OnDataLoaded += OnDataLoaded; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild; + GameLogicProc.OnDataLoaded += OnDataLoaded; } public static void Uninit() { - GameLogic.OnDataLoaded -= OnDataLoaded; - GameLogic.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild; + GameLogicProc.OnDataLoaded -= OnDataLoaded; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild; CargoTrafficPatch.Enable(false); Enable(false); ImmediateBuild.Enable(false); @@ -629,12 +628,12 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { InitSignalBelts(); - GameLogic.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; } protected override void OnDisable() { - GameLogic.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; _initialized = false; _signalBelts = null; _signalBeltsCapacity = 0; @@ -995,7 +994,7 @@ public class FactoryPatch : PatchImpl var data = GameMain.data; var factories = data?.factories; if (factories == null) return; - PerformanceMonitor.BeginSample(ECpuWorkEntry.Belt); + DeepProfiler.BeginSample(DPEntry.Belt); for (var index = data.factoryCount - 1; index >= 0; index--) { var factory = factories[index]; @@ -1123,16 +1122,16 @@ public class FactoryPatch : PatchImpl } } - PerformanceMonitor.EndSample(ECpuWorkEntry.Belt); + DeepProfiler.EndSample(DPEntry.Belt); } [HarmonyTranspiler] - [HarmonyPatch(typeof(GameData), "GameTick")] - public static IEnumerable GameData_GameTick_Transpiler(IEnumerable instructions) + [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LogicFrame))] + public static IEnumerable GameLogic_LogicFrame_Transpiler(IEnumerable instructions) { var matcher = new CodeMatcher(instructions); matcher.MatchForward(false, - new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndSample))) + new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(DeepProfiler), nameof(DeepProfiler.EndSample))) ).Advance(1).Insert( new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals))) ); diff --git a/CheatEnabler/Patches/GamePatch.cs b/CheatEnabler/Patches/GamePatch.cs index e45667b..21ca9f7 100644 --- a/CheatEnabler/Patches/GamePatch.cs +++ b/CheatEnabler/Patches/GamePatch.cs @@ -282,7 +282,7 @@ public static class GamePatch } } - history.VarifyTechQueue(); + history.VerifyTechQueue(); if (history.currentTech != history.techQueue[0]) { history.currentTech = history.techQueue[0]; diff --git a/UXAssist/Common/GameLogic.cs b/UXAssist/Common/GameLogicProc.cs similarity index 93% rename from UXAssist/Common/GameLogic.cs rename to UXAssist/Common/GameLogicProc.cs index 3762995..8515294 100644 --- a/UXAssist/Common/GameLogic.cs +++ b/UXAssist/Common/GameLogicProc.cs @@ -3,7 +3,7 @@ using HarmonyLib; namespace UXAssist.Common; -public class GameLogic : PatchImpl +public class GameLogicProc : PatchImpl { public static Action OnDataLoaded; public static Action OnGameBegin; diff --git a/UXAssist/Functions/PlanetFunctions.cs b/UXAssist/Functions/PlanetFunctions.cs index a9661cf..7c955de 100644 --- a/UXAssist/Functions/PlanetFunctions.cs +++ b/UXAssist/Functions/PlanetFunctions.cs @@ -124,7 +124,7 @@ public static class PlanetFunctions var combatStatId = enemyData.combatStatId; planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat); planet.factory.skillSystem.combatStats.Remove(combatStatId); - planet.factory.KillEnemyFinally(player, i, ref CombatStat.empty); + planet.factory.KillEnemyFinally(i, ref CombatStat.empty); } planet.factory.enemySystem.Free(); UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots(); diff --git a/UXAssist/Functions/TechFunctions.cs b/UXAssist/Functions/TechFunctions.cs index 7e7ff84..0870e73 100644 --- a/UXAssist/Functions/TechFunctions.cs +++ b/UXAssist/Functions/TechFunctions.cs @@ -288,7 +288,7 @@ public static class TechFunctions { UnlockTechImmediately(techProto, toLevel, withPrerequisites); } - history.VarifyTechQueue(); + history.VerifyTechQueue(); if (history.currentTech != history.techQueue[0]) { history.currentTech = history.techQueue[0]; diff --git a/UXAssist/Functions/UIFunctions.cs b/UXAssist/Functions/UIFunctions.cs index 11a493c..f77ff81 100644 --- a/UXAssist/Functions/UIFunctions.cs +++ b/UXAssist/Functions/UIFunctions.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Collections.Generic; using UXAssist.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist.Functions; @@ -322,7 +321,7 @@ public static class UIFunctions } I18N.OnInitialized += UpdateI18N; - GameLogic.OnDataLoaded += () => + GameLogicProc.OnDataLoaded += () => { VeinProto veinProto; ItemProto itemProto; @@ -348,7 +347,7 @@ public static class UIFunctions UpdateI18N(); }; - GameLogic.OnGameBegin += () => + GameLogicProc.OnGameBegin += () => { if (DSPGame.IsMenuDemo) return; @@ -429,7 +428,7 @@ public static class UIFunctions OnPlanetScanEnded(); } }; - GameLogic.OnGameEnd += () => + GameLogicProc.OnGameEnd += () => { _starOrderNames = null; ShowStarName = null; diff --git a/UXAssist/Patches/DysonSpherePatch.cs b/UXAssist/Patches/DysonSpherePatch.cs index 8e461b8..a31f1ab 100644 --- a/UXAssist/Patches/DysonSpherePatch.cs +++ b/UXAssist/Patches/DysonSpherePatch.cs @@ -5,7 +5,6 @@ using BepInEx.Configuration; using HarmonyLib; using UnityEngine.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist.Patches; @@ -269,14 +268,14 @@ public class DysonSpherePatch : PatchImpl protected override void OnEnable() { InitNodeForAbsorb(); - GameLogic.OnGameBegin += GameMain_Begin_Postfix; - GameLogic.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd += GameMain_End_Postfix; } protected override void OnDisable() { - GameLogic.OnGameEnd -= GameMain_End_Postfix; - GameLogic.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd -= GameMain_End_Postfix; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; _initialized = false; _nodeForAbsorb = null; } diff --git a/UXAssist/Patches/FactoryPatch.cs b/UXAssist/Patches/FactoryPatch.cs index 15861d1..41b0642 100644 --- a/UXAssist/Patches/FactoryPatch.cs +++ b/UXAssist/Patches/FactoryPatch.cs @@ -10,7 +10,6 @@ using HarmonyLib; using UnityEngine; using UnityEngine.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist.Patches; @@ -276,12 +275,12 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { - GameLogic.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameEnd += GameMain_End_Postfix; } protected override void OnDisable() { - GameLogic.OnGameEnd -= GameMain_End_Postfix; + GameLogicProc.OnGameEnd -= GameMain_End_Postfix; if (_sunlight) { _sunlight.transform.localEulerAngles = new Vector3(0f, 180f); @@ -1405,16 +1404,16 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { - GameLogic.OnGameBegin += GameMain_Begin_Postfix; - GameLogic.OnGameEnd += GameMain_End_Postfix; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd += GameMain_End_Postfix; FixProto(); } protected override void OnDisable() { UnfixProto(); - GameLogic.OnGameEnd -= GameMain_End_Postfix; - GameLogic.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnGameEnd -= GameMain_End_Postfix; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; } public static void AlternatelyChanged() @@ -1770,14 +1769,14 @@ public class FactoryPatch : PatchImpl protected override void OnEnable() { AddBeltSignalProtos(); - GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; - GameLogic.OnGameBegin += GameMain_Begin_Postfix; + GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnGameBegin += GameMain_Begin_Postfix; } protected override void OnDisable() { - GameLogic.OnGameBegin -= GameMain_Begin_Postfix; - GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix; + GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; } private static void VFPreload_InvokeOnLoadWorkEnded_Postfix() @@ -1834,12 +1833,12 @@ public class FactoryPatch : PatchImpl } [HarmonyTranspiler] - [HarmonyPatch(typeof(GameData), "GameTick")] - public static IEnumerable GameData_GameTick_Transpiler(IEnumerable instructions, ILGenerator generator) + [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LogicFrame))] + public static IEnumerable GameLogic_LogicFrame_Transpiler(IEnumerable instructions, ILGenerator generator) { var matcher = new CodeMatcher(instructions, generator); matcher.MatchForward(false, - new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndSample))) + new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(DeepProfiler), nameof(DeepProfiler.EndSample))) ).Advance(1).Insert( Transpilers.EmitDelegate(() => { diff --git a/UXAssist/Patches/GamePatch.cs b/UXAssist/Patches/GamePatch.cs index 3b1275d..49eba74 100644 --- a/UXAssist/Patches/GamePatch.cs +++ b/UXAssist/Patches/GamePatch.cs @@ -302,10 +302,10 @@ public class GamePatch : PatchImpl ).Advance(1).Labels.Add(label1); matcher.Start().Insert( Transpilers.EmitDelegate(() => - _gameOption.fullscreen == DSPGame.globalOption.fullscreen && + _gameOption.displayMode != EOptionDisplayMode.Windowed && _gameOption.resolution.width == DSPGame.globalOption.resolution.width && _gameOption.resolution.height == DSPGame.globalOption.resolution.height && - _gameOption.resolution.refreshRate == DSPGame.globalOption.resolution.refreshRate + _gameOption.resolution.refreshRateRatio.Equals(DSPGame.globalOption.resolution.refreshRateRatio) ), new CodeInstruction(OpCodes.Brtrue, label1) ); diff --git a/UXAssist/Patches/LogisticsPatch.cs b/UXAssist/Patches/LogisticsPatch.cs index c0301a8..bd861e6 100644 --- a/UXAssist/Patches/LogisticsPatch.cs +++ b/UXAssist/Patches/LogisticsPatch.cs @@ -9,7 +9,6 @@ using UnityEngine.EventSystems; using UnityEngine.Serialization; using UnityEngine.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; using Object = UnityEngine.Object; namespace UXAssist.Patches; @@ -74,14 +73,14 @@ public static class LogisticsPatch RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value); RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value); - GameLogic.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin; - GameLogic.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded; + GameLogicProc.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin; + GameLogicProc.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded; } public static void Uninit() { - GameLogic.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded; - GameLogic.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin; + GameLogicProc.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded; + GameLogicProc.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin; AutoConfigLogistics.Enable(false); AutoConfigLogisticsSetDefaultRemoteLogicToStorage.Enable(false); diff --git a/UXAssist/Patches/TechPatch.cs b/UXAssist/Patches/TechPatch.cs index 606fb5e..a8442fb 100644 --- a/UXAssist/Patches/TechPatch.cs +++ b/UXAssist/Patches/TechPatch.cs @@ -5,7 +5,6 @@ using BepInEx.Configuration; using HarmonyLib; using UnityEngine.UI; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist.Patches; @@ -46,11 +45,11 @@ public static class TechPatch if (enable) { TryPatchProto(true); - GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; } else { - GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; TryPatchProto(false); } } @@ -189,11 +188,11 @@ public static class TechPatch { if (DSPGame.GameDesc != null) TryPatchProto(DSPGame.GameDesc.isPeaceMode); - GameLogic.OnGameBegin += OnGameBegin; + GameLogicProc.OnGameBegin += OnGameBegin; } else { - GameLogic.OnGameBegin -= OnGameBegin; + GameLogicProc.OnGameBegin -= OnGameBegin; TryPatchProto(false); } } diff --git a/UXAssist/UXAssist.cs b/UXAssist/UXAssist.cs index a38a608..1deac52 100644 --- a/UXAssist/UXAssist.cs +++ b/UXAssist/UXAssist.cs @@ -14,7 +14,6 @@ using UXAssist.Functions; using UXAssist.Patches; using UXAssist.UI; using Util = UXAssist.Common.Util; -using GameLogic = UXAssist.Common.GameLogic; namespace UXAssist; @@ -217,7 +216,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置"); // UI Patches - GameLogic.Enable(true); + GameLogicProc.Enable(true); UIConfigWindow.Init(); @@ -246,7 +245,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave _patches?.Do(type => type.GetMethod("Uninit")?.Invoke(null, null)); MyWindowManager.Enable(false); - GameLogic.Enable(false); + GameLogicProc.Enable(false); } private void Update() diff --git a/UXAssist/UXAssist.csproj b/UXAssist/UXAssist.csproj index d040a3e..29f860d 100644 --- a/UXAssist/UXAssist.csproj +++ b/UXAssist/UXAssist.csproj @@ -15,13 +15,12 @@ - - + + - diff --git a/UniverseGenTweaks/BirthPlanetPatch.cs b/UniverseGenTweaks/BirthPlanetPatch.cs index 7e1a094..93b4406 100644 --- a/UniverseGenTweaks/BirthPlanetPatch.cs +++ b/UniverseGenTweaks/BirthPlanetPatch.cs @@ -2,7 +2,6 @@ using BepInEx.Configuration; using HarmonyLib; using UXAssist.Common; -using GameLogic = UXAssist.Common.GameLogic; namespace UniverseGenTweaks; public static class BirthPlanetPatch @@ -75,12 +74,12 @@ public static class BirthPlanetPatch HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData(); PatchBirthThemeData(); _patch ??= Harmony.CreateAndPatchAll(typeof(BirthPlanetPatch)); - GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; } public static void Uninit() { - GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; + GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; _patch?.UnpatchSelf(); _patch = null; } diff --git a/UniverseGenTweaks/UniverseGenTweaks.csproj b/UniverseGenTweaks/UniverseGenTweaks.csproj index 48ef39b..346f358 100644 --- a/UniverseGenTweaks/UniverseGenTweaks.csproj +++ b/UniverseGenTweaks/UniverseGenTweaks.csproj @@ -15,8 +15,8 @@ - - + + @@ -24,6 +24,15 @@ + + + ..\AssemblyFromGame\Assembly-CSharp.dll + + + ..\AssemblyFromGame\UnityEngine.UI.dll + + +