34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Harmony;
|
|
using RobocraftX;
|
|
using Svelto.ECS;
|
|
|
|
using GamecraftModdingAPI.Utility;
|
|
|
|
namespace GamecraftModdingAPI.Events
|
|
{
|
|
[HarmonyPatch(typeof(FullGameCompositionRoot), "ActivateMenu")]
|
|
class GameInitPatch
|
|
{
|
|
|
|
private static bool firstLoad = true;
|
|
public static void Postfix(ref EnginesRoot ____frontEndEnginesRoot)
|
|
{
|
|
// A new EnginesRoot is always created when ActivateMenu is called
|
|
// so all event emitters and handlers must be re-registered.
|
|
Manager.RegisterEngines(____frontEndEnginesRoot);
|
|
if (firstLoad)
|
|
{
|
|
firstLoad = false;
|
|
Logging.Log("Dispatching App Init event");
|
|
Manager.GetEventEmitter("GamecraftModdingAPIApplicationInitializedEventEmitter").Emit();
|
|
}
|
|
Logging.Log("Dispatching Menu Activated event");
|
|
Manager.GetEventEmitter("GamecraftModdingAPIMenuActivatedEventEmitter").Emit();
|
|
}
|
|
}
|
|
}
|