mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-15 07:56:41 +08:00
Improved Enumerable and Dictionary enumeration in IL2CPP
This commit is contained in:
@ -128,6 +128,8 @@ namespace UnityExplorer.Tests
|
||||
public static Il2CppSystem.Collections.Generic.HashSet<string> CppHashSetTest;
|
||||
public static Il2CppSystem.Collections.Generic.List<string> CppStringTest;
|
||||
public static Il2CppSystem.Collections.IList CppIList;
|
||||
public static Il2CppSystem.Collections.Generic.Dictionary<string, string> CppDictTest;
|
||||
public static Il2CppSystem.Collections.Generic.Dictionary<int, float> CppDictTest2;
|
||||
#endif
|
||||
|
||||
public TestClass()
|
||||
@ -143,21 +145,7 @@ namespace UnityExplorer.Tests
|
||||
}
|
||||
|
||||
#if CPP
|
||||
//TestTexture = UIManager.MakeSolidTexture(Color.white, 1000, 600);
|
||||
TestTexture = new Texture();
|
||||
TestTexture.name = "TestTexture";
|
||||
|
||||
var r = new Rect(0, 0, TestTexture.width, TestTexture.height);
|
||||
var v2 = Vector2.zero;
|
||||
var v4 = Vector4.zero;
|
||||
TestSprite = Sprite.CreateSprite_Injected((Texture2D)TestTexture, ref r, ref v2, 100f, 0u, SpriteMeshType.Tight, ref v4, false);
|
||||
|
||||
GameObject.DontDestroyOnLoad(TestTexture);
|
||||
GameObject.DontDestroyOnLoad(TestSprite);
|
||||
|
||||
//// test loading a tex from file
|
||||
//var dataToLoad = System.IO.File.ReadAllBytes(@"Mods\UnityExplorer\Tex_Nemundis_Nebula.png");
|
||||
//ExplorerCore.Log($"Tex load success: {TestTexture.LoadImage(dataToLoad, false)}");
|
||||
TextureSpriteTest();
|
||||
|
||||
CppHashSetTest = new Il2CppSystem.Collections.Generic.HashSet<string>();
|
||||
CppHashSetTest.Add("1");
|
||||
@ -167,9 +155,38 @@ namespace UnityExplorer.Tests
|
||||
CppStringTest = new Il2CppSystem.Collections.Generic.List<string>();
|
||||
CppStringTest.Add("1");
|
||||
CppStringTest.Add("2");
|
||||
|
||||
CppDictTest = new Il2CppSystem.Collections.Generic.Dictionary<string, string>();
|
||||
CppDictTest.Add("key1", "value1");
|
||||
CppDictTest.Add("key2", "value2");
|
||||
CppDictTest.Add("key3", "value3");
|
||||
|
||||
CppDictTest2 = new Il2CppSystem.Collections.Generic.Dictionary<int, float>();
|
||||
CppDictTest2.Add(0, 0.5f);
|
||||
CppDictTest2.Add(1, 0.5f);
|
||||
CppDictTest2.Add(2, 0.5f);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void TextureSpriteTest()
|
||||
{
|
||||
//TestTexture = UIManager.MakeSolidTexture(Color.white, 1000, 600);
|
||||
//TestTexture = new Texture();
|
||||
//TestTexture.name = "TestTexture";
|
||||
|
||||
//var r = new Rect(0, 0, TestTexture.width, TestTexture.height);
|
||||
//var v2 = Vector2.zero;
|
||||
//var v4 = Vector4.zero;
|
||||
//TestSprite = Sprite.CreateSprite_Injected((Texture2D)TestTexture, ref r, ref v2, 100f, 0u, SpriteMeshType.Tight, ref v4, false);
|
||||
|
||||
//GameObject.DontDestroyOnLoad(TestTexture);
|
||||
//GameObject.DontDestroyOnLoad(TestSprite);
|
||||
|
||||
//// test loading a tex from file
|
||||
//var dataToLoad = System.IO.File.ReadAllBytes(@"Mods\UnityExplorer\Tex_Nemundis_Nebula.png");
|
||||
//ExplorerCore.Log($"Tex load success: {TestTexture.LoadImage(dataToLoad, false)}");
|
||||
}
|
||||
|
||||
public static string TestRefInOutGeneric<T>(ref string arg0, in int arg1, out string arg2) where T : Component
|
||||
{
|
||||
arg2 = "this is arg2";
|
||||
|
Reference in New Issue
Block a user