|
|
@@ -6,6 +6,8 @@ using System.Threading.Tasks; |
|
|
|
|
|
|
|
using Svelto.ECS; |
|
|
|
|
|
|
|
using GamecraftModdingAPI.Engines; |
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.Utility |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
@@ -24,6 +26,10 @@ namespace GamecraftModdingAPI.Utility |
|
|
|
{ |
|
|
|
Logging.MetaDebugLog($"Registering Game IApiEngine {engine.Name}"); |
|
|
|
_lastEngineRoot.AddEngine(engine); |
|
|
|
if (typeof(IFactoryEngine).IsAssignableFrom(engine.GetType())) |
|
|
|
{ |
|
|
|
((IFactoryEngine)engine).Factory = _lastEngineRoot.GenerateEntityFactory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -49,16 +55,24 @@ namespace GamecraftModdingAPI.Utility |
|
|
|
|
|
|
|
public static void RemoveGameEngine(string name) |
|
|
|
{ |
|
|
|
_gameEngines.Remove(name); |
|
|
|
if (_gameEngines[name].isRemovable) |
|
|
|
{ |
|
|
|
_gameEngines.Remove(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void RegisterEngines(EnginesRoot enginesRoot) |
|
|
|
{ |
|
|
|
_lastEngineRoot = enginesRoot; |
|
|
|
IEntityFactory factory = enginesRoot.GenerateEntityFactory(); |
|
|
|
foreach (var key in _gameEngines.Keys) |
|
|
|
{ |
|
|
|
Logging.MetaDebugLog($"Registering Game IApiEngine {_gameEngines[key].Name}"); |
|
|
|
enginesRoot.AddEngine(_gameEngines[key]); |
|
|
|
if (typeof(IFactoryEngine).IsAssignableFrom(_gameEngines[key].GetType())) |
|
|
|
{ |
|
|
|
((IFactoryEngine)_gameEngines[key]).Factory = factory; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|