Progress on ReflectionInspector, framework mostly done

This commit is contained in:
Sinai
2021-04-28 20:47:48 +10:00
parent a2ff37e36d
commit b0d54b1d80
22 changed files with 523 additions and 257 deletions

View File

@ -20,7 +20,6 @@ namespace UnityExplorer.Core.Config
public static ConfigElement<bool> Force_Unlock_Mouse;
public static ConfigElement<KeyCode> Force_Unlock_Keybind;
public static ConfigElement<bool> Aggressive_Force_Unlock;
//public static ConfigElement<MenuPages> Default_Tab;
public static ConfigElement<int> Default_Page_Limit;
public static ConfigElement<string> Default_Output_Path;
public static ConfigElement<bool> Log_Unity_Debug;
@ -84,7 +83,7 @@ namespace UnityExplorer.Core.Config
Force_Unlock_Keybind = new ConfigElement<KeyCode>("Force Unlock Keybind",
"The keybind to toggle the 'Force Unlock Mouse' setting. Only usable when UnityExplorer is open.",
KeyCode.F6);
KeyCode.None);
Aggressive_Force_Unlock = new ConfigElement<bool>("Aggressive Mouse Unlock",
"Use Camera.onPostRender callback to aggressively force the Mouse to be unlocked (requires game restart).",

View File

@ -20,8 +20,19 @@ namespace UnityExplorer.Core.Input
public static Vector3 MousePosition => m_inputModule.MousePosition;
public static bool GetKeyDown(KeyCode key) => m_inputModule.GetKeyDown(key);
public static bool GetKey(KeyCode key) => m_inputModule.GetKey(key);
public static bool GetKeyDown(KeyCode key)
{
if (key == KeyCode.None)
return false;
return m_inputModule.GetKeyDown(key);
}
public static bool GetKey(KeyCode key)
{
if (key == KeyCode.None)
return false;
return m_inputModule.GetKey(key);
}
public static bool GetMouseButtonDown(int btn) => m_inputModule.GetMouseButtonDown(btn);
public static bool GetMouseButton(int btn) => m_inputModule.GetMouseButton(btn);

View File

@ -69,7 +69,8 @@ namespace UnityExplorer
/// <param name="t">The Type to check</param>
/// <returns>True if the Type is assignable to IEnumerable, otherwise false.</returns>
public static bool IsEnumerable(this Type t)
=> ReflectionProvider.Instance.IsAssignableFrom(typeof(IEnumerable), t);
=> !typeof(UnityEngine.Transform).IsAssignableFrom(t)
&& ReflectionProvider.Instance.IsAssignableFrom(typeof(IEnumerable), t);
/// <summary>
/// Check if the provided Type is assignable to IDictionary.

View File

@ -7,15 +7,16 @@ namespace UnityExplorer.Tests
{
public static class TestClass
{
static TestClass()
{
List = new List<string>();
for (int i = 0; i < 10000; i++)
List.Add(i.ToString());
}
public static List<string> List;
public const int ConstantInt = 5;
public static string LongString = @"#######################################################################################################
###############################################################################################################################
#####################################################################################################################################
#########################################################################################################################
######################################################################################################";
#if CPP
public static string testStringOne = "Test";
public static Il2CppSystem.Object testStringTwo = "string boxed as cpp object";
@ -24,9 +25,15 @@ namespace UnityExplorer.Tests
public static Il2CppSystem.Collections.Hashtable testHashset;
public static Il2CppSystem.Collections.Generic.List<Il2CppSystem.Object> testList;
#endif
static TestClass()
{
List = new List<string>();
for (int i = 0; i < 10000; i++)
List.Add(i.ToString());
#if CPP
testHashset = new Il2CppSystem.Collections.Hashtable();
testHashset.Add("key1", "itemOne");
testHashset.Add("key2", "itemTwo");
@ -36,8 +43,7 @@ namespace UnityExplorer.Tests
testList.Add("One");
testList.Add("Two");
testList.Add("Three");
//testIList = list.TryCast<Il2CppSystem.Collections.IList>();
}
#endif
}
}
}