57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Svelto.ECS;
|
|
|
|
namespace GamecraftModdingAPI.Utility
|
|
{
|
|
/// <summary>
|
|
/// Keeps track of custom menu-modifying engines
|
|
/// </summary>
|
|
public static class MenuEngineManager
|
|
{
|
|
private static Dictionary<string, IApiEngine> _menuEngines = new Dictionary<string, IApiEngine>();
|
|
|
|
// menu engine management
|
|
public static void AddMenuEngine(IApiEngine engine)
|
|
{
|
|
_menuEngines[engine.Name] = engine;
|
|
}
|
|
|
|
public static bool ExistsMenuEngine(string name)
|
|
{
|
|
return _menuEngines.ContainsKey(name);
|
|
}
|
|
|
|
public static bool ExistsMenuEngine(IApiEngine engine)
|
|
{
|
|
return ExistsMenuEngine(engine.Name);
|
|
}
|
|
|
|
public static IApiEngine GetMenuEngine(string name)
|
|
{
|
|
return _menuEngines[name];
|
|
}
|
|
|
|
public static string[] GetMenuEngineNames()
|
|
{
|
|
return _menuEngines.Keys.ToArray();
|
|
}
|
|
|
|
public static void RemoveMenuEngine(string name)
|
|
{
|
|
_menuEngines.Remove(name);
|
|
}
|
|
|
|
public static void RegisterEngines(EnginesRoot enginesRoot)
|
|
{
|
|
foreach (var key in _menuEngines.Keys)
|
|
{
|
|
enginesRoot.AddEngine(_menuEngines[key]);
|
|
}
|
|
}
|
|
}
|
|
}
|