2019-12-16 00:35:59 +00:00
|
|
|
|
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)
|
|
|
|
|
{
|
2019-12-17 01:55:52 +00:00
|
|
|
|
Logging.MetaDebugLog($"Registering Menu IApiEngine {_menuEngines[key].Name}");
|
2019-12-16 00:35:59 +00:00
|
|
|
|
enginesRoot.AddEngine(_menuEngines[key]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|