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.

63 lines
1.3KB

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