TechbloxModdingAPI/GamecraftModdingAPI/Commands/CommandPatch.cs

38 lines
1.3 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;
using Harmony;
using Svelto.Context;
using Svelto.ECS;
using RobocraftX;
using RobocraftX.Multiplayer;
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-14 04:42:55 +00:00
[HarmonyPatch]
2019-12-14 18:52:24 +00:00
public static class CommandPatch
2019-12-14 04:42:55 +00:00
{
2019-12-15 07:20:20 +00:00
public static void Postfix(UnityContext<FullGameCompositionRoot> contextHolder, EnginesRoot enginesRoot, World physicsWorld, Action reloadGame, MultiplayerInitParameters multiplayerParameters)
2019-12-14 04:42:55 +00:00
{
2019-12-15 07:20:20 +00:00
Logging.MetaDebugLog("Command Line was loaded");
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)
{
var func = (Action<UnityContext<FullGameCompositionRoot>, EnginesRoot, World, Action, MultiplayerInitParameters>)RobocraftX.GUI.CommandLine.CommandLineCompositionRoot.Compose<UnityContext<FullGameCompositionRoot>>;
return func.Method;
}
}
}