Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 9cf62c3

Browse files
committed
Bump UniverseLib, fix EventSystem issue
1 parent 4c9b311 commit 9cf62c3

File tree

4 files changed

+8
-70
lines changed

4 files changed

+8
-70
lines changed

src/CSConsole/ConsoleController.cs

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public static class ConsoleController
6161

6262
public static void Init()
6363
{
64-
InitEventSystemPropertyHandlers();
65-
6664
// Make sure console is supported on this platform
6765
try
6866
{
@@ -386,77 +384,17 @@ private static void SetCaretPosition(int caretPosition)
386384
RuntimeHelper.StartCoroutine(SetCaretCoroutine(caretPosition));
387385
}
388386

389-
static void InitEventSystemPropertyHandlers()
390-
{
391-
try
392-
{
393-
foreach (MemberInfo member in typeof(EventSystem).GetMembers(AccessTools.all))
394-
{
395-
if (member.Name == "m_CurrentSelected")
396-
{
397-
Type backingType;
398-
if (member.MemberType == MemberTypes.Property)
399-
backingType = (member as PropertyInfo).PropertyType;
400-
else
401-
backingType = (member as FieldInfo).FieldType;
402-
403-
usingEventSystemDictionaryMembers = ReflectionUtility.IsDictionary(backingType);
404-
break;
405-
}
406-
}
407-
}
408-
catch (Exception ex)
409-
{
410-
ExplorerCore.LogWarning($"Exception checking EventSystem property backing type: {ex}");
411-
}
412-
}
413-
414-
static bool usingEventSystemDictionaryMembers;
415-
416-
static readonly AmbiguousMemberHandler<EventSystem, GameObject> m_CurrentSelected_Handler_Normal
417-
= new(true, true, "m_CurrentSelected", "m_currentSelected");
418-
static readonly AmbiguousMemberHandler<EventSystem, Dictionary<int, GameObject>> m_CurrentSelected_Handler_Dictionary
419-
= new(true, true, "m_CurrentSelected", "m_currentSelected");
420-
421-
static readonly AmbiguousMemberHandler<EventSystem, bool> m_SelectionGuard_Handler_Normal
422-
= new(true, true, "m_SelectionGuard", "m_selectionGuard");
423-
static readonly AmbiguousMemberHandler<EventSystem, Dictionary<int, bool>> m_SelectionGuard_Handler_Dictionary
424-
= new(true, true, "m_SelectionGuard", "m_selectionGuard");
425-
426-
static void SetCurrentSelectedGameObject(EventSystem instance, GameObject value)
427-
{
428-
instance.SetSelectedGameObject(value);
429-
430-
if (usingEventSystemDictionaryMembers)
431-
m_CurrentSelected_Handler_Dictionary.GetValue(instance)[0] = value;
432-
else
433-
m_CurrentSelected_Handler_Normal.SetValue(instance, value);
434-
}
435-
436-
static void SetSelectionGuard(EventSystem instance, bool value)
437-
{
438-
if (usingEventSystemDictionaryMembers)
439-
m_SelectionGuard_Handler_Dictionary.GetValue(instance)[0] = value;
440-
else
441-
m_SelectionGuard_Handler_Normal.SetValue(instance, value);
442-
}
443-
444387
private static IEnumerator SetCaretCoroutine(int caretPosition)
445388
{
446389
Color color = Input.Component.selectionColor;
447390
color.a = 0f;
448391
Input.Component.selectionColor = color;
449392

450-
try { SetCurrentSelectedGameObject(CursorUnlocker.CurrentEventSystem, null); }
451-
catch (Exception ex) { ExplorerCore.Log($"Failed removing selected object: {ex}"); }
393+
EventSystemHelper.SetSelectedGameObject(null);
452394

453395
yield return null; // ~~~~~~~ YIELD FRAME ~~~~~~~~~
454396

455-
try { SetSelectionGuard(CursorUnlocker.CurrentEventSystem, false); }
456-
catch (Exception ex) { ExplorerCore.Log($"Failed setting selection guard: {ex}"); }
457-
458-
try { SetCurrentSelectedGameObject(CursorUnlocker.CurrentEventSystem, Input.GameObject); }
459-
catch (Exception ex) { ExplorerCore.Log($"Failed setting selected gameobject: {ex}"); }
397+
EventSystemHelper.SetSelectedGameObject(null);
460398

461399
yield return null; // ~~~~~~~ YIELD FRAME ~~~~~~~~~
462400

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace UnityExplorer
1414
public static class ExplorerCore
1515
{
1616
public const string NAME = "UnityExplorer";
17-
public const string VERSION = "4.7.3";
17+
public const string VERSION = "4.7.4";
1818
public const string AUTHOR = "Sinai";
1919
public const string GUID = "com.sinai.unityexplorer";
2020

src/UI/Panels/FreeCamPanel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ GameObject AddInputField(string name, string labelText, string placeHolder, out
182182

183183
void ToggleButton_OnClick()
184184
{
185-
InputManager.SetSelectedEventSystemGameObject(null);
185+
EventSystemHelper.SetSelectedGameObject(null);
186186

187187
if (inFreeCamMode)
188188
EndFreecam();
@@ -194,7 +194,7 @@ void ToggleButton_OnClick()
194194

195195
private void PositionInput_OnEndEdit(string input)
196196
{
197-
InputManager.SetSelectedEventSystemGameObject(null);
197+
EventSystemHelper.SetSelectedGameObject(null);
198198

199199
if (!ParseUtility.TryParse(input, out Vector3 parsed, out Exception parseEx))
200200
{
@@ -208,7 +208,7 @@ private void PositionInput_OnEndEdit(string input)
208208

209209
private void MoveSpeedInput_OnEndEdit(string input)
210210
{
211-
InputManager.SetSelectedEventSystemGameObject(null);
211+
EventSystemHelper.SetSelectedGameObject(null);
212212

213213
if (!ParseUtility.TryParse(input, out float parsed, out Exception parseEx))
214214
{

src/UnityExplorer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
<!-- il2cpp nuget -->
8080
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6' or '$(Configuration)'=='ML_Cpp_net472' or '$(Configuration)'=='STANDALONE_Cpp' or '$(Configuration)'=='BIE_Cpp'">
8181
<PackageReference Include="Il2CppAssemblyUnhollower.BaseLib" Version="0.4.22" IncludeAssets="compile" />
82-
<PackageReference Include="UniverseLib.IL2CPP" Version="1.3.5" />
82+
<PackageReference Include="UniverseLib.IL2CPP" Version="1.3.6" />
8383
</ItemGroup>
8484
<!-- mono nuget -->
8585
<ItemGroup Condition="'$(Configuration)'=='BIE6_Mono' or '$(Configuration)'=='BIE5_Mono' or '$(Configuration)'=='ML_Mono' or '$(Configuration)'=='STANDALONE_Mono'">
86-
<PackageReference Include="UniverseLib.Mono" Version="1.3.5" />
86+
<PackageReference Include="UniverseLib.Mono" Version="1.3.6" />
8787
</ItemGroup>
8888

8989
<!-- ~~~~~ ASSEMBLY REFERENCES ~~~~~ -->

0 commit comments

Comments
 (0)