mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-04 00:23:31 +08:00
Bump UniverseLib, fix EventSystem issue
This commit is contained in:
parent
4c9b3115cd
commit
9cf62c3250
@ -61,8 +61,6 @@ namespace UnityExplorer.CSConsole
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
InitEventSystemPropertyHandlers();
|
||||
|
||||
// Make sure console is supported on this platform
|
||||
try
|
||||
{
|
||||
@ -386,77 +384,17 @@ namespace UnityExplorer.CSConsole
|
||||
RuntimeHelper.StartCoroutine(SetCaretCoroutine(caretPosition));
|
||||
}
|
||||
|
||||
static void InitEventSystemPropertyHandlers()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (MemberInfo member in typeof(EventSystem).GetMembers(AccessTools.all))
|
||||
{
|
||||
if (member.Name == "m_CurrentSelected")
|
||||
{
|
||||
Type backingType;
|
||||
if (member.MemberType == MemberTypes.Property)
|
||||
backingType = (member as PropertyInfo).PropertyType;
|
||||
else
|
||||
backingType = (member as FieldInfo).FieldType;
|
||||
|
||||
usingEventSystemDictionaryMembers = ReflectionUtility.IsDictionary(backingType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExplorerCore.LogWarning($"Exception checking EventSystem property backing type: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
static bool usingEventSystemDictionaryMembers;
|
||||
|
||||
static readonly AmbiguousMemberHandler<EventSystem, GameObject> m_CurrentSelected_Handler_Normal
|
||||
= new(true, true, "m_CurrentSelected", "m_currentSelected");
|
||||
static readonly AmbiguousMemberHandler<EventSystem, Dictionary<int, GameObject>> m_CurrentSelected_Handler_Dictionary
|
||||
= new(true, true, "m_CurrentSelected", "m_currentSelected");
|
||||
|
||||
static readonly AmbiguousMemberHandler<EventSystem, bool> m_SelectionGuard_Handler_Normal
|
||||
= new(true, true, "m_SelectionGuard", "m_selectionGuard");
|
||||
static readonly AmbiguousMemberHandler<EventSystem, Dictionary<int, bool>> m_SelectionGuard_Handler_Dictionary
|
||||
= new(true, true, "m_SelectionGuard", "m_selectionGuard");
|
||||
|
||||
static void SetCurrentSelectedGameObject(EventSystem instance, GameObject value)
|
||||
{
|
||||
instance.SetSelectedGameObject(value);
|
||||
|
||||
if (usingEventSystemDictionaryMembers)
|
||||
m_CurrentSelected_Handler_Dictionary.GetValue(instance)[0] = value;
|
||||
else
|
||||
m_CurrentSelected_Handler_Normal.SetValue(instance, value);
|
||||
}
|
||||
|
||||
static void SetSelectionGuard(EventSystem instance, bool value)
|
||||
{
|
||||
if (usingEventSystemDictionaryMembers)
|
||||
m_SelectionGuard_Handler_Dictionary.GetValue(instance)[0] = value;
|
||||
else
|
||||
m_SelectionGuard_Handler_Normal.SetValue(instance, value);
|
||||
}
|
||||
|
||||
private static IEnumerator SetCaretCoroutine(int caretPosition)
|
||||
{
|
||||
Color color = Input.Component.selectionColor;
|
||||
color.a = 0f;
|
||||
Input.Component.selectionColor = color;
|
||||
|
||||
try { SetCurrentSelectedGameObject(CursorUnlocker.CurrentEventSystem, null); }
|
||||
catch (Exception ex) { ExplorerCore.Log($"Failed removing selected object: {ex}"); }
|
||||
EventSystemHelper.SetSelectedGameObject(null);
|
||||
|
||||
yield return null; // ~~~~~~~ YIELD FRAME ~~~~~~~~~
|
||||
|
||||
try { SetSelectionGuard(CursorUnlocker.CurrentEventSystem, false); }
|
||||
catch (Exception ex) { ExplorerCore.Log($"Failed setting selection guard: {ex}"); }
|
||||
|
||||
try { SetCurrentSelectedGameObject(CursorUnlocker.CurrentEventSystem, Input.GameObject); }
|
||||
catch (Exception ex) { ExplorerCore.Log($"Failed setting selected gameobject: {ex}"); }
|
||||
EventSystemHelper.SetSelectedGameObject(null);
|
||||
|
||||
yield return null; // ~~~~~~~ YIELD FRAME ~~~~~~~~~
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace UnityExplorer
|
||||
public static class ExplorerCore
|
||||
{
|
||||
public const string NAME = "UnityExplorer";
|
||||
public const string VERSION = "4.7.3";
|
||||
public const string VERSION = "4.7.4";
|
||||
public const string AUTHOR = "Sinai";
|
||||
public const string GUID = "com.sinai.unityexplorer";
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
void ToggleButton_OnClick()
|
||||
{
|
||||
InputManager.SetSelectedEventSystemGameObject(null);
|
||||
EventSystemHelper.SetSelectedGameObject(null);
|
||||
|
||||
if (inFreeCamMode)
|
||||
EndFreecam();
|
||||
@ -194,7 +194,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private void PositionInput_OnEndEdit(string input)
|
||||
{
|
||||
InputManager.SetSelectedEventSystemGameObject(null);
|
||||
EventSystemHelper.SetSelectedGameObject(null);
|
||||
|
||||
if (!ParseUtility.TryParse(input, out Vector3 parsed, out Exception parseEx))
|
||||
{
|
||||
@ -208,7 +208,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private void MoveSpeedInput_OnEndEdit(string input)
|
||||
{
|
||||
InputManager.SetSelectedEventSystemGameObject(null);
|
||||
EventSystemHelper.SetSelectedGameObject(null);
|
||||
|
||||
if (!ParseUtility.TryParse(input, out float parsed, out Exception parseEx))
|
||||
{
|
||||
|
@ -79,11 +79,11 @@
|
||||
<!-- il2cpp nuget -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6' or '$(Configuration)'=='ML_Cpp_net472' or '$(Configuration)'=='STANDALONE_Cpp' or '$(Configuration)'=='BIE_Cpp'">
|
||||
<PackageReference Include="Il2CppAssemblyUnhollower.BaseLib" Version="0.4.22" IncludeAssets="compile" />
|
||||
<PackageReference Include="UniverseLib.IL2CPP" Version="1.3.5" />
|
||||
<PackageReference Include="UniverseLib.IL2CPP" Version="1.3.6" />
|
||||
</ItemGroup>
|
||||
<!-- mono nuget -->
|
||||
<ItemGroup Condition="'$(Configuration)'=='BIE6_Mono' or '$(Configuration)'=='BIE5_Mono' or '$(Configuration)'=='ML_Mono' or '$(Configuration)'=='STANDALONE_Mono'">
|
||||
<PackageReference Include="UniverseLib.Mono" Version="1.3.5" />
|
||||
<PackageReference Include="UniverseLib.Mono" Version="1.3.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ~~~~~ ASSEMBLY REFERENCES ~~~~~ -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user