using System; using RobocraftX.GUI.MyGamesScreen; using RobocraftX.GUI; using Svelto.ECS; using GamecraftModdingAPI.Engines; using GamecraftModdingAPI.Utility; namespace GamecraftModdingAPI.App { public class AppEngine : IFactoryEngine { public event EventHandler EnterMenu; public event EventHandler ExitMenu; public IEntityFactory Factory { set; private get; } public string Name => "GamecraftModdingAPIAppEngine"; public bool isRemovable => false; public EntitiesDB entitiesDB { set; private get; } public void Dispose() { IsInMenu = false; ExceptionUtil.InvokeEvent(ExitMenu, this, new MenuEventArgs { }); } public void Ready() { IsInMenu = true; ExceptionUtil.InvokeEvent(EnterMenu, this, new MenuEventArgs { }); } // app functionality public bool IsInMenu { get; private set; } = false; public Game[] GetMyGames() { EntityCollection mgsevs = entitiesDB.QueryEntities(MyGamesScreenExclusiveGroups.MyGames); Game[] games = new Game[mgsevs.count]; for (int i = 0; i < mgsevs.count; i++) { Utility.Logging.MetaDebugLog($"Found game named {mgsevs[i].GameName}"); games[i] = new Game(mgsevs[i].ID); } return games; } } public struct MenuEventArgs { } }