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.

AppEngine.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. var mgsevsB = mgsevs.ToBuffer().buffer;
  37. Game[] games = new Game[mgsevs.count];
  38. for (int i = 0; i < mgsevs.count; i++)
  39. {
  40. Utility.Logging.MetaDebugLog($"Found game named {mgsevsB[i].GameName}");
  41. games[i] = new Game(mgsevsB[i].ID);
  42. }
  43. return games;
  44. }
  45. }
  46. public struct MenuEventArgs
  47. {
  48. }
  49. }