Browse Source

Fix CommandPatch properly

tags/v0.1.3.0
NGnius 4 years ago
parent
commit
bc3dc81338
2 changed files with 4 additions and 7 deletions
  1. +4
    -5
      GamecraftModdingAPI/Commands/CommandPatch.cs
  2. +0
    -2
      GamecraftModdingAPI/Events/GameActivatedPatch.cs

+ 4
- 5
GamecraftModdingAPI/Commands/CommandPatch.cs View File

@@ -21,22 +21,21 @@ namespace GamecraftModdingAPI.Commands
/// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>()
/// </summary>
// TODO: fix
//[HarmonyPatch]
[HarmonyPatch]
//[HarmonyPatch(typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot))]
//[HarmonyPatch("Compose")]
//[HarmonyPatch("Compose", new Type[] { typeof(UnityContext<FullGameCompositionRoot>), typeof(EnginesRoot), typeof(World), typeof(Action), typeof(MultiplayerInitParameters), typeof(StateSyncRegistrationHelper)})]
static class CommandPatch
{
public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, StateSyncRegistrationHelper stateSyncReg)
public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, ref StateSyncRegistrationHelper stateSyncReg)
{
Logging.MetaDebugLog("Command Line was loaded");
// When a game is loaded, register the command engines
CommandManager.RegisterEngines(enginesRoot);
}

public static MethodBase TargetMethod(HarmonyInstance instance)
{
return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));

return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
//return func.Method;
}
}


+ 0
- 2
GamecraftModdingAPI/Events/GameActivatedPatch.cs View File

@@ -22,8 +22,6 @@ namespace GamecraftModdingAPI.Events
{
// register custom game engines
GameEngineManager.RegisterEngines(____mainGameEnginesRoot);
// register custom command engines
GamecraftModdingAPI.Commands.CommandManager.RegisterEngines(____mainGameEnginesRoot);
// A new EnginesRoot is always created when ActivateGame is called
// so all event emitters and handlers must be re-registered.
EventManager.RegisterEngines(____mainGameEnginesRoot);


Loading…
Cancel
Save