mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-14 15:46:36 +08:00
refactored icalls using icall helper
This commit is contained in:
@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Explorer.Helpers;
|
||||
using UnhollowerBaseLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
@ -12,28 +13,29 @@ namespace Explorer.Unstrip.Scenes
|
||||
public class SceneUnstrip
|
||||
{
|
||||
//Scene.GetRootGameObjects();
|
||||
|
||||
internal delegate void d_GetRootGameObjects(int handle, IntPtr list);
|
||||
|
||||
public static GameObject[] GetRootGameObjects(Scene scene)
|
||||
{
|
||||
var list = new Il2CppSystem.Collections.Generic.List<GameObject>(GetRootCount_Internal(scene));
|
||||
var list = new Il2CppSystem.Collections.Generic.List<GameObject>(GetRootCount(scene));
|
||||
|
||||
GetRootGameObjectsInternal_iCall(scene.handle, list.Pointer);
|
||||
var iCall = ICallHelper.GetICall<d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
|
||||
|
||||
iCall.Invoke(scene.handle, list.Pointer);
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
internal delegate void GetRootGameObjectsInternal_delegate(int handle, IntPtr list);
|
||||
internal static GetRootGameObjectsInternal_delegate GetRootGameObjectsInternal_iCall =
|
||||
IL2CPP.ResolveICall<GetRootGameObjectsInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");
|
||||
|
||||
//Scene.rootCount;
|
||||
public static int GetRootCount_Internal(Scene scene)
|
||||
{
|
||||
return GetRootCountInternal_iCall(scene.handle);
|
||||
}
|
||||
|
||||
internal delegate int GetRootCountInternal_delegate(int handle);
|
||||
internal static GetRootCountInternal_delegate GetRootCountInternal_iCall =
|
||||
IL2CPP.ResolveICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
|
||||
|
||||
public static int GetRootCount(Scene scene)
|
||||
{
|
||||
var iCall = ICallHelper.GetICall<GetRootCountInternal_delegate>("UnityEngine.SceneManagement.Scene::GetRootCountInternal");
|
||||
return iCall.Invoke(scene.handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user