A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.3KB

  1. using System;
  2. using RobocraftX.GUI.MyGamesScreen;
  3. using RobocraftX.GUI;
  4. using Svelto.ECS;
  5. using GamecraftModdingAPI.Engines;
  6. using GamecraftModdingAPI.Utility;
  7. namespace GamecraftModdingAPI.App
  8. {
  9. public class AppEngine : IFactoryEngine
  10. {
  11. public event EventHandler<MenuEventArgs> EnterMenu;
  12. public event EventHandler<MenuEventArgs> ExitMenu;
  13. public IEntityFactory Factory { set; private get; }
  14. public string Name => "GamecraftModdingAPIAppEngine";
  15. public bool isRemovable => false;
  16. public EntitiesDB entitiesDB { set; private get; }
  17. public void Dispose()
  18. {
  19. IsInMenu = false;
  20. ExceptionUtil.InvokeEvent(ExitMenu, this, new MenuEventArgs { });
  21. }
  22. public void Ready()
  23. {
  24. IsInMenu = true;
  25. ExceptionUtil.InvokeEvent(EnterMenu, this, new MenuEventArgs { });
  26. }
  27. // app functionality
  28. public bool IsInMenu
  29. {
  30. get;
  31. private set;
  32. } = false;
  33. public Game[] GetMyGames()
  34. {
  35. EntityCollection<MyGameDataEntityStruct> mgsevs = entitiesDB.QueryEntities<MyGameDataEntityStruct>(MyGamesScreenExclusiveGroups.MyGames);
  36. Game[] games = new Game[mgsevs.count];
  37. for (int i = 0; i < mgsevs.count; i++)
  38. {
  39. Utility.Logging.MetaDebugLog($"Found game named {mgsevs[i].GameName}");
  40. games[i] = new Game(mgsevs[i].ID);
  41. }
  42. return games;
  43. }
  44. }
  45. public struct MenuEventArgs
  46. {
  47. }
  48. }