|
|
@@ -1,7 +1,6 @@ |
|
|
|
using System; |
|
|
|
using IllusionPlugin; |
|
|
|
using UnityEngine; |
|
|
|
using uREPL; |
|
|
|
using Harmony; |
|
|
|
using System.Reflection; |
|
|
|
|
|
|
@@ -17,27 +16,22 @@ namespace TestMod |
|
|
|
|
|
|
|
public string Version { get; } = "v0.0.0a"; |
|
|
|
|
|
|
|
public string HarmonyID { get; } = "org.git.exmods.base.testmod.testplugin"; |
|
|
|
|
|
|
|
public void OnApplicationQuit() |
|
|
|
{ |
|
|
|
//throw new NotImplementedException(); |
|
|
|
harmony.UnpatchAll(HarmonyID); |
|
|
|
Debug.Log("TestPlugin shutdown complete"); |
|
|
|
} |
|
|
|
|
|
|
|
public void OnApplicationStart() |
|
|
|
{ |
|
|
|
Debug.Log("Hello World!"); |
|
|
|
if (harmony == null) |
|
|
|
{ |
|
|
|
harmony = HarmonyInstance.Create("org.git.exmods.gamecraft.testmod.testplugin"); |
|
|
|
harmony = HarmonyInstance.Create(HarmonyID); |
|
|
|
harmony.PatchAll(Assembly.GetExecutingAssembly()); |
|
|
|
} |
|
|
|
MethodInfo commandHelp = Harmony.AccessTools.Method(Harmony.AccessTools.TypeByName("RobocraftX.GUI.CommandLine.CommandLineUtility"), "SaveCommandHelp", new Type[] { typeof(string), typeof(string)}); |
|
|
|
uREPL.RuntimeCommands.Register<string>("Log", LogCommand, "this description is not shown anywhere"); |
|
|
|
commandHelp.Invoke(null, new string[] { "Log", "Write a string to Player.log" }); |
|
|
|
uREPL.RuntimeCommands.Register<string>("Echo", EchoCommand, "this doesn't matter"); |
|
|
|
commandHelp.Invoke(null, new string[] { "Echo", "Write a message to the command line" }); |
|
|
|
uREPL.RuntimeCommands.Register("Exit", QuitCommand, "Close Gamecraft"); |
|
|
|
commandHelp.Invoke(null, new string[] { "Exit", "Forcefully exit Gamecraft immediately" }); |
|
|
|
Debug.Log("TestPlugin startup complete"); |
|
|
|
Debug.Log("TestPlugin start & patch complete"); |
|
|
|
} |
|
|
|
|
|
|
|
public void OnFixedUpdate() |
|
|
@@ -63,23 +57,6 @@ namespace TestMod |
|
|
|
public void OnUpdate() |
|
|
|
{ |
|
|
|
//throw new NotImplementedException(); |
|
|
|
//UnityEngine.Debug.Log("Baby's first mod injection"); |
|
|
|
} |
|
|
|
|
|
|
|
/* Log command method. This called by uREPL when the Log <object> command is called from RCX */ |
|
|
|
private void LogCommand(string msg) |
|
|
|
{ |
|
|
|
Debug.Log(msg); |
|
|
|
} |
|
|
|
|
|
|
|
private void EchoCommand(string msg) |
|
|
|
{ |
|
|
|
uREPL.Log.Output(msg); |
|
|
|
} |
|
|
|
|
|
|
|
private void QuitCommand() |
|
|
|
{ |
|
|
|
UnityEngine.Application.Quit(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |