mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
Improve Il2Cpp Coroutine support, make universal ExplorerBehaviour class
This commit is contained in:
@ -57,53 +57,23 @@ namespace UnityExplorer
|
||||
{
|
||||
Instance = this;
|
||||
_configHandler = new BepInExConfigHandler();
|
||||
ExplorerCore.Init(this);
|
||||
}
|
||||
|
||||
#if MONO // Mono-specific
|
||||
#if MONO // Mono
|
||||
internal void Awake()
|
||||
{
|
||||
UniversalInit();
|
||||
ExplorerCore.Init(this);
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
ExplorerCore.Update();
|
||||
}
|
||||
|
||||
#else // Il2Cpp-specific
|
||||
#else // Il2Cpp
|
||||
public override void Load()
|
||||
{
|
||||
UniversalInit();
|
||||
|
||||
ClassInjector.RegisterTypeInIl2Cpp<ExplorerBehaviour>();
|
||||
|
||||
var obj = new GameObject("ExplorerBehaviour");
|
||||
obj.AddComponent<ExplorerBehaviour>();
|
||||
obj.hideFlags = HideFlags.HideAndDontSave;
|
||||
GameObject.DontDestroyOnLoad(obj);
|
||||
|
||||
ExplorerCore.Init(this);
|
||||
}
|
||||
|
||||
// BepInEx Il2Cpp mod class doesn't have monobehaviour methods yet, so wrap them in a dummy.
|
||||
public class ExplorerBehaviour : MonoBehaviour
|
||||
{
|
||||
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
|
||||
|
||||
internal void Awake()
|
||||
{
|
||||
Instance.LogSource.LogMessage("ExplorerBehaviour.Awake");
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
ExplorerCore.Update();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public void SetupPatches()
|
||||
public void SetupCursorPatches()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -17,6 +17,6 @@ namespace UnityExplorer
|
||||
Action<object> OnLogWarning { get; }
|
||||
Action<object> OnLogError { get; }
|
||||
|
||||
void SetupPatches();
|
||||
void SetupCursorPatches();
|
||||
}
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ namespace UnityExplorer
|
||||
ExplorerCore.Init(this);
|
||||
}
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
ExplorerCore.Update();
|
||||
}
|
||||
//public override void OnUpdate()
|
||||
//{
|
||||
// ExplorerCore.Update();
|
||||
//}
|
||||
|
||||
public void SetupPatches()
|
||||
public void SetupCursorPatches()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -87,30 +87,10 @@ namespace UnityExplorer
|
||||
Instance = this;
|
||||
_configHandler = new StandaloneConfigHandler();
|
||||
|
||||
#if CPP
|
||||
ClassInjector.RegisterTypeInIl2Cpp<ExplorerBehaviour>();
|
||||
#endif
|
||||
var obj = new GameObject("ExplorerBehaviour");
|
||||
obj.AddComponent<ExplorerBehaviour>();
|
||||
|
||||
GameObject.DontDestroyOnLoad(obj);
|
||||
obj.hideFlags = HideFlags.HideAndDontSave;
|
||||
|
||||
ExplorerCore.Init(this);
|
||||
}
|
||||
|
||||
public class ExplorerBehaviour : MonoBehaviour
|
||||
{
|
||||
#if CPP
|
||||
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
|
||||
#endif
|
||||
internal void Update()
|
||||
{
|
||||
ExplorerCore.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupPatches()
|
||||
public void SetupCursorPatches()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user