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.

180 lines
3.5KB

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