mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-01-10 02:58:45 +08:00
Fix for GUILayout.BeginArea unstrip and UnityEngine.SystemClock unstrip
and remove some old comments
This commit is contained in:
parent
2d7dfa53eb
commit
fbf9859e0f
@ -244,7 +244,6 @@ namespace Explorer
|
|||||||
var input = m_argumentInput[i];
|
var input = m_argumentInput[i];
|
||||||
var type = m_arguments[i].ParameterType;
|
var type = m_arguments[i].ParameterType;
|
||||||
|
|
||||||
// First, try parse the input and use that.
|
|
||||||
if (!string.IsNullOrEmpty(input))
|
if (!string.IsNullOrEmpty(input))
|
||||||
{
|
{
|
||||||
// strings can obviously just be used directly
|
// strings can obviously just be used directly
|
||||||
|
@ -13,7 +13,7 @@ namespace Explorer
|
|||||||
public class CppExplorer : MelonMod
|
public class CppExplorer : MelonMod
|
||||||
{
|
{
|
||||||
public const string NAME = "CppExplorer";
|
public const string NAME = "CppExplorer";
|
||||||
public const string VERSION = "1.7.0";
|
public const string VERSION = "1.7.1";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.cppexplorer";
|
public const string GUID = "com.sinai.cppexplorer";
|
||||||
|
|
||||||
@ -36,17 +36,13 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
// First, load config
|
|
||||||
ModConfig.OnLoad();
|
ModConfig.OnLoad();
|
||||||
|
|
||||||
// Setup InputHelper class (UnityEngine.Input)
|
|
||||||
InputHelper.Init();
|
InputHelper.Init();
|
||||||
|
|
||||||
// Create CppExplorer modules
|
|
||||||
new MainMenu();
|
new MainMenu();
|
||||||
new WindowManager();
|
new WindowManager();
|
||||||
|
|
||||||
// Init cursor control
|
|
||||||
CursorControl.Init();
|
CursorControl.Init();
|
||||||
|
|
||||||
MelonLogger.Log($"CppExplorer {VERSION} initialized.");
|
MelonLogger.Log($"CppExplorer {VERSION} initialized.");
|
||||||
|
@ -101,7 +101,6 @@ namespace Explorer
|
|||||||
return typeof(ILType);
|
return typeof(ILType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the System.Type using the qualified name, or fallback to GetType.
|
|
||||||
return Type.GetType(ilObject.GetIl2CppType().AssemblyQualifiedName) ?? obj.GetType();
|
return Type.GetType(ilObject.GetIl2CppType().AssemblyQualifiedName) ?? obj.GetType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace Explorer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.BeginArea(new Rect(5, 25, MainRect.width - 10, MainRect.height - 35), GUI.skin.box);
|
GUIUnstrip.BeginArea(new Rect(5, 25, MainRect.width - 10, MainRect.height - 35), GUI.skin.box);
|
||||||
|
|
||||||
MainHeader();
|
MainHeader();
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ namespace Explorer
|
|||||||
|
|
||||||
MainRect = ResizeDrag.ResizeWindow(MainRect, MainWindowID);
|
MainRect = ResizeDrag.ResizeWindow(MainRect, MainWindowID);
|
||||||
|
|
||||||
GUILayout.EndArea();
|
GUIUnstrip.EndArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainHeader()
|
private void MainHeader()
|
||||||
|
@ -210,7 +210,7 @@ namespace Explorer
|
|||||||
if (!WindowManager.TabView)
|
if (!WindowManager.TabView)
|
||||||
{
|
{
|
||||||
Header();
|
Header();
|
||||||
GUILayout.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
|
GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
|
||||||
}
|
}
|
||||||
|
|
||||||
scroll = GUIUnstrip.BeginScrollView(scroll);
|
scroll = GUIUnstrip.BeginScrollView(scroll);
|
||||||
@ -270,7 +270,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
m_rect = ResizeDrag.ResizeWindow(rect, windowID);
|
m_rect = ResizeDrag.ResizeWindow(rect, windowID);
|
||||||
|
|
||||||
GUILayout.EndArea();
|
GUIUnstrip.EndArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -228,7 +228,7 @@ namespace Explorer
|
|||||||
if (!WindowManager.TabView)
|
if (!WindowManager.TabView)
|
||||||
{
|
{
|
||||||
Header();
|
Header();
|
||||||
GUILayout.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
|
GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
@ -354,7 +354,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
m_rect = ResizeDrag.ResizeWindow(rect, windowID);
|
m_rect = ResizeDrag.ResizeWindow(rect, windowID);
|
||||||
|
|
||||||
GUILayout.EndArea();
|
GUIUnstrip.EndArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Il2CppException e)
|
catch (Il2CppException e)
|
||||||
|
@ -65,7 +65,7 @@ namespace Explorer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.BeginArea(new Rect(5, 25, m_rect.width - 10, m_rect.height - 35), GUI.skin.box);
|
GUIUnstrip.BeginArea(new Rect(5, 25, m_rect.width - 10, m_rect.height - 35), GUI.skin.box);
|
||||||
|
|
||||||
GUILayout.BeginVertical(GUI.skin.box, null);
|
GUILayout.BeginVertical(GUI.skin.box, null);
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
@ -109,7 +109,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
GUILayout.EndArea();
|
GUIUnstrip.EndArea();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,15 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
public static int s_ScrollControlId;
|
public static int s_ScrollControlId;
|
||||||
|
|
||||||
public static bool ScrollFailed = false;
|
public static bool ScrollFailed = true;
|
||||||
public static bool ManualUnstripFailed = false;
|
public static bool ManualUnstripFailed = false;
|
||||||
|
|
||||||
private static GenericStack ScrollStack => m_scrollStack ?? GetScrollStack();
|
private static GenericStack ScrollStack => m_scrollStack ?? GetScrollStack();
|
||||||
private static PropertyInfo m_scrollViewStatesInfo;
|
private static PropertyInfo m_scrollViewStatesInfo;
|
||||||
private static GenericStack m_scrollStack;
|
private static GenericStack m_scrollStack;
|
||||||
|
|
||||||
|
public static DateTime nextScrollStepTime;
|
||||||
|
|
||||||
private static GenericStack GetScrollStack()
|
private static GenericStack GetScrollStack()
|
||||||
{
|
{
|
||||||
if (m_scrollViewStatesInfo == null)
|
if (m_scrollViewStatesInfo == null)
|
||||||
@ -55,7 +57,6 @@ namespace Explorer
|
|||||||
GUIUtility.CheckOnGUI();
|
GUIUtility.CheckOnGUI();
|
||||||
|
|
||||||
if (GUILayoutUtility.current.topLevel.isVertical)
|
if (GUILayoutUtility.current.topLevel.isVertical)
|
||||||
|
|
||||||
LayoutUtilityUnstrip.GetRect(0, pixels, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Height(pixels) });
|
LayoutUtilityUnstrip.GetRect(0, pixels, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Height(pixels) });
|
||||||
else
|
else
|
||||||
LayoutUtilityUnstrip.GetRect(pixels, 0, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Width(pixels) });
|
LayoutUtilityUnstrip.GetRect(pixels, 0, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Width(pixels) });
|
||||||
@ -66,6 +67,78 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix for BeginArea
|
||||||
|
|
||||||
|
static public void BeginArea(Rect screenRect) { BeginArea(screenRect, GUIContent.none, GUIStyle.none); }
|
||||||
|
static public void BeginArea(Rect screenRect, string text) { BeginArea(screenRect, GUIContent.Temp(text), GUIStyle.none); }
|
||||||
|
static public void BeginArea(Rect screenRect, Texture image) { BeginArea(screenRect, GUIContent.Temp(image), GUIStyle.none); }
|
||||||
|
static public void BeginArea(Rect screenRect, GUIContent content) { BeginArea(screenRect, content, GUIStyle.none); }
|
||||||
|
static public void BeginArea(Rect screenRect, GUIStyle style) { BeginArea(screenRect, GUIContent.none, style); }
|
||||||
|
static public void BeginArea(Rect screenRect, string text, GUIStyle style) { BeginArea(screenRect, GUIContent.Temp(text), style); }
|
||||||
|
static public void BeginArea(Rect screenRect, Texture image, GUIStyle style) { BeginArea(screenRect, GUIContent.Temp(image), style); }
|
||||||
|
|
||||||
|
// Begin a GUILayout block of GUI controls in a fixed screen area.
|
||||||
|
static public void BeginArea(Rect screenRect, GUIContent content, GUIStyle style)
|
||||||
|
{
|
||||||
|
GUILayoutGroup g = GUILayoutUtility.BeginLayoutArea(style, Il2CppType.Of<GUILayoutGroup>());
|
||||||
|
if (Event.current.type == EventType.Layout)
|
||||||
|
{
|
||||||
|
g.resetCoords = true;
|
||||||
|
g.minWidth = g.maxWidth = screenRect.width;
|
||||||
|
g.minHeight = g.maxHeight = screenRect.height;
|
||||||
|
g.rect = Rect.MinMaxRect(screenRect.xMin, screenRect.yMin, g.rect.xMax, g.rect.yMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.BeginGroup(g.rect, content, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close a GUILayout block started with BeginArea
|
||||||
|
static public void EndArea()
|
||||||
|
{
|
||||||
|
if (Event.current.type == EventType.Used)
|
||||||
|
return;
|
||||||
|
GUILayoutUtility.current.layoutGroups.Pop();
|
||||||
|
GUILayoutUtility.current.topLevel = GUILayoutUtility.current.layoutGroups.Peek().TryCast<GUILayoutGroup>();
|
||||||
|
GUI.EndGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix for BeginGroup
|
||||||
|
|
||||||
|
public static void BeginGroup(Rect position) { BeginGroup(position, GUIContent.none, GUIStyle.none); }
|
||||||
|
public static void BeginGroup(Rect position, string text) { BeginGroup(position, GUIContent.Temp(text), GUIStyle.none); }
|
||||||
|
public static void BeginGroup(Rect position, Texture image) { BeginGroup(position, GUIContent.Temp(image), GUIStyle.none); }
|
||||||
|
public static void BeginGroup(Rect position, GUIContent content) { BeginGroup(position, content, GUIStyle.none); }
|
||||||
|
public static void BeginGroup(Rect position, GUIStyle style) { BeginGroup(position, GUIContent.none, style); }
|
||||||
|
public static void BeginGroup(Rect position, string text, GUIStyle style) { BeginGroup(position, GUIContent.Temp(text), style); }
|
||||||
|
public static void BeginGroup(Rect position, Texture image, GUIStyle style) { BeginGroup(position, GUIContent.Temp(image), style); }
|
||||||
|
|
||||||
|
public static void BeginGroup(Rect position, GUIContent content, GUIStyle style) { BeginGroup(position, content, style, Vector2.zero); }
|
||||||
|
|
||||||
|
internal static void BeginGroup(Rect position, GUIContent content, GUIStyle style, Vector2 scrollOffset)
|
||||||
|
{
|
||||||
|
int id = GUIUtility.GetControlID(GUI.s_BeginGroupHash, FocusType.Passive);
|
||||||
|
|
||||||
|
if (content != GUIContent.none || style != GUIStyle.none)
|
||||||
|
{
|
||||||
|
switch (Event.current.type)
|
||||||
|
{
|
||||||
|
case EventType.Repaint:
|
||||||
|
style.Draw(position, content, id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (position.Contains(Event.current.mousePosition))
|
||||||
|
GUIUtility.mouseUsed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUIClip.Push(position, scrollOffset, Vector2.zero, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EndGroup()
|
||||||
|
{
|
||||||
|
GUIClip.Internal_Pop();
|
||||||
|
}
|
||||||
|
|
||||||
// Fix for BeginScrollView.
|
// Fix for BeginScrollView.
|
||||||
|
|
||||||
public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options)
|
public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options)
|
||||||
@ -120,8 +193,6 @@ namespace Explorer
|
|||||||
private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical,
|
private static Vector2 BeginScrollView_ImplLayout(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical,
|
||||||
GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
|
GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
|
||||||
{
|
{
|
||||||
GUIUtility.CheckOnGUI();
|
|
||||||
|
|
||||||
var guiscrollGroup = GUILayoutUtility.BeginLayoutGroup(background, null, Il2CppType.Of<GUIScrollGroup>())
|
var guiscrollGroup = GUILayoutUtility.BeginLayoutGroup(background, null, Il2CppType.Of<GUIScrollGroup>())
|
||||||
.TryCast<GUIScrollGroup>();
|
.TryCast<GUIScrollGroup>();
|
||||||
|
|
||||||
@ -396,12 +467,12 @@ namespace Explorer
|
|||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
GUI.nextScrollStepTime = Il2CppSystem.DateTime.Now.AddMilliseconds(250.0);
|
nextScrollStepTime = DateTime.Now.AddMilliseconds(250.0);
|
||||||
}
|
}
|
||||||
else if (Il2CppSystem.DateTime.Now >= GUI.nextScrollStepTime)
|
else if (DateTime.Now >= nextScrollStepTime)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
GUI.nextScrollStepTime = Il2CppSystem.DateTime.Now.AddMilliseconds(30.0);
|
nextScrollStepTime = DateTime.Now.AddMilliseconds(30.0);
|
||||||
}
|
}
|
||||||
if (Event.current.type == EventType.Repaint)
|
if (Event.current.type == EventType.Repaint)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ namespace Explorer
|
|||||||
if (this.SupportsPageMovements())
|
if (this.SupportsPageMovements())
|
||||||
{
|
{
|
||||||
this.SliderState().isDragging = false;
|
this.SliderState().isDragging = false;
|
||||||
GUI.nextScrollStepTime = SystemClock.now.AddMilliseconds(250.0);
|
GUIUnstrip.nextScrollStepTime = DateTime.Now.AddMilliseconds(250.0);
|
||||||
GUI.scrollTroughSide = this.CurrentScrollTroughSide();
|
GUI.scrollTroughSide = this.CurrentScrollTroughSide();
|
||||||
result = this.PageMovementValue();
|
result = this.PageMovementValue();
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ namespace Explorer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GUI.InternalRepaintEditorWindow();
|
GUI.InternalRepaintEditorWindow();
|
||||||
if (SystemClock.now < GUI.nextScrollStepTime)
|
if (DateTime.Now < GUIUnstrip.nextScrollStepTime)
|
||||||
{
|
{
|
||||||
result = this.currentValue;
|
result = this.currentValue;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GUI.nextScrollStepTime = SystemClock.now.AddMilliseconds(30.0);
|
GUIUnstrip.nextScrollStepTime = DateTime.Now.AddMilliseconds(30.0);
|
||||||
if (this.SupportsPageMovements())
|
if (this.SupportsPageMovements())
|
||||||
{
|
{
|
||||||
this.SliderState().isDragging = false;
|
this.SliderState().isDragging = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user