54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
using Svelto.ECS;
|
|||
|
|
|||
|
namespace GamecraftModdingAPI.Utility
|
|||
|
{
|
|||
|
public static class GameEngineManager
|
|||
|
{
|
|||
|
private static Dictionary<string, IApiEngine> _gameEngines = new Dictionary<string, IApiEngine>();
|
|||
|
|
|||
|
public static void AddGameEngine(IApiEngine engine)
|
|||
|
{
|
|||
|
_gameEngines[engine.Name] = engine;
|
|||
|
}
|
|||
|
|
|||
|
public static bool ExistsGameEngine(string name)
|
|||
|
{
|
|||
|
return _gameEngines.ContainsKey(name);
|
|||
|
}
|
|||
|
|
|||
|
public static bool ExistsGameEngine(IApiEngine engine)
|
|||
|
{
|
|||
|
return ExistsGameEngine(engine.Name);
|
|||
|
}
|
|||
|
|
|||
|
public static IApiEngine GetGameEngine(string name)
|
|||
|
{
|
|||
|
return _gameEngines[name];
|
|||
|
}
|
|||
|
|
|||
|
public static string[] GetGameEngineNames()
|
|||
|
{
|
|||
|
return _gameEngines.Keys.ToArray();
|
|||
|
}
|
|||
|
|
|||
|
public static void RemoveGameEngine(string name)
|
|||
|
{
|
|||
|
_gameEngines.Remove(name);
|
|||
|
}
|
|||
|
|
|||
|
public static void RegisterEngines(EnginesRoot enginesRoot)
|
|||
|
{
|
|||
|
foreach (var key in _gameEngines.Keys)
|
|||
|
{
|
|||
|
enginesRoot.AddEngine(_gameEngines[key]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|