forked from mfoltz/Eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCore.cs
67 lines (60 loc) · 2.31 KB
/
Core.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Eclipse.Services;
using ProjectM;
using ProjectM.Physics;
using ProjectM.UI;
using System.Collections;
using Unity.Entities;
using UnityEngine;
namespace Eclipse;
internal class Core
{
static World Client;
public static EntityManager EntityManager => Client.EntityManager;
public static CanvasService CanvasService { get; internal set; }
public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; }
public static ManualLogSource Log => Plugin.LogInstance;
static MonoBehaviour monoBehaviour;
public static bool hasInitialized = false;
public static void Initialize(GameDataManager __instance)
{
if (hasInitialized) return;
Client = __instance.World;
PrefabCollectionSystem = Client.GetExistingSystemManaged<PrefabCollectionSystem>();
/*
foreach (var kvp in Client.m_SystemLookup)
{
Il2CppSystem.Type systemType = kvp.Key;
ComponentSystemBase systemBase = kvp.Value;
if (systemBase.EntityQueries.Length == 0) continue;
Core.Log.LogInfo("=============================");
Core.Log.LogInfo(systemType.FullName);
foreach (EntityQuery query in systemBase.EntityQueries)
{
EntityQueryDesc entityQueryDesc = query.GetEntityQueryDesc();
Core.Log.LogInfo($" All: {string.Join(",", entityQueryDesc.All)}");
Core.Log.LogInfo($" Any: {string.Join(",", entityQueryDesc.Any)}");
Core.Log.LogInfo($" Absent: {string.Join(",", entityQueryDesc.Absent)}");
Core.Log.LogInfo($" None: {string.Join(",", entityQueryDesc.None)}");
}
Core.Log.LogInfo("=============================");
}
*/
hasInitialized = true;
}
public static void SetCanvas(UICanvasBase canvas)
{
CanvasService = new(canvas);
}
public static void StartCoroutine(IEnumerator routine)
{
if (monoBehaviour == null)
{
var go = new GameObject("Eclipse");
monoBehaviour = go.AddComponent<IgnorePhysicsDebugSystem>();
UnityEngine.Object.DontDestroyOnLoad(go);
}
monoBehaviour.StartCoroutine(routine.WrapToIl2Cpp());
}
}