29 lines
924 B
C#
29 lines
924 B
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
|
|
{
|
|
/// <summary>
|
|
/// Patch of RobocraftX.FullGameCompositionRoot.ActivateGame()
|
|
/// </summary>
|
|
[HarmonyPatch(typeof(FullGameCompositionRoot), "ActivateGame")]
|
|
class GameActivatedPatch
|
|
{
|
|
public static void Postfix(ref EnginesRoot ____mainGameEnginesRoot)
|
|
{
|
|
// A new EnginesRoot is always created when ActivateGame is called
|
|
// so all event emitters and handlers must be re-registered.
|
|
Manager.RegisterEngines(____mainGameEnginesRoot);
|
|
Logging.Log("Dispatching Game Activated event");
|
|
Manager.GetEventEmitter("GamecraftModdingAPIGameActivatedEventEmitter").Emit();
|
|
}
|
|
}
|
|
}
|