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.

171 lines
3.3KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using DataLoader;
  7. using HarmonyLib;
  8. using RobocraftX;
  9. using RobocraftX.Common.Utilities;
  10. using RobocraftX.GUI;
  11. using RobocraftX.Multiplayer;
  12. using RobocraftX.Rendering;
  13. using Svelto.Context;
  14. using Svelto.ECS;
  15. using Svelto.ECS.Schedulers.Unity;
  16. using UnityEngine;
  17. using Unity.Entities;
  18. using Unity.Physics.Systems;
  19. namespace GamecraftModdingAPI.Utility
  20. {
  21. /// <summary>
  22. /// Public access to the private variables in RobocraftX.FullGameCompositionRoot
  23. /// </summary>
  24. public static class FullGameFields
  25. {
  26. public static FullGameCompositionRoot Instance
  27. {
  28. private set;
  29. get;
  30. } = null;
  31. public static MultiplayerInitParameters _multiplayerParams
  32. {
  33. get
  34. {
  35. return (MultiplayerInitParameters)fgcr?.Field("_multiplayerParams").GetValue();
  36. }
  37. }
  38. public static EnginesRoot _frontEndEnginesRoot
  39. {
  40. get
  41. {
  42. return (EnginesRoot)fgcr?.Field("_frontEndEnginesRoot").GetValue();
  43. }
  44. }
  45. public static EnginesRoot _mainGameEnginesRoot
  46. {
  47. get
  48. {
  49. return (EnginesRoot)fgcr?.Field("_mainGameEnginesRoot").GetValue();
  50. }
  51. }
  52. public static World _physicsWorld
  53. {
  54. get
  55. {
  56. return (World)fgcr?.Field("_physicsWorld").GetValue();
  57. }
  58. }
  59. public static World _renderingWorld
  60. {
  61. get
  62. {
  63. return (World)fgcr?.Field("_renderingWorld").GetValue();
  64. }
  65. }
  66. public static SimpleEntitiesSubmissionScheduler _mainGameSubmissionScheduler
  67. {
  68. get
  69. {
  70. return (SimpleEntitiesSubmissionScheduler)fgcr?.Field("_sub").Field("_mainGameSubmissionScheduler").GetValue();
  71. }
  72. }
  73. public static BuildPhysicsWorld _physicsWorldSystem
  74. {
  75. get
  76. {
  77. return (BuildPhysicsWorld)fgcr?.Field("_physicsWorldSystem").GetValue();
  78. }
  79. }
  80. public static UnityContext<FullGameCompositionRoot> _contextHolder
  81. {
  82. get
  83. {
  84. return (UnityContext<FullGameCompositionRoot>)fgcr?.Field("_contextHolder").GetValue();
  85. }
  86. }
  87. public static GameObject _frontEndGo
  88. {
  89. get
  90. {
  91. return (GameObject)fgcr?.Field("_frontEndGo").GetValue();
  92. }
  93. }
  94. public static GameObject _mainGameGo
  95. {
  96. get
  97. {
  98. return (GameObject)fgcr?.Field("_mainGameGo").GetValue();
  99. }
  100. }
  101. public static PhysicsUtility _physicsUtility
  102. {
  103. get
  104. {
  105. return (PhysicsUtility)fgcr?.Field("_physicsUtility").GetValue();
  106. }
  107. }
  108. /*public static UnityEntitySubmissionScheduler _frontEndSubmissionScheduler
  109. {
  110. get
  111. {
  112. return (UnityEntitySubmissionScheduler)fgcr?.Field("_frontEndSubmissionScheduler").GetValue();
  113. }
  114. }*/
  115. public static LoadingScreenImplementer _loadingScreen
  116. {
  117. get
  118. {
  119. return (LoadingScreenImplementer)fgcr?.Field("_loadingScreen").GetValue();
  120. }
  121. }
  122. public static IDataDB _dataDb
  123. {
  124. get
  125. {
  126. return (IDataDB)fgcr?.Field("_dataDb").GetValue();
  127. }
  128. }
  129. public static ECSGameObjectResourceManager _eCsGameObjectResourceManager
  130. {
  131. get
  132. {
  133. return (ECSGameObjectResourceManager)fgcr?.Field("_eCsGameObjectResourceManager").GetValue();
  134. }
  135. }
  136. public static bool _isQuitting
  137. {
  138. get
  139. {
  140. return (bool)fgcr?.Field("_isQuitting").GetValue();
  141. }
  142. }
  143. private static Traverse fgcr;
  144. public static void Init(FullGameCompositionRoot instance)
  145. {
  146. fgcr = new Traverse(instance);
  147. FullGameFields.Instance = instance;
  148. }
  149. }
  150. }