diff --git a/lib/mcs.NET35.dll b/lib/mcs.NET35.dll new file mode 100644 index 0000000..e83df45 Binary files /dev/null and b/lib/mcs.NET35.dll differ diff --git a/src/Menu/MainMenu/MainMenu.cs b/src/Menu/MainMenu/MainMenu.cs index cdf37f3..da7f7f1 100644 --- a/src/Menu/MainMenu/MainMenu.cs +++ b/src/Menu/MainMenu/MainMenu.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; -using UnityEngine.UI; -using UnityEngine.EventSystems; using MelonLoader; namespace Explorer diff --git a/src/Menu/Windows/WindowManager.cs b/src/Menu/Windows/WindowManager.cs index dea61c3..799d116 100644 --- a/src/Menu/Windows/WindowManager.cs +++ b/src/Menu/Windows/WindowManager.cs @@ -8,7 +8,6 @@ using UnhollowerBaseLib; using UnhollowerRuntimeLib; using UnityEngine; using UnityEngine.Events; -using UnityEngine.EventSystems; namespace Explorer { diff --git a/src/UnstripFixes/GUIUnstrip.cs b/src/UnstripFixes/GUIUnstrip.cs index 068e97f..cb7f930 100644 --- a/src/UnstripFixes/GUIUnstrip.cs +++ b/src/UnstripFixes/GUIUnstrip.cs @@ -20,28 +20,36 @@ namespace Explorer public static bool ScrollFailed = false; public static bool ManualUnstripFailed = false; - private static GenericStack ScrollStack - { - get - { - if (m_scrollViewStatesInfo == null) - { - try - { - m_scrollViewStatesInfo = typeof(GUI).GetProperty("scrollViewStates"); - if (m_scrollViewStatesInfo == null) throw new Exception(); - } - catch - { - m_scrollViewStatesInfo = typeof(GUI).GetProperty("s_scrollViewStates"); - } - } - - return (GenericStack)m_scrollViewStatesInfo?.GetValue(null, null); - } - } + private static GenericStack ScrollStack => m_scrollStack ?? GetScrollStack(); private static PropertyInfo m_scrollViewStatesInfo; - + private static GenericStack m_scrollStack; + + private static GenericStack GetScrollStack() + { + if (m_scrollViewStatesInfo == null) + { + if (typeof(GUI).GetProperty("scrollViewStates", ReflectionHelpers.CommonFlags) is PropertyInfo scrollStatesInfo) + { + m_scrollViewStatesInfo = scrollStatesInfo; + } + else if (typeof(GUI).GetProperty("s_ScrollViewStates", ReflectionHelpers.CommonFlags) is PropertyInfo s_scrollStatesInfo) + { + m_scrollViewStatesInfo = s_scrollStatesInfo; + } + } + + if (m_scrollViewStatesInfo?.GetValue(null, null) is GenericStack stack) + { + m_scrollStack = stack; + } + else + { + m_scrollStack = new GenericStack(); + } + + return m_scrollStack; + } + public static void Space(float pixels) { GUIUtility.CheckOnGUI(); @@ -145,7 +153,7 @@ namespace Explorer private static Vector2 BeginScrollView_Impl(Rect position, Vector2 scrollPosition, Rect viewRect, bool alwaysShowHorizontal, bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background) { - GUIUtility.CheckOnGUI(); + // GUIUtility.CheckOnGUI(); int controlID = GUIUtility.GetControlID(GUI.s_ScrollviewHash, FocusType.Passive);