TechbloxModdingAPI/GamecraftModdingAPI/Commands/CommandPatch.cs

43 lines
1.5 KiB
C#
Raw Normal View History

2019-12-14 04:42:55 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
2019-12-14 04:42:55 +00:00
using Harmony;
using Svelto.Context;
using Svelto.ECS;
using RobocraftX;
using RobocraftX.Multiplayer;
using RobocraftX.StateSync;
2019-12-14 04:42:55 +00:00
using Unity.Entities;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Commands
{
2019-12-15 07:20:20 +00:00
/// <summary>
/// Patch of RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<T>()
/// </summary>
// TODO: fix
2020-01-26 18:49:51 +00:00
[HarmonyPatch]
//[HarmonyPatch(typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot))]
2020-01-26 18:49:51 +00:00
//[HarmonyPatch("Compose")]
//[HarmonyPatch("Compose", new Type[] { typeof(UnityContext<FullGameCompositionRoot>), typeof(EnginesRoot), typeof(World), typeof(Action), typeof(MultiplayerInitParameters), typeof(StateSyncRegistrationHelper)})]
2019-12-19 20:42:50 +00:00
static class CommandPatch
2019-12-14 04:42:55 +00:00
{
2020-01-26 18:49:51 +00:00
public static void Postfix(object contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters, ref StateSyncRegistrationHelper stateSyncReg)
2019-12-14 04:42:55 +00:00
{
// When a game is loaded, register the command engines
2019-12-15 07:20:20 +00:00
CommandManager.RegisterEngines(enginesRoot);
2019-12-14 04:42:55 +00:00
}
public static MethodBase TargetMethod(HarmonyInstance instance)
{
2020-01-26 18:49:51 +00:00
return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
//return func.Method;
2019-12-14 04:42:55 +00:00
}
}
}