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-16 00:35:59 +00:00
|
|
|
|
|
2020-05-03 19:31:09 +00:00
|
|
|
|
using HarmonyLib;
|
2019-12-14 04:42:55 +00:00
|
|
|
|
using Svelto.Context;
|
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
using RobocraftX;
|
|
|
|
|
using RobocraftX.Multiplayer;
|
2019-12-19 16:46:32 +00:00
|
|
|
|
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>
|
2019-12-19 16:46:32 +00:00
|
|
|
|
// TODO: fix
|
2020-01-26 18:49:51 +00:00
|
|
|
|
[HarmonyPatch]
|
2019-12-19 16:46:32 +00:00
|
|
|
|
//[HarmonyPatch(typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot))]
|
2020-01-26 18:49:51 +00:00
|
|
|
|
//[HarmonyPatch("Compose")]
|
2019-12-19 16:46:32 +00:00
|
|
|
|
//[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
|
|
|
|
}
|
|
|
|
|
|
2020-05-03 19:31:09 +00:00
|
|
|
|
public static MethodBase TargetMethod(Harmony instance)
|
2019-12-14 04:42:55 +00:00
|
|
|
|
{
|
2020-01-26 18:49:51 +00:00
|
|
|
|
return typeof(RobocraftX.GUI.CommandLine.CommandLineCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
|
2019-12-19 16:46:32 +00:00
|
|
|
|
//return func.Method;
|
2019-12-14 04:42:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|