1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-03-28 20:37:16 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
f5b364c6c3 partial fix belt signal 2025-09-21 20:28:35 +08:00
9719b9acca more fixes to make sure nothing working wrong on game 2025-09-21 18:21:46 +08:00
475d667964 we make them compile first 2025-09-21 17:22:56 +08:00
26 changed files with 105 additions and 275 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -16,15 +16,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" /> <PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> <PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" /> <!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'"> <ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" /> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
<!--
<ItemGroup> <ItemGroup>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath> <HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
@@ -33,7 +32,6 @@
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath> <HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
-->
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\UXAssist\UXAssist.csproj" /> <ProjectReference Include="..\UXAssist\UXAssist.csproj" />

View File

@@ -4,7 +4,6 @@ using System.Reflection.Emit;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches; namespace CheatEnabler.Patches;
@@ -134,12 +133,12 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
{ {
UpdateSailLifeTime(); UpdateSailLifeTime();
UpdateSailsCacheForThisGame(); UpdateSailsCacheForThisGame();
GameLogic.OnGameBegin += GameMain_Begin_Postfix; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
} }
protected override void OnDisable() protected override void OnDisable()
{ {
GameLogic.OnGameBegin -= GameMain_Begin_Postfix; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
} }
private static void UpdateSailLifeTime() private static void UpdateSailLifeTime()
@@ -296,7 +295,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(DysonSwarm), "GameTick")] [HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.GameTick))]
public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time) public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
{ {
var index = __instance.starData.index; var index = __instance.starData.index;

View File

@@ -8,7 +8,6 @@ using HarmonyLib;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches; namespace CheatEnabler.Patches;
@@ -94,14 +93,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value); ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
Enable(true); Enable(true);
CargoTrafficPatch.Enable(true); CargoTrafficPatch.Enable(true);
GameLogic.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
GameLogic.OnDataLoaded += OnDataLoaded; GameLogicProc.OnDataLoaded += OnDataLoaded;
} }
public static void Uninit() public static void Uninit()
{ {
GameLogic.OnDataLoaded -= OnDataLoaded; GameLogicProc.OnDataLoaded -= OnDataLoaded;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild;
CargoTrafficPatch.Enable(false); CargoTrafficPatch.Enable(false);
Enable(false); Enable(false);
ImmediateBuild.Enable(false); ImmediateBuild.Enable(false);
@@ -496,7 +495,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
[HarmonyPostfix] [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) public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result)
{ {
if (__result > 99) return; if (__result > 99) return;
@@ -629,12 +628,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable() protected override void OnEnable()
{ {
InitSignalBelts(); InitSignalBelts();
GameLogic.OnGameBegin += GameMain_Begin_Postfix; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
} }
protected override void OnDisable() protected override void OnDisable()
{ {
GameLogic.OnGameBegin -= GameMain_Begin_Postfix; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
_initialized = false; _initialized = false;
_signalBelts = null; _signalBelts = null;
_signalBeltsCapacity = 0; _signalBeltsCapacity = 0;
@@ -995,7 +994,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
var data = GameMain.data; var data = GameMain.data;
var factories = data?.factories; var factories = data?.factories;
if (factories == null) return; if (factories == null) return;
PerformanceMonitor.BeginSample(ECpuWorkEntry.Belt); DeepProfiler.BeginSample(DPEntry.Belt);
for (var index = data.factoryCount - 1; index >= 0; index--) for (var index = data.factoryCount - 1; index >= 0; index--)
{ {
var factory = factories[index]; var factory = factories[index];
@@ -1123,16 +1122,16 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
} }
PerformanceMonitor.EndSample(ECpuWorkEntry.Belt); DeepProfiler.EndSample(DPEntry.Belt);
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), "GameTick")] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LogicFrame))]
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> GameLogic_LogicFrame_Transpiler(IEnumerable<CodeInstruction> instructions)
{ {
var matcher = new CodeMatcher(instructions); var matcher = new CodeMatcher(instructions);
matcher.MatchForward(false, 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), [typeof(int), typeof(long)]))
).Advance(1).Insert( ).Advance(1).Insert(
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals))) new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals)))
); );

View File

@@ -64,19 +64,19 @@ public static class GamePatch
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyBeforeGameSave))]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnAssemblerRecipePick))]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnGameBegin))]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnMechaForgeTaskComplete))]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUnlockTech))]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUseConsole))]
private static bool DisableAbnormalLogic() private static bool DisableAbnormalLogic()
{ {
return false; return false;
} }
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")] [HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.InitDeterminators))]
private static void DisableAbnormalDeterminators(AbnormalityLogic __instance) private static void DisableAbnormalDeterminators(AbnormalityLogic __instance)
{ {
_savedDeterminators = __instance.determinators; _savedDeterminators = __instance.determinators;
@@ -282,7 +282,7 @@ public static class GamePatch
} }
} }
history.VarifyTechQueue(); history.VerifyTechQueue();
if (history.currentTech != history.techQueue[0]) if (history.currentTech != history.techQueue[0])
{ {
history.currentTech = history.techQueue[0]; history.currentTech = history.techQueue[0];

View File

@@ -62,18 +62,18 @@ public static class ResourcePatch
private class FastMining : PatchImpl<FastMining> private class FastMining : PatchImpl<FastMining>
{ {
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))] [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))] [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
[HarmonyPatch(typeof(ItemProto), "GetPropValue")] [HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))]
[HarmonyPatch(typeof(PlanetTransport), "GameTick")] [HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))]
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")] [HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))]
[HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")] [HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))]
[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")] [HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.OnPlanetDataSet))]
[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")] [HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.RefreshDynamicProperties))]
[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")] [HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.OnStarDataSet))]
[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")] [HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.RefreshDynamicProperties))]
[HarmonyPatch(typeof(UIStationStorage), "RefreshValues")] [HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.RefreshValues))]
[HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")] [HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);

View File

@@ -152,7 +152,7 @@ public class HideTips : BaseUnityPlugin
class HideMenuDemo class HideMenuDemo
{ {
[HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))] [HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))]
private static bool DSPGame_StartDemoGame_Prefix() private static bool DSPGame_StartDemoGame_Prefix()
{ {
if (DSPGame.Game != null) if (DSPGame.Game != null)
@@ -188,7 +188,7 @@ class HideMenuDemo
} }
[HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")] [HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))]
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result) private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
{ {
__result = true; __result = true;
@@ -196,18 +196,18 @@ class HideMenuDemo
} }
[HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(DSPGame), "LateUpdate")] [HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))]
[HarmonyPatch(typeof(GameMain), "LateUpdate")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
[HarmonyPatch(typeof(GameMain), "FixedUpdate")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))]
[HarmonyPatch(typeof(GameMain), "Update")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))]
[HarmonyPatch(typeof(GameCamera), "LateUpdate")] [HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))]
private static bool DSPGame_LateUpdate_Prefix() private static bool DSPGame_LateUpdate_Prefix()
{ {
return !DSPGame.IsMenuDemo; return !DSPGame.IsMenuDemo;
} }
[HarmonyPriority(Priority.First), HarmonyPrefix] [HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(GameMain), "Begin")] [HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))]
private static bool GameMain_Begin_Prefix() private static bool GameMain_Begin_Prefix()
{ {
if (!DSPGame.IsMenuDemo) return true; if (!DSPGame.IsMenuDemo) return true;

View File

@@ -3,7 +3,7 @@ using HarmonyLib;
namespace UXAssist.Common; namespace UXAssist.Common;
public class GameLogic : PatchImpl<GameLogic> public class GameLogicProc : PatchImpl<GameLogicProc>
{ {
public static Action OnDataLoaded; public static Action OnDataLoaded;
public static Action OnGameBegin; public static Action OnGameBegin;

View File

@@ -268,7 +268,7 @@ public static class WinApi
return result; return result;
int CountBitsSet(ulong mask) static int CountBitsSet(ulong mask)
{ {
var count = 0; var count = 0;
while (mask != 0) while (mask != 0)

View File

@@ -124,7 +124,7 @@ public static class PlanetFunctions
var combatStatId = enemyData.combatStatId; var combatStatId = enemyData.combatStatId;
planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat); planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat);
planet.factory.skillSystem.combatStats.Remove(combatStatId); 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(); planet.factory.enemySystem.Free();
UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots(); UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots();

View File

@@ -288,7 +288,7 @@ public static class TechFunctions
{ {
UnlockTechImmediately(techProto, toLevel, withPrerequisites); UnlockTechImmediately(techProto, toLevel, withPrerequisites);
} }
history.VarifyTechQueue(); history.VerifyTechQueue();
if (history.currentTech != history.techQueue[0]) if (history.currentTech != history.techQueue[0])
{ {
history.currentTech = history.techQueue[0]; history.currentTech = history.techQueue[0];

View File

@@ -6,7 +6,6 @@ using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using UXAssist.UI; using UXAssist.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Functions; namespace UXAssist.Functions;
@@ -322,7 +321,7 @@ public static class UIFunctions
} }
I18N.OnInitialized += UpdateI18N; I18N.OnInitialized += UpdateI18N;
GameLogic.OnDataLoaded += () => GameLogicProc.OnDataLoaded += () =>
{ {
VeinProto veinProto; VeinProto veinProto;
ItemProto itemProto; ItemProto itemProto;
@@ -348,7 +347,7 @@ public static class UIFunctions
UpdateI18N(); UpdateI18N();
}; };
GameLogic.OnGameBegin += () => GameLogicProc.OnGameBegin += () =>
{ {
if (DSPGame.IsMenuDemo) return; if (DSPGame.IsMenuDemo) return;
@@ -429,7 +428,7 @@ public static class UIFunctions
OnPlanetScanEnded(); OnPlanetScanEnded();
} }
}; };
GameLogic.OnGameEnd += () => GameLogicProc.OnGameEnd += () =>
{ {
_starOrderNames = null; _starOrderNames = null;
ShowStarName = null; ShowStarName = null;

View File

@@ -5,7 +5,6 @@ using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches; namespace UXAssist.Patches;
@@ -269,14 +268,14 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
protected override void OnEnable() protected override void OnEnable()
{ {
InitNodeForAbsorb(); InitNodeForAbsorb();
GameLogic.OnGameBegin += GameMain_Begin_Postfix; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
GameLogic.OnGameEnd += GameMain_End_Postfix; GameLogicProc.OnGameEnd += GameMain_End_Postfix;
} }
protected override void OnDisable() protected override void OnDisable()
{ {
GameLogic.OnGameEnd -= GameMain_End_Postfix; GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
_initialized = false; _initialized = false;
_nodeForAbsorb = null; _nodeForAbsorb = null;
} }

View File

@@ -10,7 +10,6 @@ using HarmonyLib;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches; namespace UXAssist.Patches;
@@ -276,12 +275,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable() protected override void OnEnable()
{ {
GameLogic.OnGameEnd += GameMain_End_Postfix; GameLogicProc.OnGameEnd += GameMain_End_Postfix;
} }
protected override void OnDisable() protected override void OnDisable()
{ {
GameLogic.OnGameEnd -= GameMain_End_Postfix; GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
if (_sunlight) if (_sunlight)
{ {
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f); _sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
@@ -359,7 +358,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(StarSimulator), "LateUpdate")] [HarmonyPatch(typeof(StarSimulator), nameof(StarSimulator.LateUpdate))]
private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
@@ -385,7 +384,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetSimulator), "LateUpdate")] [HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateUpdate))]
private static IEnumerable<CodeInstruction> PlanetSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
// var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized)); // var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized));
@@ -1405,16 +1404,16 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable() protected override void OnEnable()
{ {
GameLogic.OnGameBegin += GameMain_Begin_Postfix; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
GameLogic.OnGameEnd += GameMain_End_Postfix; GameLogicProc.OnGameEnd += GameMain_End_Postfix;
FixProto(); FixProto();
} }
protected override void OnDisable() protected override void OnDisable()
{ {
UnfixProto(); UnfixProto();
GameLogic.OnGameEnd -= GameMain_End_Postfix; GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
} }
public static void AlternatelyChanged() public static void AlternatelyChanged()
@@ -1770,14 +1769,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable() protected override void OnEnable()
{ {
AddBeltSignalProtos(); AddBeltSignalProtos();
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogic.OnGameBegin += GameMain_Begin_Postfix; GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
} }
protected override void OnDisable() protected override void OnDisable()
{ {
GameLogic.OnGameBegin -= GameMain_Begin_Postfix; GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
} }
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix() private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
@@ -1834,12 +1833,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), "GameTick")] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LogicFrame))]
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) public static IEnumerable<CodeInstruction> GameLogic_LogicFrame_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false, 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), [typeof(int), typeof(long)]))
).Advance(1).Insert( ).Advance(1).Insert(
Transpilers.EmitDelegate(() => Transpilers.EmitDelegate(() =>
{ {

View File

@@ -19,8 +19,6 @@ public class GamePatch : PatchImpl<GamePatch>
public static ConfigEntry<bool> EnableWindowResizeEnabled; public static ConfigEntry<bool> EnableWindowResizeEnabled;
public static ConfigEntry<bool> LoadLastWindowRectEnabled; public static ConfigEntry<bool> LoadLastWindowRectEnabled;
public static ConfigEntry<int> MouseCursorScaleUpMultiplier;
// public static ConfigEntry<bool> AutoSaveOptEnabled; // public static ConfigEntry<bool> AutoSaveOptEnabled;
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled; public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
public static ConfigEntry<Vector4> LastWindowRect; public static ConfigEntry<Vector4> LastWindowRect;
@@ -87,11 +85,6 @@ public class GamePatch : PatchImpl<GamePatch>
FixLastWindowRect(); FixLastWindowRect();
} }
}; };
MouseCursorScaleUpMultiplier.SettingChanged += (_, _) =>
{
MouseCursorScaleUp.NeedReloadCursors = true;
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
};
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); // AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath(); ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
@@ -123,8 +116,6 @@ public class GamePatch : PatchImpl<GamePatch>
} }
} }
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value); EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
MouseCursorScaleUp.NeedReloadCursors = false;
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value); // AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value); ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
Enable(true); Enable(true);
@@ -136,8 +127,6 @@ public class GamePatch : PatchImpl<GamePatch>
{ {
Enable(false); Enable(false);
EnableWindowResize.Enable(false); EnableWindowResize.Enable(false);
MouseCursorScaleUp.NeedReloadCursors = false;
MouseCursorScaleUp.Enable(false);
// AutoSaveOpt.Enable(false); // AutoSaveOpt.Enable(false);
ConvertSavesFromPeace.Enable(false); ConvertSavesFromPeace.Enable(false);
} }
@@ -160,7 +149,7 @@ public class GamePatch : PatchImpl<GamePatch>
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPriority(Priority.First)] [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) public static void GameConfig_gameSaveFolder_Postfix(ref string __result)
{ {
if (!ProfileBasedSaveFolderEnabled.Value || string.IsNullOrEmpty(WindowFunctions.ProfileName)) return; if (!ProfileBasedSaveFolderEnabled.Value || string.IsNullOrEmpty(WindowFunctions.ProfileName)) return;
@@ -298,14 +287,14 @@ public class GamePatch : PatchImpl<GamePatch>
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);
var label1 = generator.DefineLabel(); var label1 = generator.DefineLabel();
matcher.MatchForward(false, 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); ).Advance(1).Labels.Add(label1);
matcher.Start().Insert( matcher.Start().Insert(
Transpilers.EmitDelegate(() => Transpilers.EmitDelegate(() =>
_gameOption.fullscreen == DSPGame.globalOption.fullscreen && _gameOption.displayMode != EOptionDisplayMode.Windowed &&
_gameOption.resolution.width == DSPGame.globalOption.resolution.width && _gameOption.resolution.width == DSPGame.globalOption.resolution.width &&
_gameOption.resolution.height == DSPGame.globalOption.resolution.height && _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) new CodeInstruction(OpCodes.Brtrue, label1)
); );
@@ -601,131 +590,4 @@ public class GamePatch : PatchImpl<GamePatch>
return false; return false;
} }
} }
[PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)]
private class MouseCursorScaleUp : PatchImpl<MouseCursorScaleUp>
{
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<CodeInstruction> UICursor_LoadCursors_Transpiler(IEnumerable<CodeInstruction> 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<CodeInstruction> UICursor_set_cursorIndexApply_Transpiler(IEnumerable<CodeInstruction> 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();
}
}
} }

View File

@@ -9,7 +9,6 @@ using UnityEngine.EventSystems;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace UXAssist.Patches; namespace UXAssist.Patches;
@@ -74,14 +73,14 @@ public static class LogisticsPatch
RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value); RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value);
RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value); RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value);
GameLogic.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin; GameLogicProc.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin;
GameLogic.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded; GameLogicProc.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded;
} }
public static void Uninit() public static void Uninit()
{ {
GameLogic.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded; GameLogicProc.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded;
GameLogic.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin; GameLogicProc.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin;
AutoConfigLogistics.Enable(false); AutoConfigLogistics.Enable(false);
AutoConfigLogisticsSetDefaultRemoteLogicToStorage.Enable(false); AutoConfigLogisticsSetDefaultRemoteLogicToStorage.Enable(false);
@@ -842,7 +841,7 @@ public static class LogisticsPatch
var sliderBgPrefab = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Station Window/storage-box-0/slider-bg"); 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"; _tipPrefab.name = "tipPrefab";
Object.Destroy(_tipPrefab.GetComponent<UIVeinDetailNode>()); Object.Destroy(_tipPrefab.GetComponent<UIVeinDetailNode>());
var image = _tipPrefab.GetComponent<Image>(); var image = _tipPrefab.GetComponent<Image>();

View File

@@ -41,29 +41,6 @@ public class PersistPatch : PatchImpl<PersistPatch>
return matcher.InstructionEnumeration(); 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<CodeInstruction> ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable<CodeInstruction> 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 // Bring popup tip window to top layer
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))] [HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]

View File

@@ -5,7 +5,6 @@ using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist.Patches; namespace UXAssist.Patches;
@@ -46,11 +45,11 @@ public static class TechPatch
if (enable) if (enable)
{ {
TryPatchProto(true); TryPatchProto(true);
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
} }
else else
{ {
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
TryPatchProto(false); TryPatchProto(false);
} }
} }
@@ -189,11 +188,11 @@ public static class TechPatch
{ {
if (DSPGame.GameDesc != null) if (DSPGame.GameDesc != null)
TryPatchProto(DSPGame.GameDesc.isPeaceMode); TryPatchProto(DSPGame.GameDesc.isPeaceMode);
GameLogic.OnGameBegin += OnGameBegin; GameLogicProc.OnGameBegin += OnGameBegin;
} }
else else
{ {
GameLogic.OnGameBegin -= OnGameBegin; GameLogicProc.OnGameBegin -= OnGameBegin;
TryPatchProto(false); TryPatchProto(false);
} }
} }

View File

@@ -613,7 +613,7 @@ public abstract class MyWindowManager
/* /*
//_Create -> _Init //_Create -> _Init
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnCreate")] [HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))]
public static void UIGame__OnCreate_Postfix() 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() public static void UIGame__OnFree_Postfix()
{ {
foreach (var win in Windows) foreach (var win in Windows)

View File

@@ -27,7 +27,6 @@ public static class UIConfigWindow
I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗"); I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗");
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)"); 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("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", "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'文件夹中"); 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'文件夹中");
@@ -293,6 +292,7 @@ public static class UIConfigWindow
private static void CreateUI(MyConfigWindow wnd, RectTransform trans) private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
{ {
UnityEngine.UI.Text txt;
_windowTrans = trans; _windowTrans = trans;
wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist"); wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist");
var tab1 = wnd.AddTab(trans, "General"); var tab1 = wnd.AddTab(trans, "General");
@@ -301,9 +301,6 @@ public static class UIConfigWindow
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize"); wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
y += 36f; y += 36f;
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit"); 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; y += 30f;
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism"); wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");

View File

@@ -14,7 +14,6 @@ using UXAssist.Functions;
using UXAssist.Patches; using UXAssist.Patches;
using UXAssist.UI; using UXAssist.UI;
using Util = UXAssist.Common.Util; using Util = UXAssist.Common.Util;
using GameLogic = UXAssist.Common.GameLogic;
namespace UXAssist; namespace UXAssist;
@@ -63,8 +62,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
"Load last window position and size when game starts"); "Load last window position and size when game starts");
GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f), GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f),
"Last window position and size"); "Last window position and size");
GamePatch.MouseCursorScaleUpMultiplier = Config.Bind("Game", "MouseCursorScaleUpMultiplier", 1,
"Mouse cursor scale up multiplier");
GamePatch.ProfileBasedSaveFolderEnabled = Config.Bind("Game", "ProfileBasedSaveFolder", false, GamePatch.ProfileBasedSaveFolderEnabled = Config.Bind("Game", "ProfileBasedSaveFolder", false,
"Profile-based save folder"); "Profile-based save folder");
GamePatch.ProfileBasedOptionEnabled = Config.Bind("Game", "ProfileBasedOption", false, GamePatch.ProfileBasedOptionEnabled = Config.Bind("Game", "ProfileBasedOption", false,
@@ -208,7 +205,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置"); I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置");
// UI Patches // UI Patches
GameLogic.Enable(true); GameLogicProc.Enable(true);
UIConfigWindow.Init(); UIConfigWindow.Init();
@@ -238,7 +235,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
UIPatch.Enable(false); UIPatch.Enable(false);
MyWindowManager.Enable(false); MyWindowManager.Enable(false);
GameLogic.Enable(false); GameLogicProc.Enable(false);
} }
private void Update() private void Update()

View File

@@ -15,13 +15,12 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" /> <PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" /> <PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> <!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.6.5" /> <PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.6.5" />
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" /> <PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
</ItemGroup> </ItemGroup>
<!--
<ItemGroup> <ItemGroup>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath> <HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
@@ -30,7 +29,6 @@
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath> <HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
-->
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="assets/signal/energy-fragment.png" /> <EmbeddedResource Include="assets/signal/energy-fragment.png" />

View File

@@ -2,7 +2,6 @@
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UXAssist.Common; using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
namespace UniverseGenTweaks; namespace UniverseGenTweaks;
public static class BirthPlanetPatch public static class BirthPlanetPatch
@@ -75,12 +74,12 @@ public static class BirthPlanetPatch
HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData(); HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData();
PatchBirthThemeData(); PatchBirthThemeData();
_patch ??= Harmony.CreateAndPatchAll(typeof(BirthPlanetPatch)); _patch ??= Harmony.CreateAndPatchAll(typeof(BirthPlanetPatch));
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
} }
public static void Uninit() public static void Uninit()
{ {
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix; GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
_patch?.UnpatchSelf(); _patch?.UnpatchSelf();
_patch = null; _patch = null;
} }

View File

@@ -153,7 +153,7 @@ public static class EpicDifficulty
} }
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameDesc), "get_oilAmountMultiplier")] [HarmonyPatch(typeof(GameDesc), nameof(GameDesc.oilAmountMultiplier), MethodType.Getter)]
private static IEnumerable<CodeInstruction> GameDesc_get_oilAmountMultiplier_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> GameDesc_get_oilAmountMultiplier_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
var matcher = new CodeMatcher(instructions, generator); var matcher = new CodeMatcher(instructions, generator);

View File

@@ -15,8 +15,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" /> <PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" /> <PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> <!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" /> <PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
</ItemGroup> </ItemGroup>
@@ -24,6 +24,15 @@
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" /> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\UXAssist\UXAssist.csproj" /> <ProjectReference Include="..\UXAssist\UXAssist.csproj" />
</ItemGroup> </ItemGroup>