using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DataLoader; using HarmonyLib; using RobocraftX; using RobocraftX.Common.Utilities; using RobocraftX.GUI; using RobocraftX.Multiplayer; using RobocraftX.Rendering; using Svelto.Context; using Svelto.ECS; using Svelto.ECS.Schedulers.Unity; using UnityEngine; using Unity.Entities; using Unity.Physics.Systems; namespace GamecraftModdingAPI.Utility { /// <summary> /// Public access to the private variables in RobocraftX.FullGameCompositionRoot /// </summary> public static class FullGameFields { public static FullGameCompositionRoot Instance { private set; get; } = null; public static MultiplayerInitParameters _multiplayerParams { get { return (MultiplayerInitParameters)fgcr?.Field("_multiplayerParams").GetValue(); } } public static EnginesRoot _frontEndEnginesRoot { get { return (EnginesRoot)fgcr?.Field("_frontEndEnginesRoot").GetValue(); } } public static EnginesRoot _mainGameEnginesRoot { get { return (EnginesRoot)fgcr?.Field("_mainGameEnginesRoot").GetValue(); } } public static World _physicsWorld { get { return (World)fgcr?.Field("_physicsWorld").GetValue(); } } public static World _renderingWorld { get { return (World)fgcr?.Field("_renderingWorld").GetValue(); } } public static SimpleEntitiesSubmissionScheduler _mainGameSubmissionScheduler { get { return (SimpleEntitiesSubmissionScheduler)fgcr?.Field("_sub").Field("_mainGameSubmissionScheduler").GetValue(); } } public static BuildPhysicsWorld _physicsWorldSystem { get { return (BuildPhysicsWorld)fgcr?.Field("_physicsWorldSystem").GetValue(); } } public static UnityContext<FullGameCompositionRoot> _contextHolder { get { return (UnityContext<FullGameCompositionRoot>)fgcr?.Field("_contextHolder").GetValue(); } } public static GameObject _frontEndGo { get { return (GameObject)fgcr?.Field("_frontEndGo").GetValue(); } } public static GameObject _mainGameGo { get { return (GameObject)fgcr?.Field("_mainGameGo").GetValue(); } } public static PhysicsUtility _physicsUtility { get { return (PhysicsUtility)fgcr?.Field("_physicsUtility").GetValue(); } } /*public static UnityEntitySubmissionScheduler _frontEndSubmissionScheduler { get { return (UnityEntitySubmissionScheduler)fgcr?.Field("_frontEndSubmissionScheduler").GetValue(); } }*/ public static LoadingScreenImplementer _loadingScreen { get { return (LoadingScreenImplementer)fgcr?.Field("_loadingScreen").GetValue(); } } public static IDataDB _dataDb { get { return (IDataDB)fgcr?.Field("_dataDb").GetValue(); } } public static ECSGameObjectResourceManager _eCsGameObjectResourceManager { get { return (ECSGameObjectResourceManager)fgcr?.Field("_eCsGameObjectResourceManager").GetValue(); } } public static bool _isQuitting { get { return (bool)fgcr?.Field("_isQuitting").GetValue(); } } private static Traverse fgcr; public static void Init(FullGameCompositionRoot instance) { fgcr = new Traverse(instance); FullGameFields.Instance = instance; } } }