mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
1.7.0
* Fix for GuiLayout.Space unstrip * Cleanups
This commit is contained in:
parent
8d648fec43
commit
de663f34b2
@ -384,7 +384,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GUILayout.Space(labelWidth);
|
GUIUnstrip.Space(labelWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cm = this as CacheMethod;
|
var cm = this as CacheMethod;
|
||||||
@ -451,7 +451,7 @@ namespace Explorer
|
|||||||
// new line and space
|
// new line and space
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(labelWidth);
|
GUIUnstrip.Space(labelWidth);
|
||||||
}
|
}
|
||||||
else if (cm != null)
|
else if (cm != null)
|
||||||
{
|
{
|
||||||
@ -465,7 +465,7 @@ namespace Explorer
|
|||||||
// new line and space
|
// new line and space
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(labelWidth);
|
GUIUnstrip.Space(labelWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(ReflectionException))
|
if (!string.IsNullOrEmpty(ReflectionException))
|
||||||
|
@ -235,7 +235,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
GUI.skin.button.alignment = TextAnchor.MiddleCenter;
|
GUI.skin.button.alignment = TextAnchor.MiddleCenter;
|
||||||
|
|
||||||
GUILayout.Space(5);
|
GUIUnstrip.Space(5);
|
||||||
|
|
||||||
if (IsExpanded)
|
if (IsExpanded)
|
||||||
{
|
{
|
||||||
@ -246,7 +246,7 @@ namespace Explorer
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
|
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
|
|
||||||
Pages.CurrentPageLabel();
|
Pages.CurrentPageLabel();
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ namespace Explorer
|
|||||||
|
|
||||||
Pages.DrawLimitInputArea();
|
Pages.DrawLimitInputArea();
|
||||||
|
|
||||||
GUILayout.Space(5);
|
GUIUnstrip.Space(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = Pages.CalculateOffsetIndex();
|
int offset = Pages.CalculateOffsetIndex();
|
||||||
@ -276,7 +276,7 @@ namespace Explorer
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
|
|
||||||
//GUILayout.Space(whitespace);
|
//GUIUnstrip.Space(whitespace);
|
||||||
|
|
||||||
if (key == null || val == null)
|
if (key == null || val == null)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +297,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
GUI.skin.button.alignment = TextAnchor.MiddleCenter;
|
GUI.skin.button.alignment = TextAnchor.MiddleCenter;
|
||||||
|
|
||||||
GUILayout.Space(5);
|
GUIUnstrip.Space(5);
|
||||||
|
|
||||||
if (IsExpanded)
|
if (IsExpanded)
|
||||||
{
|
{
|
||||||
@ -308,7 +308,7 @@ namespace Explorer
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
|
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
|
|
||||||
Pages.CurrentPageLabel();
|
Pages.CurrentPageLabel();
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ namespace Explorer
|
|||||||
|
|
||||||
Pages.DrawLimitInputArea();
|
Pages.DrawLimitInputArea();
|
||||||
|
|
||||||
GUILayout.Space(5);
|
GUIUnstrip.Space(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = Pages.CalculateOffsetIndex();
|
int offset = Pages.CalculateOffsetIndex();
|
||||||
@ -337,7 +337,7 @@ namespace Explorer
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
|
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
|
|
||||||
if (entry == null || entry.Value == null)
|
if (entry == null || entry.Value == null)
|
||||||
{
|
{
|
||||||
|
@ -61,32 +61,32 @@ namespace Explorer
|
|||||||
var whitespace = CalcWhitespace(window);
|
var whitespace = CalcWhitespace(window);
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("R:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("R:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
r = GUILayout.TextField(r, new GUILayoutOption[] { GUILayout.Width(120) });
|
r = GUILayout.TextField(r, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("G:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("G:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
g = GUILayout.TextField(g, new GUILayoutOption[] { GUILayout.Width(120) });
|
g = GUILayout.TextField(g, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("B:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("B:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
b = GUILayout.TextField(b, new GUILayoutOption[] { GUILayout.Width(120) });
|
b = GUILayout.TextField(b, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("A:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("A:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
a = GUILayout.TextField(a, new GUILayoutOption[] { GUILayout.Width(120) });
|
a = GUILayout.TextField(a, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
// draw set value button
|
// draw set value button
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
||||||
{
|
{
|
||||||
SetValueFromInput();
|
SetValueFromInput();
|
||||||
|
@ -92,7 +92,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.Space(10);
|
GUIUnstrip.Space(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,26 +56,26 @@ namespace Explorer
|
|||||||
var whitespace = CalcWhitespace(window);
|
var whitespace = CalcWhitespace(window);
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) });
|
z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
// draw set value button
|
// draw set value button
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
||||||
{
|
{
|
||||||
SetValueFromInput();
|
SetValueFromInput();
|
||||||
|
@ -58,32 +58,32 @@ namespace Explorer
|
|||||||
var whitespace = CalcWhitespace(window);
|
var whitespace = CalcWhitespace(window);
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) });
|
w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("H:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("H:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
h = GUILayout.TextField(h, new GUILayoutOption[] { GUILayout.Width(120) });
|
h = GUILayout.TextField(h, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
// draw set value button
|
// draw set value button
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
||||||
{
|
{
|
||||||
SetValueFromInput();
|
SetValueFromInput();
|
||||||
|
@ -94,13 +94,13 @@ namespace Explorer
|
|||||||
|
|
||||||
// always draw x and y
|
// always draw x and y
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
@ -109,7 +109,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
// draw z
|
// draw z
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) });
|
z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
@ -118,7 +118,7 @@ namespace Explorer
|
|||||||
{
|
{
|
||||||
// draw w
|
// draw w
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) });
|
GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) });
|
||||||
w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) });
|
w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) });
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
@ -126,7 +126,7 @@ namespace Explorer
|
|||||||
|
|
||||||
// draw set value button
|
// draw set value button
|
||||||
GUILayout.BeginHorizontal(null);
|
GUILayout.BeginHorizontal(null);
|
||||||
GUILayout.Space(whitespace);
|
GUIUnstrip.Space(whitespace);
|
||||||
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
if (GUILayout.Button("<color=lime>Apply</color>", new GUILayoutOption[] { GUILayout.Width(155) }))
|
||||||
{
|
{
|
||||||
SetValueFromInput();
|
SetValueFromInput();
|
||||||
|
@ -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.6.9";
|
public const string VERSION = "1.7.0";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.cppexplorer";
|
public const string GUID = "com.sinai.cppexplorer";
|
||||||
|
|
||||||
|
@ -96,13 +96,14 @@
|
|||||||
<Compile Include="Menu\CursorControl.cs" />
|
<Compile Include="Menu\CursorControl.cs" />
|
||||||
<Compile Include="Tests\TestClass.cs" />
|
<Compile Include="Tests\TestClass.cs" />
|
||||||
<Compile Include="UnstripFixes\GUIUnstrip.cs" />
|
<Compile Include="UnstripFixes\GUIUnstrip.cs" />
|
||||||
|
<Compile Include="UnstripFixes\LayoutUtilityUnstrip.cs" />
|
||||||
<Compile Include="UnstripFixes\ScrollViewStateUnstrip.cs" />
|
<Compile Include="UnstripFixes\ScrollViewStateUnstrip.cs" />
|
||||||
<Compile Include="Extensions\UnityExtensions.cs" />
|
<Compile Include="Extensions\UnityExtensions.cs" />
|
||||||
<Compile Include="Helpers\PageHelper.cs" />
|
<Compile Include="Helpers\PageHelper.cs" />
|
||||||
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
||||||
<Compile Include="Helpers\UIHelpers.cs" />
|
<Compile Include="Helpers\UIHelpers.cs" />
|
||||||
<Compile Include="Helpers\UnityHelpers.cs" />
|
<Compile Include="Helpers\UnityHelpers.cs" />
|
||||||
<Compile Include="Menu\MainMenu\InspectUnderMouse.cs" />
|
<Compile Include="Menu\InspectUnderMouse.cs" />
|
||||||
<Compile Include="CachedObjects\CacheObjectBase.cs" />
|
<Compile Include="CachedObjects\CacheObjectBase.cs" />
|
||||||
<Compile Include="UnstripFixes\SliderHandlerUnstrip.cs" />
|
<Compile Include="UnstripFixes\SliderHandlerUnstrip.cs" />
|
||||||
<Compile Include="UnstripFixes\UnstripExtensions.cs" />
|
<Compile Include="UnstripFixes\UnstripExtensions.cs" />
|
||||||
|
@ -24,16 +24,19 @@ namespace Explorer
|
|||||||
|
|
||||||
public static bool ShouldForceMouse => CppExplorer.ShowMenu && ForceUnlockMouse;
|
public static bool ShouldForceMouse => CppExplorer.ShowMenu && ForceUnlockMouse;
|
||||||
|
|
||||||
|
private static Type CursorType => m_cursorType ?? (m_cursorType = ReflectionHelpers.GetTypeByName("UnityEngine.Cursor"));
|
||||||
|
private static Type m_cursorType;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Check if Cursor class is loaded
|
// Check if Cursor class is loaded
|
||||||
if (ReflectionHelpers.GetTypeByName("UnityEngine.Cursor") == null)
|
if (CursorType == null)
|
||||||
{
|
{
|
||||||
MelonLogger.Log("Trying to manually load Cursor module...");
|
MelonLogger.Log("Trying to manually load Cursor module...");
|
||||||
|
|
||||||
if (ReflectionHelpers.LoadModule("UnityEngine.CoreModule"))
|
if (ReflectionHelpers.LoadModule("UnityEngine.CoreModule") && CursorType != null)
|
||||||
{
|
{
|
||||||
MelonLogger.Log("Ok!");
|
MelonLogger.Log("Ok!");
|
||||||
}
|
}
|
||||||
@ -47,11 +50,12 @@ namespace Explorer
|
|||||||
m_lastLockMode = Cursor.lockState;
|
m_lastLockMode = Cursor.lockState;
|
||||||
m_lastVisibleState = Cursor.visible;
|
m_lastVisibleState = Cursor.visible;
|
||||||
|
|
||||||
TryPatch("lockState", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Prefix_set_lockState))), false, false);
|
// Setup Harmony Patches
|
||||||
TryPatch("visible", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Prefix_set_visible))), false, false);
|
TryPatch("lockState", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Prefix_set_lockState))), true);
|
||||||
|
TryPatch("lockState", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Postfix_get_lockState))), false);
|
||||||
|
|
||||||
TryPatch("lockState", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Postfix_get_lockState))), true, true);
|
TryPatch("visible", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Prefix_set_visible))), true);
|
||||||
TryPatch("visible", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Postfix_get_visible))), true, true);
|
TryPatch("visible", new HarmonyMethod(typeof(CursorControl).GetMethod(nameof(Postfix_get_visible))), false);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -64,18 +68,23 @@ namespace Explorer
|
|||||||
ForceUnlockMouse = true;
|
ForceUnlockMouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TryPatch(string property, HarmonyMethod patch, bool getter = true, bool postfix = false)
|
private static void TryPatch(string property, HarmonyMethod patch, bool setter)
|
||||||
{
|
{
|
||||||
// Setup Harmony Patches
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var harmony = CppExplorer.Instance.harmonyInstance;
|
var harmony = CppExplorer.Instance.harmonyInstance;
|
||||||
|
|
||||||
var prop = typeof(Cursor).GetProperty(property);
|
var prop = typeof(Cursor).GetProperty(property);
|
||||||
|
|
||||||
harmony.Patch(getter ? prop.GetGetMethod() : prop.GetSetMethod(),
|
if (setter)
|
||||||
postfix ? null : patch,
|
{
|
||||||
postfix ? patch : null);
|
// setter is prefix
|
||||||
|
harmony.Patch(prop.GetSetMethod(), patch);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// getter is postfix
|
||||||
|
harmony.Patch(prop.GetGetMethod(), null, patch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -170,69 +179,5 @@ namespace Explorer
|
|||||||
__result = m_lastVisibleState;
|
__result = m_lastVisibleState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//[HarmonyPatch(typeof(Cursor), nameof(Cursor.lockState), MethodType.Setter)]
|
|
||||||
//public class Cursor_set_lockState
|
|
||||||
//{
|
|
||||||
// [HarmonyPrefix]
|
|
||||||
// public static void Prefix(ref CursorLockMode value)
|
|
||||||
// {
|
|
||||||
// if (!m_currentlySettingCursor)
|
|
||||||
// {
|
|
||||||
// m_lastLockMode = value;
|
|
||||||
|
|
||||||
// if (ShouldForceMouse)
|
|
||||||
// {
|
|
||||||
// value = CursorLockMode.None;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//[HarmonyPatch(typeof(Cursor), nameof(Cursor.visible), MethodType.Setter)]
|
|
||||||
//public class Cursor_set_visible
|
|
||||||
//{
|
|
||||||
// [HarmonyPrefix]
|
|
||||||
// public static void Prefix(ref bool value)
|
|
||||||
// {
|
|
||||||
// if (!m_currentlySettingCursor)
|
|
||||||
// {
|
|
||||||
// m_lastVisibleState = value;
|
|
||||||
|
|
||||||
// if (ShouldForceMouse)
|
|
||||||
// {
|
|
||||||
// value = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Make it appear as though UnlockMouse is disabled to the rest of the application.
|
|
||||||
|
|
||||||
//[HarmonyPatch(typeof(Cursor), nameof(Cursor.lockState), MethodType.Getter)]
|
|
||||||
//public class Cursor_get_lockState
|
|
||||||
//{
|
|
||||||
// [HarmonyPostfix]
|
|
||||||
// public static void Postfix(ref CursorLockMode __result)
|
|
||||||
// {
|
|
||||||
// if (ShouldForceMouse)
|
|
||||||
// {
|
|
||||||
// __result = m_lastLockMode;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//[HarmonyPatch(typeof(Cursor), nameof(Cursor.visible), MethodType.Getter)]
|
|
||||||
//public class Cursor_get_visible
|
|
||||||
//{
|
|
||||||
// [HarmonyPostfix]
|
|
||||||
// public static void Postfix(ref bool __result)
|
|
||||||
// {
|
|
||||||
// if (ShouldForceMouse)
|
|
||||||
// {
|
|
||||||
// __result = m_lastVisibleState;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,9 @@ namespace Explorer
|
|||||||
WindowManager.TabView = GUILayout.Toggle(WindowManager.TabView, "Tab View", null);
|
WindowManager.TabView = GUILayout.Toggle(WindowManager.TabView, "Tab View", null);
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.Space(10);
|
//GUIUnstrip.Space(10);
|
||||||
|
GUIUnstrip.Space(10);
|
||||||
|
|
||||||
GUI.color = Color.white;
|
GUI.color = Color.white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.Space(5);
|
GUIUnstrip.Space(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SceneChangeButtons()
|
private void SceneChangeButtons()
|
||||||
|
@ -385,7 +385,7 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GUILayout.Space(26);
|
GUIUnstrip.Space(26);
|
||||||
}
|
}
|
||||||
if (GUILayout.Button("<color=cyan>" + ilType.Name + "</color>", new GUILayoutOption[] { GUILayout.Width(m_rect.width / 2 - 100) }))
|
if (GUILayout.Button("<color=cyan>" + ilType.Name + "</color>", new GUILayoutOption[] { GUILayout.Width(m_rect.width / 2 - 100) }))
|
||||||
{
|
{
|
||||||
|
@ -288,7 +288,7 @@ namespace Explorer
|
|||||||
GUI.color = Color.white;
|
GUI.color = Color.white;
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.Space(10);
|
GUIUnstrip.Space(10);
|
||||||
|
|
||||||
Pages.ItemCount = m_cachedMembersFiltered.Length;
|
Pages.ItemCount = m_cachedMembersFiltered.Length;
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ namespace Explorer
|
|||||||
|
|
||||||
scroll = GUIUnstrip.BeginScrollView(scroll);
|
scroll = GUIUnstrip.BeginScrollView(scroll);
|
||||||
|
|
||||||
GUILayout.Space(10);
|
GUIUnstrip.Space(10);
|
||||||
|
|
||||||
UIStyles.HorizontalLine(Color.grey);
|
UIStyles.HorizontalLine(Color.grey);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace Explorer
|
|||||||
GUILayout.Button(gcDrag, GUI.skin.label, new GUILayoutOption[] { GUILayout.Height(15) });
|
GUILayout.Button(gcDrag, GUI.skin.label, new GUILayoutOption[] { GUILayout.Height(15) });
|
||||||
|
|
||||||
//var r = GUILayoutUtility.GetLastRect();
|
//var r = GUILayoutUtility.GetLastRect();
|
||||||
var r = GUIUnstrip.GetLastRect();
|
var r = LayoutUtilityUnstrip.GetLastRect();
|
||||||
|
|
||||||
var mousePos = InputHelper.mousePosition;
|
var mousePos = InputHelper.mousePosition;
|
||||||
|
|
||||||
|
@ -42,20 +42,20 @@ namespace Explorer
|
|||||||
}
|
}
|
||||||
private static PropertyInfo m_scrollViewStatesInfo;
|
private static PropertyInfo m_scrollViewStatesInfo;
|
||||||
|
|
||||||
|
public static void Space(float pixels)
|
||||||
public static Rect GetLastRect()
|
|
||||||
{
|
{
|
||||||
EventType type = Event.current.type;
|
GUIUtility.CheckOnGUI();
|
||||||
Rect last;
|
|
||||||
if (type != EventType.Layout && type != EventType.Used)
|
if (GUILayoutUtility.current.topLevel.isVertical)
|
||||||
{
|
|
||||||
last = GUILayoutUtility.current.topLevel.GetLastUnstripped();
|
LayoutUtilityUnstrip.GetRect(0, pixels, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Height(pixels) });
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
LayoutUtilityUnstrip.GetRect(pixels, 0, GUILayoutUtility.spaceStyle, new GUILayoutOption[] { GUILayout.Width(pixels) });
|
||||||
|
|
||||||
|
if (Event.current.type == EventType.Layout)
|
||||||
{
|
{
|
||||||
last = GUILayoutUtility.kDummyRect;
|
GUILayoutUtility.current.topLevel.entries[GUILayoutUtility.current.topLevel.entries.Count - 1].consideredForMargin = false;
|
||||||
}
|
}
|
||||||
return last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for BeginScrollView.
|
// Fix for BeginScrollView.
|
||||||
|
112
src/UnstripFixes/LayoutUtilityUnstrip.cs
Normal file
112
src/UnstripFixes/LayoutUtilityUnstrip.cs
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Explorer
|
||||||
|
{
|
||||||
|
public class LayoutUtilityUnstrip
|
||||||
|
{
|
||||||
|
public static Rect GetRect(float width, float height) { return DoGetRect(width, width, height, height, GUIStyle.none, null); }
|
||||||
|
public static Rect GetRect(float width, float height, GUIStyle style) { return DoGetRect(width, width, height, height, style, null); }
|
||||||
|
public static Rect GetRect(float width, float height, params GUILayoutOption[] options) { return DoGetRect(width, width, height, height, GUIStyle.none, options); }
|
||||||
|
// Reserve layout space for a rectangle with a fixed content area.
|
||||||
|
public static Rect GetRect(float width, float height, GUIStyle style, params GUILayoutOption[] options)
|
||||||
|
{ return DoGetRect(width, width, height, height, style, options); }
|
||||||
|
|
||||||
|
public static Rect GetRect(float minWidth, float maxWidth, float minHeight, float maxHeight)
|
||||||
|
{ return DoGetRect(minWidth, maxWidth, minHeight, maxHeight, GUIStyle.none, null); }
|
||||||
|
|
||||||
|
public static Rect GetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, GUIStyle style)
|
||||||
|
{ return DoGetRect(minWidth, maxWidth, minHeight, maxHeight, style, null); }
|
||||||
|
|
||||||
|
public static Rect GetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, params GUILayoutOption[] options)
|
||||||
|
{ return DoGetRect(minWidth, maxWidth, minHeight, maxHeight, GUIStyle.none, options); }
|
||||||
|
// Reserve layout space for a flexible rect.
|
||||||
|
public static Rect GetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, GUIStyle style, params GUILayoutOption[] options)
|
||||||
|
{ return DoGetRect(minWidth, maxWidth, minHeight, maxHeight, style, options); }
|
||||||
|
static Rect DoGetRect(float minWidth, float maxWidth, float minHeight, float maxHeight, GUIStyle style, GUILayoutOption[] options)
|
||||||
|
{
|
||||||
|
switch (Event.current.type)
|
||||||
|
{
|
||||||
|
case EventType.Layout:
|
||||||
|
GUILayoutUtility.current.topLevel.Add(new GUILayoutEntry(minWidth, maxWidth, minHeight, maxHeight, style, options));
|
||||||
|
return GUILayoutUtility.kDummyRect;
|
||||||
|
case EventType.Used:
|
||||||
|
return GUILayoutUtility.kDummyRect;
|
||||||
|
default:
|
||||||
|
return GUILayoutUtility.current.topLevel.GetNext().rect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Rect GetRect(GUIContent content, GUIStyle style) { return DoGetRect(content, style, null); }
|
||||||
|
// Reserve layout space for a rectangle for displaying some contents with a specific style.
|
||||||
|
public static Rect GetRect(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { return DoGetRect(content, style, options); }
|
||||||
|
|
||||||
|
static Rect DoGetRect(GUIContent content, GUIStyle style, GUILayoutOption[] options)
|
||||||
|
{
|
||||||
|
GUIUtility.CheckOnGUI();
|
||||||
|
|
||||||
|
switch (Event.current.type)
|
||||||
|
{
|
||||||
|
case EventType.Layout:
|
||||||
|
if (style.isHeightDependantOnWidth)
|
||||||
|
{
|
||||||
|
GUILayoutUtility.current.topLevel.Add(new GUIWordWrapSizer(style, content, options));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector2 sizeConstraints = new Vector2(0, 0);
|
||||||
|
if (options != null)
|
||||||
|
{
|
||||||
|
foreach (var option in options)
|
||||||
|
{
|
||||||
|
if (float.TryParse(option.value.ToString(), out float f))
|
||||||
|
{
|
||||||
|
switch (option.type)
|
||||||
|
{
|
||||||
|
case GUILayoutOption.Type.maxHeight:
|
||||||
|
sizeConstraints.y = f;
|
||||||
|
break;
|
||||||
|
case GUILayoutOption.Type.maxWidth:
|
||||||
|
sizeConstraints.x = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 size = style.CalcSizeWithConstraints(content, sizeConstraints);
|
||||||
|
// This is needed on non-integer scale ratios to avoid errors to accumulate in further layout calculations
|
||||||
|
size.x = Mathf.Ceil(size.x);
|
||||||
|
size.y = Mathf.Ceil(size.y);
|
||||||
|
GUILayoutUtility.current.topLevel.Add(new GUILayoutEntry(size.x, size.x, size.y, size.y, style, options));
|
||||||
|
}
|
||||||
|
return GUILayoutUtility.kDummyRect;
|
||||||
|
|
||||||
|
case EventType.Used:
|
||||||
|
return GUILayoutUtility.kDummyRect;
|
||||||
|
default:
|
||||||
|
var entry = GUILayoutUtility.current.topLevel.GetNext();
|
||||||
|
//GUIDebugger.LogLayoutEntry(entry.rect, entry.marginLeft, entry.marginRight, entry.marginTop, entry.marginBottom, entry.style);
|
||||||
|
return entry.rect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rect GetLastRect()
|
||||||
|
{
|
||||||
|
EventType type = Event.current.type;
|
||||||
|
Rect last;
|
||||||
|
if (type != EventType.Layout && type != EventType.Used)
|
||||||
|
{
|
||||||
|
last = GUILayoutUtility.current.topLevel.GetLastUnstripped();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last = GUILayoutUtility.kDummyRect;
|
||||||
|
}
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user