|
- 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<MenuEventArgs> EnterMenu;
-
- public event EventHandler<MenuEventArgs> 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<MyGameDataEntityStruct> mgsevs = entitiesDB.QueryEntities<MyGameDataEntityStruct>(MyGamesScreenExclusiveGroups.MyGames);
- var mgsevsB = mgsevs.ToBuffer().buffer;
- Game[] games = new Game[mgsevs.count];
- for (int i = 0; i < mgsevs.count; i++)
- {
- Utility.Logging.MetaDebugLog($"Found game named {mgsevsB[i].GameName}");
- games[i] = new Game(mgsevsB[i].ID);
- }
- return games;
- }
- }
-
- public struct MenuEventArgs
- {
-
- }
- }
|