Implement KickstartSpeedrunData
This commit is contained in:
parent
28ed7c9ac8
commit
17a2fd1760
1 changed files with 19 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace Sandbox
|
namespace Sandbox
|
||||||
|
@ -20,7 +22,24 @@ namespace Sandbox
|
||||||
new Harmony("com.thearst3rd.sandbox").PatchAll();
|
new Harmony("com.thearst3rd.sandbox").PatchAll();
|
||||||
IsPatched = true;
|
IsPatched = true;
|
||||||
SceneManager.sceneLoaded -= beginPatch;
|
SceneManager.sceneLoaded -= beginPatch;
|
||||||
}
|
|
||||||
|
KickstartSpeedrunData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void KickstartSpeedrunData()
|
||||||
|
{
|
||||||
|
// Kickstart SpeedrunData using reflection shenanigans
|
||||||
|
// We want to run the following code:
|
||||||
|
//SpeedrunData.SetValue(0, -1, -1);
|
||||||
|
|
||||||
|
Assembly miuuAsm = typeof(MarbleController).Assembly;
|
||||||
|
Type speedrunDataType = miuuAsm.GetType("SpeedrunData");
|
||||||
|
MethodInfo speedrunDataSetValueMethod = speedrunDataType.GetMethod("SetValue", BindingFlags.Public | BindingFlags.Static);
|
||||||
|
|
||||||
|
speedrunDataSetValueMethod.Invoke(null, new object[] { 0, -1, -1 });
|
||||||
|
|
||||||
|
Debug.Log("SpeedrunData kickstarted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue