diff --git a/.gitignore b/.gitignore index 398058a..9109fcc 100755 --- a/.gitignore +++ b/.gitignore @@ -332,3 +332,9 @@ ASALocalRun/ SpeedrunTool/lib-stripped/* /SpeedrunTool.sln.DotSettings + +SpeedrunTool.dll +Dialog +Graphics +everest.yaml +toZip.cmd \ No newline at end of file diff --git a/SpeedrunTool/Source/SaveLoad/SaveLoadAction.cs b/SpeedrunTool/Source/SaveLoad/SaveLoadAction.cs index ed6da43..dbe748a 100644 --- a/SpeedrunTool/Source/SaveLoad/SaveLoadAction.cs +++ b/SpeedrunTool/Source/SaveLoad/SaveLoadAction.cs @@ -1,4 +1,4 @@ -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -197,7 +197,8 @@ public static void InitActions() { FixSaveLoadIcon(); BetterCasualPlay(); SupportExternalMember(); - SupportCalcRandom(); + SupportCalcRandom(); + SupportSettings(); SupportMInput(); SupportInput(); SupportAudioMusic(); @@ -222,6 +223,15 @@ public static void InitActions() { // 放最后,确保收集了所有克隆的 VirtualAssets 与 EventInstance ReloadVirtualAssets(); ReleaseEventInstances(); + } + + internal static void LogSavedValues() { + foreach (SaveLoadAction slAction in All) { + Logger.Log("SRT", "================="); + foreach (KeyValuePair> pair in slAction.savedValues) { + Logger.Log("SRT", pair.Key.FullName); + } + } } private static void InitFields() { @@ -454,6 +464,24 @@ private static void SupportCalcRandom() { (savedValues, _) => SaveStaticMemberValues(savedValues, typeof(Calc), nameof(Calc.Random), nameof(Calc.randomStack)), (savedValues, _) => LoadStaticMemberValues(savedValues)); + } + + private static void SupportSettings() { + SafeAdd( + (savedValues, _) => { + if (Settings.Instance is { } settings) { + Dictionary dict = new(); + dict["GrabMode"] = settings.GrabMode; + savedValues[typeof(Settings)] = dict; + } + }, + (savedValues, _) => { + if (Settings.Instance is { } settings && savedValues.TryGetValue(typeof(Settings), out Dictionary dict)) { + settings.GrabMode = (GrabModes)dict["GrabMode"]; + + } + } + ); } private static void SupportMInput() { @@ -479,7 +507,10 @@ private static void SupportInput() { foreach (FieldInfo fieldInfo in typeof(Input).GetFields(BindingFlags.Public | BindingFlags.Static).Where(info => info.FieldType.IsSameOrSubclassOf(typeof(VirtualInput)))) { inputDict[fieldInfo.Name] = fieldInfo.GetValue(null); - } + } + + inputDict["grabToggle"] = Input.grabToggle; + inputDict["LastAim"] = Input.LastAim; savedValues[inputType] = inputDict.DeepCloneShared(); @@ -524,16 +555,23 @@ private static void SupportInput() { if (StateManager.Instance.LoadByTas) { inputType.SetFieldValue(fieldName, virtualInput); - } else { - object fieldValue = inputType.GetFieldValue(fieldName); - - if (fieldValue is VirtualJoystick virtualJoystick && - virtualInput is VirtualJoystick savedVirtualJoystick) { - virtualJoystick.InvertedX = savedVirtualJoystick.InvertedX; - virtualJoystick.InvertedY = savedVirtualJoystick.InvertedY; - } else if (fieldValue is VirtualIntegerAxis virtualIntegerAxis && - virtualInput is VirtualIntegerAxis savedVirtualIntegerAxis) { - virtualIntegerAxis.Inverted = savedVirtualIntegerAxis.Inverted; + } else { + if (fieldName == "grabToggle") { + Input.grabToggle = (bool)virtualInput; + } + else if (fieldName == "LastAim") { + Input.LastAim = (Vector2)virtualInput; + } + else { + object fieldValue = inputType.GetFieldValue(fieldName); + if (fieldValue is VirtualJoystick virtualJoystick && + virtualInput is VirtualJoystick savedVirtualJoystick) { + virtualJoystick.InvertedX = savedVirtualJoystick.InvertedX; + virtualJoystick.InvertedY = savedVirtualJoystick.InvertedY; + } else if (fieldValue is VirtualIntegerAxis virtualIntegerAxis && + virtualInput is VirtualIntegerAxis savedVirtualIntegerAxis) { + virtualIntegerAxis.Inverted = savedVirtualIntegerAxis.Inverted; + } } } } diff --git a/SpeedrunTool/Source/SaveLoad/StateManager.cs b/SpeedrunTool/Source/SaveLoad/StateManager.cs index 0bd756e..b9a3e5d 100644 --- a/SpeedrunTool/Source/SaveLoad/StateManager.cs +++ b/SpeedrunTool/Source/SaveLoad/StateManager.cs @@ -321,6 +321,8 @@ private bool SaveState(bool tas) { level.Add(new WaitingEntity()); } } + + // SaveLoadAction.LogSavedValues(); return true; } diff --git a/SpeedrunTool/Source/SpeedrunToolModule.cs b/SpeedrunTool/Source/SpeedrunToolModule.cs index b026616..ce6aac4 100644 --- a/SpeedrunTool/Source/SpeedrunToolModule.cs +++ b/SpeedrunTool/Source/SpeedrunToolModule.cs @@ -1,4 +1,4 @@ -using Celeste.Mod.SpeedrunTool.SaveLoad; +using Celeste.Mod.SpeedrunTool.SaveLoad; using FMOD.Studio; namespace Celeste.Mod.SpeedrunTool; diff --git a/SpeedrunTool/SpeedrunTool.csproj b/SpeedrunTool/SpeedrunTool.csproj index 0178dbb..a1c4e8f 100755 --- a/SpeedrunTool/SpeedrunTool.csproj +++ b/SpeedrunTool/SpeedrunTool.csproj @@ -1,4 +1,4 @@ - + {C7DFDD37-907C-4A75-96DA-1C5828C97F96} Celeste.Mod.SpeedrunTool @@ -83,5 +83,22 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpeedrunTool/everest.yaml b/SpeedrunTool/everest.yaml index a8697f1..b531770 100755 --- a/SpeedrunTool/everest.yaml +++ b/SpeedrunTool/everest.yaml @@ -1,6 +1,6 @@ - Name: SpeedrunTool - Version: 3.22.11 + Version: 3.23.0 DLL: SpeedrunTool.dll Dependencies: - Name: Everest - Version: 1.2374.0 \ No newline at end of file + Version: 1.5105.0 \ No newline at end of file