diff --git a/src/CachedObjects/CacheObjectBase.cs b/src/CachedObjects/CacheObjectBase.cs index d5b48a6..5f569d3 100644 --- a/src/CachedObjects/CacheObjectBase.cs +++ b/src/CachedObjects/CacheObjectBase.cs @@ -379,7 +379,7 @@ namespace Explorer if (MemInfo != null) { - GUIUnstrip.Label(RichTextName, new GUILayoutOption[] { GUILayout.Width(labelWidth) }); + GUILayout.Label(RichTextName, new GUILayoutOption[] { GUILayout.Width(labelWidth) }); } else { @@ -390,7 +390,7 @@ namespace Explorer if (HasParameters) { - GUIUnstrip.BeginVertical(); + GUILayout.BeginVertical(null); if (m_isEvaluating) { @@ -406,17 +406,17 @@ namespace Explorer label = $"[{label} = {m_arguments[i].DefaultValue}]"; } - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); - GUIUnstrip.Label(i.ToString(), new GUILayoutOption[] { GUILayout.Width(20) }); - m_argumentInput[i] = GUIUnstrip.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) }); - GUIUnstrip.Label(label); + GUILayout.Label(i.ToString(), new GUILayoutOption[] { GUILayout.Width(20) }); + m_argumentInput[i] = GUILayout.TextField(input, new GUILayoutOption[] { GUILayout.Width(150) }); + GUILayout.Label(label, null); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } - GUIUnstrip.BeginHorizontal(); - if (GUIUnstrip.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) + GUILayout.BeginHorizontal(null); + if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { if (cm != null) { @@ -427,53 +427,53 @@ namespace Explorer UpdateValue(); } } - if (GUIUnstrip.Button("Cancel", new GUILayoutOption[] { GUILayout.Width(70) })) + if (GUILayout.Button("Cancel", new GUILayoutOption[] { GUILayout.Width(70) })) { m_isEvaluating = false; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } else { - if (GUIUnstrip.Button($"Evaluate ({m_arguments.Length} params)", new GUILayoutOption[] { GUILayout.Width(150) })) + if (GUILayout.Button($"Evaluate ({m_arguments.Length} params)", new GUILayoutOption[] { GUILayout.Width(150) })) { m_isEvaluating = true; } } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); // new line and space - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(labelWidth); } else if (cm != null) { - //GUIUnstrip.BeginHorizontal(); + //GUILayout.BeginHorizontal(null); - if (GUIUnstrip.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) + if (GUILayout.Button(EVALUATE_LABEL, new GUILayoutOption[] { GUILayout.Width(70) })) { cm.Evaluate(); } // new line and space - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(labelWidth); } if (!string.IsNullOrEmpty(ReflectionException)) { - GUIUnstrip.Label("Reflection failed! (" + ReflectionException + ")"); + GUILayout.Label("Reflection failed! (" + ReflectionException + ")", null); } else if ((HasParameters || this is CacheMethod) && !m_evaluated) { - GUIUnstrip.Label($"Not yet evaluated ({ValueTypeName})"); + GUILayout.Label($"Not yet evaluated ({ValueTypeName})", null); } else if (Value == null && !(this is CacheMethod)) { - GUIUnstrip.Label("null (" + ValueTypeName + ")"); + GUILayout.Label("null (" + ValueTypeName + ")", null); } else { diff --git a/src/CachedObjects/Object/CacheDictionary.cs b/src/CachedObjects/Object/CacheDictionary.cs index 780ac7a..5fdedcf 100644 --- a/src/CachedObjects/Object/CacheDictionary.cs +++ b/src/CachedObjects/Object/CacheDictionary.cs @@ -202,7 +202,7 @@ namespace Explorer { if (m_cachedKeys == null || m_cachedValues == null) { - GUIUnstrip.Label("Cached keys or values is null!"); + GUILayout.Label("Cached keys or values is null!", null); return; } @@ -212,14 +212,14 @@ namespace Explorer if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } @@ -229,7 +229,7 @@ namespace Explorer GUI.skin.button.alignment = TextAnchor.MiddleLeft; string btnLabel = $"[{count}] Dictionary<{TypeOfKeys.FullName}, {TypeOfValues.FullName}>"; - if (GUIUnstrip.Button(btnLabel, new GUILayoutOption[] { GUILayout.Width(negativeWhitespace) })) + if (GUILayout.Button(btnLabel, new GUILayoutOption[] { GUILayout.Width(negativeWhitespace) })) { WindowManager.InspectObject(Value, out bool _); } @@ -243,19 +243,19 @@ namespace Explorer if (count > Pages.ItemsPerPage) { - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); Pages.CurrentPageLabel(); // prev/next page buttons - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(60) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(60) })) { Pages.TurnPage(Turn.Left); } - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(60) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(60) })) { Pages.TurnPage(Turn.Right); } @@ -273,24 +273,24 @@ namespace Explorer var val = m_cachedValues[i]; //collapsing the BeginHorizontal called from ReflectionWindow.WindowFunction or previous array entry - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); //GUIUnstrip.Space(whitespace); if (key == null || val == null) { - GUIUnstrip.Label($"[{i}] (null)"); + GUILayout.Label($"[{i}] (null)", null); } else { GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) }); + GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) }); - GUIUnstrip.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) }); + GUILayout.Label("Key:", new GUILayoutOption[] { GUILayout.Width(40) }); key.DrawValue(window, (window.width / 2) - 30f); - GUIUnstrip.Label("Value:", new GUILayoutOption[] { GUILayout.Width(40) }); + GUILayout.Label("Value:", new GUILayoutOption[] { GUILayout.Width(40) }); val.DrawValue(window, (window.width / 2) - 30f); } diff --git a/src/CachedObjects/Object/CacheList.cs b/src/CachedObjects/Object/CacheList.cs index 722ad75..d1a94b3 100644 --- a/src/CachedObjects/Object/CacheList.cs +++ b/src/CachedObjects/Object/CacheList.cs @@ -264,7 +264,7 @@ namespace Explorer { if (m_cachedEntries == null) { - GUIUnstrip.Label("m_cachedEntries is null!"); + GUILayout.Label("m_cachedEntries is null!", null); return; } @@ -274,14 +274,14 @@ namespace Explorer if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } @@ -291,7 +291,7 @@ namespace Explorer GUI.skin.button.alignment = TextAnchor.MiddleLeft; string btnLabel = $"[{count}] {EntryType.FullName}"; - if (GUIUnstrip.Button(btnLabel, new GUILayoutOption[] { GUILayout.MaxWidth(negativeWhitespace) })) + if (GUILayout.Button(btnLabel, new GUILayoutOption[] { GUILayout.MaxWidth(negativeWhitespace) })) { WindowManager.InspectObject(Value, out bool _); } @@ -305,19 +305,19 @@ namespace Explorer if (count > Pages.ItemsPerPage) { - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); Pages.CurrentPageLabel(); // prev/next page buttons - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(60) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(60) })) { Pages.TurnPage(Turn.Left); } - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(60) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(60) })) { Pages.TurnPage(Turn.Right); } @@ -334,19 +334,19 @@ namespace Explorer var entry = m_cachedEntries[i]; //collapsing the BeginHorizontal called from ReflectionWindow.WindowFunction or previous array entry - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); if (entry == null || entry.Value == null) { - GUIUnstrip.Label($"[{i}] (null)"); + GUILayout.Label($"[{i}] (null)", null); } else { GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) }); + GUILayout.Label($"[{i}]", new GUILayoutOption[] { GUILayout.Width(30) }); entry.DrawValue(window, window.width - (whitespace + 85)); } diff --git a/src/CachedObjects/Other/CacheMethod.cs b/src/CachedObjects/Other/CacheMethod.cs index b7f1ced..6ce890e 100644 --- a/src/CachedObjects/Other/CacheMethod.cs +++ b/src/CachedObjects/Other/CacheMethod.cs @@ -78,12 +78,12 @@ namespace Explorer } else { - GUIUnstrip.Label($"null ({ValueTypeName})"); + GUILayout.Label($"null ({ValueTypeName})", null); } } else { - GUIUnstrip.Label($"Not yet evaluated ({ValueTypeName})"); + GUILayout.Label($"Not yet evaluated ({ValueTypeName})", null); } } } diff --git a/src/CachedObjects/Other/CacheOther.cs b/src/CachedObjects/Other/CacheOther.cs index 857c5b7..97ce07b 100644 --- a/src/CachedObjects/Other/CacheOther.cs +++ b/src/CachedObjects/Other/CacheOther.cs @@ -55,7 +55,7 @@ namespace Explorer } GUI.skin.button.alignment = TextAnchor.MiddleLeft; - if (GUIUnstrip.Button(label, new GUILayoutOption[] { GUILayout.Width(width - 15) })) + if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(width - 15) })) { WindowManager.InspectObject(Value, out bool _); } diff --git a/src/CachedObjects/Struct/CacheColor.cs b/src/CachedObjects/Struct/CacheColor.cs index f05fd1f..26b2d0f 100644 --- a/src/CachedObjects/Struct/CacheColor.cs +++ b/src/CachedObjects/Struct/CacheColor.cs @@ -35,14 +35,14 @@ namespace Explorer { if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } @@ -51,49 +51,49 @@ namespace Explorer //var c = (Color)Value; //GUI.color = c; - GUIUnstrip.Label($"Color: {((Color)Value).ToString()}"); + GUILayout.Label($"Color: {((Color)Value).ToString()}", null); //GUI.color = Color.white; if (CanWrite && IsExpanded) { - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("R:", new GUILayoutOption[] { GUILayout.Width(30) }); - r = GUIUnstrip.TextField(r, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("R:", new GUILayoutOption[] { GUILayout.Width(30) }); + r = GUILayout.TextField(r, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("G:", new GUILayoutOption[] { GUILayout.Width(30) }); - g = GUIUnstrip.TextField(g, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("G:", new GUILayoutOption[] { GUILayout.Width(30) }); + g = GUILayout.TextField(g, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("B:", new GUILayoutOption[] { GUILayout.Width(30) }); - b = GUIUnstrip.TextField(b, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("B:", new GUILayoutOption[] { GUILayout.Width(30) }); + b = GUILayout.TextField(b, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("A:", new GUILayoutOption[] { GUILayout.Width(30) }); - a = GUIUnstrip.TextField(a, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("A:", new GUILayoutOption[] { GUILayout.Width(30) }); + a = GUILayout.TextField(a, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); // draw set value button - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - if (GUIUnstrip.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) + if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); } } diff --git a/src/CachedObjects/Struct/CacheEnum.cs b/src/CachedObjects/Struct/CacheEnum.cs index b7625d8..f90d8f7 100644 --- a/src/CachedObjects/Struct/CacheEnum.cs +++ b/src/CachedObjects/Struct/CacheEnum.cs @@ -39,19 +39,19 @@ namespace Explorer { if (CanWrite) { - if (GUIUnstrip.Button("<", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("<", new GUILayoutOption[] { GUILayout.Width(25) })) { SetEnum(ref Value, -1); SetValue(); } - if (GUIUnstrip.Button(">", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button(">", new GUILayoutOption[] { GUILayout.Width(25) })) { SetEnum(ref Value, 1); SetValue(); } } - GUIUnstrip.Label(Value.ToString() + " (" + ValueType + ")"); + GUILayout.Label(Value.ToString() + " (" + ValueType + ")", null); } public void SetEnum(ref object value, int change) diff --git a/src/CachedObjects/Struct/CachePrimitive.cs b/src/CachedObjects/Struct/CachePrimitive.cs index c1ab48c..6c55a19 100644 --- a/src/CachedObjects/Struct/CachePrimitive.cs +++ b/src/CachedObjects/Struct/CachePrimitive.cs @@ -55,7 +55,7 @@ namespace Explorer if (CanWrite) { - b = GUIUnstrip.Toggle(b, label); + b = GUILayout.Toggle(b, label, null); if (b != (bool)Value) { SetValueFromInput(b.ToString()); @@ -63,13 +63,13 @@ namespace Explorer } else { - GUIUnstrip.Label(label); + GUILayout.Label(label, null); } } else { // using ValueType.Name instead of ValueTypeName, because we only want the short name. - GUIUnstrip.Label("" + ValueType.Name + "", new GUILayoutOption[] { GUILayout.Width(50) }); + GUILayout.Label("" + ValueType.Name + "", new GUILayoutOption[] { GUILayout.Width(50) }); int dynSize = 25 + (m_valueToString.Length * 15); var maxwidth = window.width - 310f; @@ -77,16 +77,16 @@ namespace Explorer if (dynSize > maxwidth) { - m_valueToString = GUIUnstrip.TextArea(m_valueToString, new GUILayoutOption[] { GUILayout.MaxWidth(maxwidth) }); + m_valueToString = GUILayout.TextArea(m_valueToString, new GUILayoutOption[] { GUILayout.MaxWidth(maxwidth) }); } else { - m_valueToString = GUIUnstrip.TextField(m_valueToString, new GUILayoutOption[] { GUILayout.MaxWidth(dynSize) }); + m_valueToString = GUILayout.TextField(m_valueToString, new GUILayoutOption[] { GUILayout.MaxWidth(dynSize) }); } if (CanWrite) { - if (GUIUnstrip.Button("Apply", new GUILayoutOption[] { GUILayout.Width(60) })) + if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(60) })) { SetValueFromInput(m_valueToString); } diff --git a/src/CachedObjects/Struct/CacheQuaternion.cs b/src/CachedObjects/Struct/CacheQuaternion.cs index 63f8f08..373d56b 100644 --- a/src/CachedObjects/Struct/CacheQuaternion.cs +++ b/src/CachedObjects/Struct/CacheQuaternion.cs @@ -33,57 +33,56 @@ namespace Explorer { if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } - string lbl = $"Quaternion: {((Quaternion)Value).eulerAngles.ToString()}"; - GUIUnstrip.Label(lbl); + GUILayout.Label($"Quaternion: {((Quaternion)Value).eulerAngles.ToString()}", null); if (CanWrite && IsExpanded) { - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); - x = GUIUnstrip.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); + x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); - y = GUIUnstrip.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); + y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); - z = GUIUnstrip.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); + z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); // draw set value button - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - if (GUIUnstrip.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) + if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); } } diff --git a/src/CachedObjects/Struct/CacheRect.cs b/src/CachedObjects/Struct/CacheRect.cs index 1e11777..5d3ed22 100644 --- a/src/CachedObjects/Struct/CacheRect.cs +++ b/src/CachedObjects/Struct/CacheRect.cs @@ -35,62 +35,62 @@ namespace Explorer { if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } - GUIUnstrip.Label($"Rect: {((Rect)Value).ToString()}"); + GUILayout.Label($"Rect: {((Rect)Value).ToString()}", null); if (CanWrite && IsExpanded) { - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); - x = GUIUnstrip.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); + x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); - y = GUIUnstrip.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); + y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) }); - w = GUIUnstrip.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) }); + w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("H:", new GUILayoutOption[] { GUILayout.Width(30) }); - h = GUIUnstrip.TextField(h, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("H:", new GUILayoutOption[] { GUILayout.Width(30) }); + h = GUILayout.TextField(h, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); // draw set value button - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - if (GUIUnstrip.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) + if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); } } diff --git a/src/CachedObjects/Struct/CacheVector.cs b/src/CachedObjects/Struct/CacheVector.cs index bc53125..8b0087a 100644 --- a/src/CachedObjects/Struct/CacheVector.cs +++ b/src/CachedObjects/Struct/CacheVector.cs @@ -70,70 +70,70 @@ namespace Explorer { if (!IsExpanded) { - if (GUIUnstrip.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("v", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = true; } } else { - if (GUIUnstrip.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) + if (GUILayout.Button("^", new GUILayoutOption[] { GUILayout.Width(25) })) { IsExpanded = false; } } } - GUIUnstrip.Label($"Vector{VectorSize}: {(string)m_toStringMethod.Invoke(Value, new object[0])}"); + GUILayout.Label($"Vector{VectorSize}: {(string)m_toStringMethod.Invoke(Value, new object[0])}", null); if (CanWrite && IsExpanded) { - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); var whitespace = CalcWhitespace(window); // always draw x and y - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); - x = GUIUnstrip.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(30) }); + x = GUILayout.TextField(x, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); - y = GUIUnstrip.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(30) }); + y = GUILayout.TextField(y, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); if (VectorSize > 2) { // draw z - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); - z = GUIUnstrip.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(30) }); + z = GUILayout.TextField(z, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); } if (VectorSize > 3) { // draw w - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - GUIUnstrip.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) }); - w = GUIUnstrip.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) }); - GUIUnstrip.EndHorizontal(); + GUILayout.Label("W:", new GUILayoutOption[] { GUILayout.Width(30) }); + w = GUILayout.TextField(w, new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.EndHorizontal(); } // draw set value button - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUIUnstrip.Space(whitespace); - if (GUIUnstrip.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) + if (GUILayout.Button("Apply", new GUILayoutOption[] { GUILayout.Width(155) })) { SetValueFromInput(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); } } diff --git a/src/CppExplorer.cs b/src/CppExplorer.cs index 90433f7..2478d67 100644 --- a/src/CppExplorer.cs +++ b/src/CppExplorer.cs @@ -13,7 +13,7 @@ namespace Explorer public class CppExplorer : MelonMod { public const string NAME = "CppExplorer"; - public const string VERSION = "1.7.2"; + public const string VERSION = "1.7.3"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.cppexplorer"; diff --git a/src/CppExplorer.csproj b/src/CppExplorer.csproj index d11d9eb..a885d57 100644 --- a/src/CppExplorer.csproj +++ b/src/CppExplorer.csproj @@ -107,7 +107,7 @@ - + diff --git a/src/Helpers/PageHelper.cs b/src/Helpers/PageHelper.cs index 20a5995..1f22de2 100644 --- a/src/Helpers/PageHelper.cs +++ b/src/Helpers/PageHelper.cs @@ -51,7 +51,7 @@ namespace Explorer var orig = GUI.skin.label.alignment; GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.Label($"Page {PageOffset + 1}/{MaxPageOffset + 1}", new GUILayoutOption[] { GUILayout.Width(80) }); + GUILayout.Label($"Page {PageOffset + 1}/{MaxPageOffset + 1}", new GUILayoutOption[] { GUILayout.Width(80) }); GUI.skin.label.alignment = orig; } @@ -97,9 +97,9 @@ namespace Explorer public void DrawLimitInputArea() { - GUIUnstrip.Label("Limit: ", new GUILayoutOption[] { GUILayout.Width(50) }); + GUILayout.Label("Limit: ", new GUILayoutOption[] { GUILayout.Width(50) }); var limit = this.ItemsPerPage.ToString(); - limit = GUIUnstrip.TextField(limit, new GUILayoutOption[] { GUILayout.Width(50) }); + limit = GUILayout.TextField(limit, new GUILayoutOption[] { GUILayout.Width(50) }); if (limit != ItemsPerPage.ToString() && int.TryParse(limit, out int i)) { ItemsPerPage = i; diff --git a/src/Helpers/ReflectionHelpers.cs b/src/Helpers/ReflectionHelpers.cs index 60c952b..ba08773 100644 --- a/src/Helpers/ReflectionHelpers.cs +++ b/src/Helpers/ReflectionHelpers.cs @@ -36,9 +36,6 @@ namespace Explorer public static bool IsEnumerable(Type t) { - // Not needed for Il2Cpp at the moment. Don't want these to behave as Enumerables. - //if (typeof(Transform).IsAssignableFrom(t)) return false; - return typeof(IEnumerable).IsAssignableFrom(t); } diff --git a/src/Menu/MainMenu/MainMenu.cs b/src/Menu/MainMenu/MainMenu.cs index 0081db2..f57865e 100644 --- a/src/Menu/MainMenu/MainMenu.cs +++ b/src/Menu/MainMenu/MainMenu.cs @@ -83,7 +83,7 @@ namespace Explorer private void MainHeader() { - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); for (int i = 0; i < Pages.Count; i++) { if (m_currentPage == i) @@ -91,23 +91,23 @@ namespace Explorer else GUI.color = Color.white; - if (GUIUnstrip.Button(Pages[i].Name)) + if (GUILayout.Button(Pages[i].Name, null)) { m_currentPage = i; } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUI.color = Color.white; - InspectUnderMouse.EnableInspect = GUIUnstrip.Toggle(InspectUnderMouse.EnableInspect, "Inspect Under Mouse (Shift + RMB)"); + InspectUnderMouse.EnableInspect = GUILayout.Toggle(InspectUnderMouse.EnableInspect, "Inspect Under Mouse (Shift + RMB)", null); bool mouseState = CursorControl.ForceUnlockMouse; - bool setMouse = GUIUnstrip.Toggle(mouseState, "Force Unlock Mouse (Left Alt)"); + bool setMouse = GUILayout.Toggle(mouseState, "Force Unlock Mouse (Left Alt)", null); if (setMouse != mouseState) CursorControl.ForceUnlockMouse = setMouse; - WindowManager.TabView = GUIUnstrip.Toggle(WindowManager.TabView, "Tab View"); - GUIUnstrip.EndHorizontal(); + WindowManager.TabView = GUILayout.Toggle(WindowManager.TabView, "Tab View", null); + GUILayout.EndHorizontal(); //GUIUnstrip.Space(10); GUIUnstrip.Space(10); diff --git a/src/Menu/MainMenu/Pages/ConsolePage.cs b/src/Menu/MainMenu/Pages/ConsolePage.cs index 706bcc3..d07b4d8 100644 --- a/src/Menu/MainMenu/Pages/ConsolePage.cs +++ b/src/Menu/MainMenu/Pages/ConsolePage.cs @@ -123,19 +123,19 @@ MelonLogger.Log(""hello world"");"; public override void DrawWindow() { - GUIUnstrip.Label("C# REPL Console"); + GUILayout.Label("C# REPL Console", null); GUI.skin.label.alignment = TextAnchor.UpperLeft; - GUIUnstrip.Label("Enter code here as though it is a method body:"); + GUILayout.Label("Enter code here as though it is a method body:", null); inputAreaScroll = GUIUnstrip.BeginScrollView(inputAreaScroll, new GUILayoutOption[] { GUILayout.Height(250) }); - MethodInput = GUIUnstrip.TextArea(MethodInput, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); + MethodInput = GUILayout.TextArea(MethodInput, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); GUIUnstrip.EndScrollView(); - if (GUIUnstrip.Button("Execute")) + if (GUILayout.Button("Execute", null)) { try { @@ -157,24 +157,24 @@ MelonLogger.Log(""hello world"");"; } } - GUIUnstrip.Label("Using directives:"); + GUILayout.Label("Using directives:", null); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Add namespace:", new GUILayoutOption[] { GUILayout.Width(105) }); - UsingInput = GUIUnstrip.TextField(UsingInput, new GUILayoutOption[] { GUILayout.Width(150) }); - if (GUIUnstrip.Button("Add", new GUILayoutOption[] { GUILayout.Width(120) })) + GUILayout.BeginHorizontal(null); + GUILayout.Label("Add namespace:", new GUILayoutOption[] { GUILayout.Width(105) }); + UsingInput = GUILayout.TextField(UsingInput, new GUILayoutOption[] { GUILayout.Width(150) }); + if (GUILayout.Button("Add", new GUILayoutOption[] { GUILayout.Width(120) })) { AddUsing(UsingInput); } - if (GUIUnstrip.Button("Clear All", new GUILayoutOption[] { GUILayout.Width(120) })) + if (GUILayout.Button("Clear All", new GUILayoutOption[] { GUILayout.Width(120) })) { ResetConsole(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); foreach (var asm in UsingDirectives) { - GUIUnstrip.Label(AsmToUsing(asm, true)); + GUILayout.Label(AsmToUsing(asm, true), null); } } diff --git a/src/Menu/MainMenu/Pages/ScenePage.cs b/src/Menu/MainMenu/Pages/ScenePage.cs index bd39d68..bcdd7c3 100644 --- a/src/Menu/MainMenu/Pages/ScenePage.cs +++ b/src/Menu/MainMenu/Pages/ScenePage.cs @@ -200,7 +200,7 @@ namespace Explorer { DrawHeaderArea(); - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); DrawPageButtons(); @@ -213,7 +213,7 @@ namespace Explorer DrawSearchResultsList(); } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } catch { @@ -223,26 +223,26 @@ namespace Explorer private void DrawHeaderArea() { - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); // Current Scene label - GUIUnstrip.Label("Current Scene:", new GUILayoutOption[] { GUILayout.Width(120) }); + GUILayout.Label("Current Scene:", new GUILayoutOption[] { GUILayout.Width(120) }); SceneChangeButtons(); - GUIUnstrip.Label("" + m_currentScene + ""); + GUILayout.Label("" + m_currentScene + "", null); //new GUILayoutOption[] { GUILayout.Width(250) }); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); // ----- GameObject Search ----- - GUIUnstrip.BeginHorizontal(GUI.skin.box, null); - GUIUnstrip.Label("Search Scene:", new GUILayoutOption[] { GUILayout.Width(100) }); + GUILayout.BeginHorizontal(GUI.skin.box, null); + GUILayout.Label("Search Scene:", new GUILayoutOption[] { GUILayout.Width(100) }); - m_searchInput = GUIUnstrip.TextField(m_searchInput); + m_searchInput = GUILayout.TextField(m_searchInput, null); - if (GUIUnstrip.Button("Search", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Search", new GUILayoutOption[] { GUILayout.Width(80) })) { Search(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); GUIUnstrip.Space(5); } @@ -255,11 +255,11 @@ namespace Explorer if (scenes.Count > 1) { int changeWanted = 0; - if (GUIUnstrip.Button("<", new GUILayoutOption[] { GUILayout.Width(30) })) + if (GUILayout.Button("<", new GUILayoutOption[] { GUILayout.Width(30) })) { changeWanted = -1; } - if (GUIUnstrip.Button(">", new GUILayoutOption[] { GUILayout.Width(30) })) + if (GUILayout.Button(">", new GUILayoutOption[] { GUILayout.Width(30) })) { changeWanted = 1; } @@ -282,13 +282,13 @@ namespace Explorer private void DrawPageButtons() { - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); Pages.DrawLimitInputArea(); if (Pages.ItemCount > Pages.ItemsPerPage) { - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Left, ref this.scroll); @@ -297,7 +297,7 @@ namespace Explorer Pages.CurrentPageLabel(); - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Right, ref this.scroll); @@ -305,7 +305,7 @@ namespace Explorer } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); GUI.skin.label.alignment = TextAnchor.UpperLeft; } @@ -313,28 +313,28 @@ namespace Explorer { if (m_currentTransform != null) { - GUIUnstrip.BeginHorizontal(); - if (GUIUnstrip.Button("<-", new GUILayoutOption[] { GUILayout.Width(35) })) + GUILayout.BeginHorizontal(null); + if (GUILayout.Button("<-", new GUILayoutOption[] { GUILayout.Width(35) })) { TraverseUp(); } else { - GUIUnstrip.Label("" + m_currentTransform.GetGameObjectPath() + "", + GUILayout.Label("" + m_currentTransform.GetGameObjectPath() + "", new GUILayoutOption[] { GUILayout.Width(MainMenu.MainRect.width - 187f) }); } UIHelpers.SmallInspectButton(m_currentTransform); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } else { - GUIUnstrip.Label("Scene Root GameObjects:"); + GUILayout.Label("Scene Root GameObjects:", null); if (m_getRootObjectsFailed) { - if (GUIUnstrip.Button("Update Root Object List (auto-update failed!)")) + if (GUILayout.Button("Update Root Object List (auto-update failed!)", null)) { Update_Impl(true); } @@ -359,7 +359,7 @@ namespace Explorer } label += ""; - GUIUnstrip.Label(label); + GUILayout.Label(label, null); } else { @@ -377,12 +377,12 @@ namespace Explorer private void DrawSearchResultsList() { - if (GUIUnstrip.Button("<- Cancel Search", new GUILayoutOption[] { GUILayout.Width(150) })) + if (GUILayout.Button("<- Cancel Search", new GUILayoutOption[] { GUILayout.Width(150) })) { CancelSearch(); } - GUIUnstrip.Label("Search Results:"); + GUILayout.Label("Search Results:", null); if (m_searchResults.Count > 0) { @@ -404,13 +404,13 @@ namespace Explorer } else { - GUIUnstrip.Label("Null or destroyed!"); + GUILayout.Label("Null or destroyed!", null); } } } else { - GUIUnstrip.Label("No results found!"); + GUILayout.Label("No results found!", null); } } diff --git a/src/Menu/MainMenu/Pages/SearchPage.cs b/src/Menu/MainMenu/Pages/SearchPage.cs index 7d08cb5..e982dce 100644 --- a/src/Menu/MainMenu/Pages/SearchPage.cs +++ b/src/Menu/MainMenu/Pages/SearchPage.cs @@ -84,28 +84,28 @@ namespace Explorer try { // helpers - GUIUnstrip.BeginHorizontal(GUI.skin.box, null); - GUIUnstrip.Label("Helpers", new GUILayoutOption[] { GUILayout.Width(70) }); - if (GUIUnstrip.Button("Find Static Instances", new GUILayoutOption[] { GUILayout.Width(180) })) + GUILayout.BeginHorizontal(GUI.skin.box, null); + GUILayout.Label("Helpers", new GUILayoutOption[] { GUILayout.Width(70) }); + if (GUILayout.Button("Find Static Instances", new GUILayoutOption[] { GUILayout.Width(180) })) { //m_searchResults = GetInstanceClassScanner().ToList(); CacheResults(GetInstanceClassScanner()); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); // search box SearchBox(); // results - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.Label("Results " + " (" + m_searchResults.Count + ")"); + GUILayout.Label("Results " + " (" + m_searchResults.Count + ")", null); GUI.skin.label.alignment = TextAnchor.UpperLeft; int count = m_searchResults.Count; - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); Pages.DrawLimitInputArea(); @@ -115,21 +115,21 @@ namespace Explorer if (Pages.ItemCount > Pages.ItemsPerPage) { - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Left, ref this.resultsScroll); } Pages.CurrentPageLabel(); - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Right, ref this.resultsScroll); } } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); resultsScroll = GUIUnstrip.BeginScrollView(resultsScroll); @@ -146,11 +146,11 @@ namespace Explorer } else { - GUIUnstrip.Label("No results found!"); + GUILayout.Label("No results found!", null); } GUIUnstrip.EndScrollView(); - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } catch { @@ -160,52 +160,52 @@ namespace Explorer private void SearchBox() { - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); // ----- GameObject Search ----- GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.Label("Search"); + GUILayout.Label("Search", null); GUI.skin.label.alignment = TextAnchor.UpperLeft; - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); - GUIUnstrip.Label("Name Contains:", new GUILayoutOption[] { GUILayout.Width(100) }); - m_searchInput = GUIUnstrip.TextField(m_searchInput, new GUILayoutOption[] { GUILayout.Width(200) }); + GUILayout.Label("Name Contains:", new GUILayoutOption[] { GUILayout.Width(100) }); + m_searchInput = GUILayout.TextField(m_searchInput, new GUILayoutOption[] { GUILayout.Width(200) }); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); - GUIUnstrip.Label("Class Filter:", new GUILayoutOption[] { GUILayout.Width(100) }); + GUILayout.Label("Class Filter:", new GUILayoutOption[] { GUILayout.Width(100) }); ClassFilterToggle(TypeFilter.Object, "Object"); ClassFilterToggle(TypeFilter.GameObject, "GameObject"); ClassFilterToggle(TypeFilter.Component, "Component"); ClassFilterToggle(TypeFilter.Custom, "Custom"); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); if (TypeMode == TypeFilter.Custom) { - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUI.skin.label.alignment = TextAnchor.MiddleRight; - GUIUnstrip.Label("Custom Class:", new GUILayoutOption[] { GUILayout.Width(250) }); + GUILayout.Label("Custom Class:", new GUILayoutOption[] { GUILayout.Width(250) }); GUI.skin.label.alignment = TextAnchor.UpperLeft; - m_typeInput = GUIUnstrip.TextField(m_typeInput, new GUILayoutOption[] { GUILayout.Width(250) }); - GUIUnstrip.EndHorizontal(); + m_typeInput = GUILayout.TextField(m_typeInput, new GUILayoutOption[] { GUILayout.Width(250) }); + GUILayout.EndHorizontal(); } - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Scene Filter:", new GUILayoutOption[] { GUILayout.Width(100) }); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Scene Filter:", new GUILayoutOption[] { GUILayout.Width(100) }); SceneFilterToggle(SceneFilter.Any, "Any", 60); SceneFilterToggle(SceneFilter.This, "This Scene", 100); SceneFilterToggle(SceneFilter.DontDestroy, "DontDestroyOnLoad", 140); SceneFilterToggle(SceneFilter.None, "No Scene", 80); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - if (GUIUnstrip.Button("Search")) + if (GUILayout.Button("Search", null)) { Search(); } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } private void ClassFilterToggle(TypeFilter mode, string label) @@ -218,7 +218,7 @@ namespace Explorer { GUI.color = Color.white; } - if (GUIUnstrip.Button(label, new GUILayoutOption[] { GUILayout.Width(100) })) + if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(100) })) { TypeMode = mode; } @@ -235,7 +235,7 @@ namespace Explorer { GUI.color = Color.white; } - if (GUIUnstrip.Button(label, new GUILayoutOption[] { GUILayout.Width(width) })) + if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(width) })) { SceneMode = mode; } diff --git a/src/Menu/Windows/ResizeDrag.cs b/src/Menu/ResizeDrag.cs similarity index 57% rename from src/Menu/Windows/ResizeDrag.cs rename to src/Menu/ResizeDrag.cs index 0d9105f..2f58fc4 100644 --- a/src/Menu/Windows/ResizeDrag.cs +++ b/src/Menu/ResizeDrag.cs @@ -26,38 +26,41 @@ namespace Explorer try { - GUIUnstrip.BeginHorizontal(GUI.skin.box, null); + GUILayout.BeginHorizontal(GUI.skin.box, null); GUI.skin.label.alignment = TextAnchor.MiddleCenter; - GUIUnstrip.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 = LayoutUtilityUnstrip.GetLastRect(); var mousePos = InputHelper.mousePosition; - var mouse = GUIUnstrip.ScreenToGUIPoint(new Vector2(mousePos.x, Screen.height - mousePos.y)); - - if (r.Contains(mouse) && InputHelper.GetMouseButtonDown(0)) + try { - isResizing = true; - m_currentWindow = ID; - m_currentResize = new Rect(mouse.x, mouse.y, _rect.width, _rect.height); - } - else if (!InputHelper.GetMouseButton(0)) - { - isResizing = false; - } + var mouse = GUIUtility.ScreenToGUIPoint(new Vector2(mousePos.x, Screen.height - mousePos.y)); + if (r.Contains(mouse) && InputHelper.GetMouseButtonDown(0)) + { + isResizing = true; + m_currentWindow = ID; + m_currentResize = new Rect(mouse.x, mouse.y, _rect.width, _rect.height); + } + else if (!InputHelper.GetMouseButton(0)) + { + isResizing = false; + } - if (isResizing && ID == m_currentWindow) - { - _rect.width = Mathf.Max(100, m_currentResize.width + (mouse.x - m_currentResize.x)); - _rect.height = Mathf.Max(100, m_currentResize.height + (mouse.y - m_currentResize.y)); - _rect.xMax = Mathf.Min(Screen.width, _rect.xMax); // modifying xMax affects width, not x - _rect.yMax = Mathf.Min(Screen.height, _rect.yMax); // modifying yMax affects height, not y + if (isResizing && ID == m_currentWindow) + { + _rect.width = Mathf.Max(100, m_currentResize.width + (mouse.x - m_currentResize.x)); + _rect.height = Mathf.Max(100, m_currentResize.height + (mouse.y - m_currentResize.y)); + _rect.xMax = Mathf.Min(Screen.width, _rect.xMax); // modifying xMax affects width, not x + _rect.yMax = Mathf.Min(Screen.height, _rect.yMax); // modifying yMax affects height, not y + } } + catch { } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } catch (Il2CppException e) when (e.Message.StartsWith("System.ArgumentException")) { @@ -68,7 +71,7 @@ namespace Explorer { RESIZE_FAILED = true; MelonLogger.Log("Exception on GuiResize: " + e.GetType() + ", " + e.Message); - MelonLogger.Log(e.StackTrace); + //MelonLogger.Log(e.StackTrace); return origRect; } @@ -76,12 +79,12 @@ namespace Explorer } else { - GUIUnstrip.BeginHorizontal(GUI.skin.box, null); + GUILayout.BeginHorizontal(GUI.skin.box, null); - GUIUnstrip.Label("Resize window:", new GUILayoutOption[] { GUILayout.Width(100) }); + GUILayout.Label("Resize window:", new GUILayoutOption[] { GUILayout.Width(100) }); GUI.skin.label.alignment = TextAnchor.MiddleRight; - GUIUnstrip.Label("Width:", new GUILayoutOption[] { GUILayout.Width(60) }); + GUILayout.Label("Width:", new GUILayoutOption[] { GUILayout.Width(60) }); if (GUIUnstrip.RepeatButton("-", new GUILayoutOption[] { GUILayout.Width(20) })) { _rect.width -= 5f; @@ -90,7 +93,7 @@ namespace Explorer { _rect.width += 5f; } - GUIUnstrip.Label("Height:", new GUILayoutOption[] { GUILayout.Width(60) }); + GUILayout.Label("Height:", new GUILayoutOption[] { GUILayout.Width(60) }); if (GUIUnstrip.RepeatButton("-", new GUILayoutOption[] { GUILayout.Width(20) })) { _rect.height -= 5f; @@ -100,7 +103,7 @@ namespace Explorer _rect.height += 5f; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); GUI.skin.label.alignment = TextAnchor.UpperLeft; } diff --git a/src/Menu/UIHelpers.cs b/src/Menu/UIHelpers.cs index f536b0d..d5fcca9 100644 --- a/src/Menu/UIHelpers.cs +++ b/src/Menu/UIHelpers.cs @@ -15,7 +15,7 @@ namespace Explorer // helper for "Instantiate" button on UnityEngine.Objects public static void InstantiateButton(Object obj, float width = 100) { - if (GUIUnstrip.Button("Instantiate", new GUILayoutOption[] { GUILayout.Width(width) })) + if (GUILayout.Button("Instantiate", new GUILayoutOption[] { GUILayout.Width(width) })) { var newobj = Object.Instantiate(obj); @@ -62,18 +62,18 @@ namespace Explorer if (!obj) { - GUIUnstrip.Label("null"); + GUILayout.Label("null", null); return; } // ------ toggle active button ------ - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUI.skin.button.alignment = TextAnchor.UpperLeft; GUI.color = activeColor; - enabled = GUIUnstrip.Toggle(enabled, "", new GUILayoutOption[] { GUILayout.Width(18) }); + enabled = GUILayout.Toggle(enabled, "", new GUILayoutOption[] { GUILayout.Width(18) }); if (obj.activeSelf != enabled) { obj.SetActive(enabled); @@ -81,7 +81,7 @@ namespace Explorer // ------- actual button --------- - if (GUIUnstrip.Button(label, new GUILayoutOption[] { GUILayout.Height(22), GUILayout.Width(width) })) + if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Height(22), GUILayout.Width(width) })) { if (specialInspectMethod != null) { @@ -103,12 +103,12 @@ namespace Explorer SmallInspectButton(_obj); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } public static void SmallInspectButton(object obj) { - if (GUIUnstrip.Button("Inspect")) + if (GUILayout.Button("Inspect", null)) { WindowManager.InspectObject(obj, out bool _); } diff --git a/src/Menu/UIStyles.cs b/src/Menu/UIStyles.cs index 864e51f..4af7df4 100644 --- a/src/Menu/UIStyles.cs +++ b/src/Menu/UIStyles.cs @@ -38,7 +38,7 @@ namespace Explorer var orig = GUI.color; GUI.color = _color; - GUIUnstrip.Box(GUIContent.none, !small ? HorizontalBar : HorizontalBarSmall, null); + GUILayout.Box(GUIContent.none, !small ? HorizontalBar : HorizontalBarSmall, null); GUI.color = orig; } diff --git a/src/Menu/Windows/GameObjectWindow.cs b/src/Menu/Windows/GameObjectWindow.cs index 71866fe..76dc372 100644 --- a/src/Menu/Windows/GameObjectWindow.cs +++ b/src/Menu/Windows/GameObjectWindow.cs @@ -217,52 +217,52 @@ namespace Explorer scroll = GUIUnstrip.BeginScrollView(scroll); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Scene: " + (m_scene == "" ? "n/a" : m_scene) + ""); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Scene: " + (m_scene == "" ? "n/a" : m_scene) + "", null); if (m_scene == UnityHelpers.ActiveSceneName) { - if (GUIUnstrip.Button("Send to Scene View", new GUILayoutOption[] { GUILayout.Width(150) })) + if (GUILayout.Button("Send to Scene View", new GUILayoutOption[] { GUILayout.Width(150) })) { ScenePage.Instance.SetTransformTarget(TargetGO.transform); MainMenu.SetCurrentPage(0); } } - if (GUIUnstrip.Button("Reflection Inspect", new GUILayoutOption[] { GUILayout.Width(150) })) + if (GUILayout.Button("Reflection Inspect", new GUILayoutOption[] { GUILayout.Width(150) })) { WindowManager.InspectObject(Target, out _, true); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Path:", new GUILayoutOption[] { GUILayout.Width(50) }); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Path:", new GUILayoutOption[] { GUILayout.Width(50) }); string pathlabel = TargetGO.transform.GetGameObjectPath(); if (TargetGO.transform.parent != null) { - if (GUIUnstrip.Button("<-", new GUILayoutOption[] { GUILayout.Width(35) })) + if (GUILayout.Button("<-", new GUILayoutOption[] { GUILayout.Width(35) })) { InspectGameObject(TargetGO.transform.parent); } } - GUIUnstrip.TextArea(pathlabel); - GUIUnstrip.EndHorizontal(); + GUILayout.TextArea(pathlabel, null); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Name:", new GUILayoutOption[] { GUILayout.Width(50) }); - GUIUnstrip.TextArea(m_name); - GUIUnstrip.EndHorizontal(); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Name:", new GUILayoutOption[] { GUILayout.Width(50) }); + GUILayout.TextArea(m_name, null); + GUILayout.EndHorizontal(); // --- Horizontal Columns section --- - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); - GUIUnstrip.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) }); + GUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) }); TransformList(rect); - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); - GUIUnstrip.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) }); + GUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.Width(rect.width / 2 - 17) }); ComponentList(rect); - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); - GUIUnstrip.EndHorizontal(); // end horiz columns + GUILayout.EndHorizontal(); // end horiz columns GameObjectControls(); @@ -283,31 +283,31 @@ namespace Explorer private void TransformList(Rect m_rect) { - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); m_transformScroll = GUIUnstrip.BeginScrollView(m_transformScroll); - GUIUnstrip.Label("Children"); + GUILayout.Label("Children", null); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); ChildPages.DrawLimitInputArea(); if (ChildPages.ItemCount > ChildPages.ItemsPerPage) { ChildPages.CurrentPageLabel(); - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { ChildPages.TurnPage(Turn.Left, ref this.m_transformScroll); } - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { ChildPages.TurnPage(Turn.Right, ref this.m_transformScroll); } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); if (m_children != null && m_children.Length > 0) { @@ -319,7 +319,7 @@ namespace Explorer if (!obj) { - GUIUnstrip.Label("null"); + GUILayout.Label("null", null); continue; } @@ -328,44 +328,43 @@ namespace Explorer } else { - GUIUnstrip.Label("None"); + GUILayout.Label("None", null); } GUIUnstrip.EndScrollView(); - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } private void ComponentList(Rect m_rect) { - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); m_compScroll = GUIUnstrip.BeginScrollView(m_compScroll); - GUIUnstrip.Label("Components"); + GUILayout.Label("Components", null); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); CompPages.DrawLimitInputArea(); if (CompPages.ItemCount > CompPages.ItemsPerPage) { CompPages.CurrentPageLabel(); - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { CompPages.TurnPage(Turn.Left, ref this.m_compScroll); } - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { CompPages.TurnPage(Turn.Right, ref this.m_compScroll); } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); - var width = m_rect.width / 2 - 115f; - m_addComponentInput = GUIUnstrip.TextField(m_addComponentInput, new GUILayoutOption[] { GUILayout.Width(width) }); - if (GUIUnstrip.Button("Add Comp")) + GUILayout.BeginHorizontal(null); + m_addComponentInput = GUILayout.TextField(m_addComponentInput, new GUILayoutOption[] { GUILayout.Width(130) }); + if (GUILayout.Button("Add Comp", null)) { if (ReflectionHelpers.GetTypeByName(m_addComponentInput) is Type compType) { @@ -383,7 +382,7 @@ namespace Explorer MelonLogger.LogWarning($"Could not find a type by the name of '{m_addComponentInput}'!"); } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); GUI.skin.button.alignment = TextAnchor.MiddleLeft; if (m_cachedDestroyList.Count > 0) @@ -403,7 +402,7 @@ namespace Explorer var ilType = component.GetIl2CppType(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); if (ReflectionHelpers.BehaviourType.IsAssignableFrom(ilType)) { BehaviourEnabledBtn(component.TryCast()); @@ -412,15 +411,15 @@ namespace Explorer { GUIUnstrip.Space(26); } - if (GUIUnstrip.Button("" + ilType.Name + "", new GUILayoutOption[] { GUILayout.Width(m_rect.width / 2 - 100) })) + if (GUILayout.Button("" + ilType.Name + "", new GUILayoutOption[] { GUILayout.Width(m_rect.width / 2 - 100) })) { ReflectObject(component); } - if (GUIUnstrip.Button("-", new GUILayoutOption[] { GUILayout.Width(20) })) + if (GUILayout.Button("-", new GUILayoutOption[] { GUILayout.Width(20) })) { m_cachedDestroyList.Add(component); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } } @@ -436,7 +435,7 @@ namespace Explorer GUIUnstrip.EndScrollView(); - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } private void BehaviourEnabledBtn(Behaviour obj) @@ -454,7 +453,7 @@ namespace Explorer // ------ toggle active button ------ - _enabled = GUIUnstrip.Toggle(_enabled, "", new GUILayoutOption[] { GUILayout.Width(18) }); + _enabled = GUILayout.Toggle(_enabled, "", new GUILayoutOption[] { GUILayout.Width(18) }); if (obj.enabled != _enabled) { obj.enabled = _enabled; @@ -466,43 +465,43 @@ namespace Explorer { if (m_hideControls) { - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("GameObject Controls", new GUILayoutOption[] { GUILayout.Width(200) }); - if (GUIUnstrip.Button("^ Show ^", new GUILayoutOption[] { GUILayout.Width(75) })) + GUILayout.BeginHorizontal(null); + GUILayout.Label("GameObject Controls", new GUILayoutOption[] { GUILayout.Width(200) }); + if (GUILayout.Button("^ Show ^", new GUILayoutOption[] { GUILayout.Width(75) })) { m_hideControls = false; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); return; } - GUIUnstrip.BeginVertical(GUI.skin.box, new GUILayoutOption[] { GUILayout.Width(520) }); + GUILayout.BeginVertical(GUI.skin.box, new GUILayoutOption[] { GUILayout.Width(520) }); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("GameObject Controls", new GUILayoutOption[] { GUILayout.Width(200) }); - if (GUIUnstrip.Button("v Hide v", new GUILayoutOption[] { GUILayout.Width(75) })) + GUILayout.BeginHorizontal(null); + GUILayout.Label("GameObject Controls", new GUILayoutOption[] { GUILayout.Width(200) }); + if (GUILayout.Button("v Hide v", new GUILayoutOption[] { GUILayout.Width(75) })) { m_hideControls = true; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); bool m_active = TargetGO.activeSelf; - m_active = GUIUnstrip.Toggle(m_active, (m_active ? "Enabled " : "Disabled") + "", + m_active = GUILayout.Toggle(m_active, (m_active ? "Enabled " : "Disabled") + "", new GUILayoutOption[] { GUILayout.Width(80) }); if (TargetGO.activeSelf != m_active) { TargetGO.SetActive(m_active); } UIHelpers.InstantiateButton(TargetGO, 100); - if (GUIUnstrip.Button("Set DontDestroyOnLoad", new GUILayoutOption[] { GUILayout.Width(170) })) + if (GUILayout.Button("Set DontDestroyOnLoad", new GUILayoutOption[] { GUILayout.Width(170) })) { GameObject.DontDestroyOnLoad(TargetGO); TargetGO.hideFlags |= HideFlags.DontUnloadUnusedAsset; } var lbl = m_freeze ? "Unfreeze" : "Freeze Pos/Rot"; - if (GUIUnstrip.Button(lbl, new GUILayoutOption[] { GUILayout.Width(110) })) + if (GUILayout.Button(lbl, new GUILayoutOption[] { GUILayout.Width(110) })) { m_freeze = !m_freeze; if (m_freeze) @@ -511,11 +510,11 @@ namespace Explorer } } - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); - m_setParentInput = GUIUnstrip.TextField(m_setParentInput); - if (GUIUnstrip.Button("Set Parent", new GUILayoutOption[] { GUILayout.Width(80) })) + m_setParentInput = GUILayout.TextField(m_setParentInput, null); + if (GUILayout.Button("Set Parent", new GUILayoutOption[] { GUILayout.Width(80) })) { if (GameObject.Find(m_setParentInput) is GameObject newparent) { @@ -527,20 +526,20 @@ namespace Explorer } } - if (GUIUnstrip.Button("Detach from parent", new GUILayoutOption[] { GUILayout.Width(160) })) + if (GUILayout.Button("Detach from parent", new GUILayoutOption[] { GUILayout.Width(160) })) { TargetGO.transform.parent = null; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); m_cachedInput[0] = TranslateControl(TranslateType.Position, ref m_translateAmount, false); m_cachedInput[1] = TranslateControl(TranslateType.Rotation, ref m_rotateAmount, true); m_cachedInput[2] = TranslateControl(TranslateType.Scale, ref m_scaleAmount, false); - GUIUnstrip.BeginHorizontal(); - if (GUIUnstrip.Button("Apply to Transform") || m_autoApplyTransform) + GUILayout.BeginHorizontal(null); + if (GUILayout.Button("Apply to Transform", null) || m_autoApplyTransform) { if (m_localContext) { @@ -559,19 +558,19 @@ namespace Explorer UpdateFreeze(); } } - if (GUIUnstrip.Button("Update from Transform") || m_autoUpdateTransform) + if (GUILayout.Button("Update from Transform", null) || m_autoUpdateTransform) { CacheTransformValues(); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); BoolToggle(ref m_autoApplyTransform, "Auto-apply to Transform?"); BoolToggle(ref m_autoUpdateTransform, "Auto-update from transform?"); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); bool b = m_localContext; - b = GUIUnstrip.Toggle(b, "Use local transform values?"); + b = GUILayout.Toggle(b, "Use local transform values?", null); if (b != m_localContext) { m_localContext = b; @@ -582,16 +581,16 @@ namespace Explorer } } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); - if (GUIUnstrip.Button("Destroy", new GUILayoutOption[] { GUILayout.Width(120) })) + if (GUILayout.Button("Destroy", new GUILayoutOption[] { GUILayout.Width(120) })) { GameObject.Destroy(TargetGO); DestroyWindow(); return; } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); } private void UpdateFreeze() @@ -615,7 +614,7 @@ namespace Explorer lbl += value ? "lime" : "red"; lbl += $">{message}"; - value = GUIUnstrip.Toggle(value, lbl); + value = GUILayout.Toggle(value, lbl, null); } public enum TranslateType @@ -627,8 +626,8 @@ namespace Explorer private Vector3 TranslateControl(TranslateType mode, ref float amount, bool multByTime) { - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label($"{(m_localContext ? "Local " : "")}{mode}:", + GUILayout.BeginHorizontal(null); + GUILayout.Label($"{(m_localContext ? "Local " : "")}{mode}:", new GUILayoutOption[] { GUILayout.Width(m_localContext ? 110 : 65) }); var transform = TargetGO.transform; @@ -636,42 +635,42 @@ namespace Explorer { case TranslateType.Position: var pos = m_localContext ? transform.localPosition : transform.position; - GUIUnstrip.Label(pos.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); + GUILayout.Label(pos.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); break; case TranslateType.Rotation: var rot = m_localContext ? transform.localEulerAngles : transform.eulerAngles; - GUIUnstrip.Label(rot.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); + GUILayout.Label(rot.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); break; case TranslateType.Scale: - GUIUnstrip.Label(transform.localScale.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); + GUILayout.Label(transform.localScale.ToString(), new GUILayoutOption[] { GUILayout.Width(250) }); break; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); Vector3 input = m_cachedInput[(int)mode]; - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); GUI.skin.label.alignment = TextAnchor.MiddleRight; - GUIUnstrip.Label("X:", new GUILayoutOption[] { GUILayout.Width(20) }); + GUILayout.Label("X:", new GUILayoutOption[] { GUILayout.Width(20) }); PlusMinusFloat(ref input.x, amount, multByTime); - GUIUnstrip.Label("Y:", new GUILayoutOption[] { GUILayout.Width(20) }); + GUILayout.Label("Y:", new GUILayoutOption[] { GUILayout.Width(20) }); PlusMinusFloat(ref input.y, amount, multByTime); - GUIUnstrip.Label("Z:", new GUILayoutOption[] { GUILayout.Width(20) }); + GUILayout.Label("Z:", new GUILayoutOption[] { GUILayout.Width(20) }); PlusMinusFloat(ref input.z, amount, multByTime); - GUIUnstrip.Label("+/-:", new GUILayoutOption[] { GUILayout.Width(30) }); + GUILayout.Label("+/-:", new GUILayoutOption[] { GUILayout.Width(30) }); var amountInput = amount.ToString("F3"); - amountInput = GUIUnstrip.TextField(amountInput, new GUILayoutOption[] { GUILayout.Width(60) }); + amountInput = GUILayout.TextField(amountInput, new GUILayoutOption[] { GUILayout.Width(60) }); if (float.TryParse(amountInput, out float f)) { amount = f; } GUI.skin.label.alignment = TextAnchor.UpperLeft; - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); return input; } @@ -679,7 +678,7 @@ namespace Explorer private void PlusMinusFloat(ref float f, float amount, bool multByTime) { string s = f.ToString("F3"); - s = GUIUnstrip.TextField(s, new GUILayoutOption[] { GUILayout.Width(60) }); + s = GUILayout.TextField(s, new GUILayoutOption[] { GUILayout.Width(60) }); if (float.TryParse(s, out float f2)) { f = f2; diff --git a/src/Menu/Windows/ReflectionWindow.cs b/src/Menu/Windows/ReflectionWindow.cs index 2425838..6288a48 100644 --- a/src/Menu/Windows/ReflectionWindow.cs +++ b/src/Menu/Windows/ReflectionWindow.cs @@ -235,87 +235,87 @@ namespace Explorer GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box); } - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Type: " + TargetType.FullName + "", new GUILayoutOption[] { GUILayout.Width(245f) }); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Type: " + TargetType.FullName + "", new GUILayoutOption[] { GUILayout.Width(245f) }); if (m_uObj) { - GUIUnstrip.Label("Name: " + m_uObj.name); + GUILayout.Label("Name: " + m_uObj.name, null); } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); if (m_uObj) { - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Tools:", new GUILayoutOption[] { GUILayout.Width(80) }); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Tools:", new GUILayoutOption[] { GUILayout.Width(80) }); UIHelpers.InstantiateButton(m_uObj); if (m_component && m_component.gameObject is GameObject obj) { GUI.skin.label.alignment = TextAnchor.MiddleRight; - GUIUnstrip.Label("GameObject:", new GUILayoutOption[] { GUILayout.Width(135) }); + GUILayout.Label("GameObject:", new GUILayoutOption[] { GUILayout.Width(135) }); var charWidth = obj.name.Length * 15; var maxWidth = rect.width - 350; var labelWidth = charWidth < maxWidth ? charWidth : maxWidth; - if (GUIUnstrip.Button("" + obj.name + "", new GUILayoutOption[] { GUILayout.Width(labelWidth) })) + if (GUILayout.Button("" + obj.name + "", new GUILayoutOption[] { GUILayout.Width(labelWidth) })) { WindowManager.InspectObject(obj, out bool _); } GUI.skin.label.alignment = TextAnchor.UpperLeft; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); } UIStyles.HorizontalLine(Color.grey); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Search:", new GUILayoutOption[] { GUILayout.Width(75) }); - m_search = GUIUnstrip.TextField(m_search); - GUIUnstrip.EndHorizontal(); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Search:", new GUILayoutOption[] { GUILayout.Width(75) }); + m_search = GUILayout.TextField(m_search, null); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Filter:", new GUILayoutOption[] { GUILayout.Width(75) }); + GUILayout.BeginHorizontal(null); + GUILayout.Label("Filter:", new GUILayoutOption[] { GUILayout.Width(75) }); FilterToggle(MemberTypes.All, "All"); FilterToggle(MemberTypes.Property, "Properties"); FilterToggle(MemberTypes.Field, "Fields"); FilterToggle(MemberTypes.Method, "Methods"); - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); - GUIUnstrip.Label("Values:", new GUILayoutOption[] { GUILayout.Width(75) }); - if (GUIUnstrip.Button("Update", new GUILayoutOption[] { GUILayout.Width(100) })) + GUILayout.BeginHorizontal(null); + GUILayout.Label("Values:", new GUILayoutOption[] { GUILayout.Width(75) }); + if (GUILayout.Button("Update", new GUILayoutOption[] { GUILayout.Width(100) })) { UpdateValues(); } GUI.color = m_autoUpdate ? Color.green : Color.red; - m_autoUpdate = GUIUnstrip.Toggle(m_autoUpdate, "Auto-update?", new GUILayoutOption[] { GUILayout.Width(100) }); + m_autoUpdate = GUILayout.Toggle(m_autoUpdate, "Auto-update?", new GUILayoutOption[] { GUILayout.Width(100) }); GUI.color = m_hideFailedReflection ? Color.green : Color.red; - m_hideFailedReflection = GUIUnstrip.Toggle(m_hideFailedReflection, "Hide failed Reflection?", new GUILayoutOption[] { GUILayout.Width(150) }); + m_hideFailedReflection = GUILayout.Toggle(m_hideFailedReflection, "Hide failed Reflection?", new GUILayoutOption[] { GUILayout.Width(150) }); GUI.color = Color.white; - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); GUIUnstrip.Space(10); Pages.ItemCount = m_cachedMembersFiltered.Length; // prev/next page buttons - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginHorizontal(null); Pages.DrawLimitInputArea(); if (Pages.ItemCount > Pages.ItemsPerPage) { - if (GUIUnstrip.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Left, ref this.scroll); } Pages.CurrentPageLabel(); - if (GUIUnstrip.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) + if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) })) { Pages.TurnPage(Turn.Right, ref this.scroll); } } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); // ====== BODY ====== @@ -325,7 +325,7 @@ namespace Explorer UIStyles.HorizontalLine(Color.grey); - GUIUnstrip.BeginVertical(GUI.skin.box, null); + GUILayout.BeginVertical(GUI.skin.box, null); var members = this.m_cachedMembersFiltered; int start = Pages.CalculateOffsetIndex(); @@ -334,24 +334,24 @@ namespace Explorer { var holder = members[j]; - GUIUnstrip.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(25) }); + GUILayout.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(25) }); try { holder.Draw(rect, 180f); } catch { - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); continue; } - GUIUnstrip.EndHorizontal(); + GUILayout.EndHorizontal(); // if not last element if (!(j == (start + Pages.ItemsPerPage - 1) || j == (members.Length - 1))) UIStyles.HorizontalLine(new Color(0.07f, 0.07f, 0.07f), true); } - GUIUnstrip.EndVertical(); + GUILayout.EndVertical(); GUIUnstrip.EndScrollView(); if (!WindowManager.TabView) @@ -386,7 +386,7 @@ namespace Explorer { GUI.color = Color.white; } - if (GUIUnstrip.Button(label, new GUILayoutOption[] { GUILayout.Width(100) })) + if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(100) })) { m_filter = mode; Pages.PageOffset = 0; diff --git a/src/Menu/Windows/TabViewWindow.cs b/src/Menu/Windows/TabViewWindow.cs index fafe496..3213172 100644 --- a/src/Menu/Windows/TabViewWindow.cs +++ b/src/Menu/Windows/TabViewWindow.cs @@ -67,8 +67,8 @@ namespace Explorer GUIUnstrip.BeginArea(new Rect(5, 25, m_rect.width - 10, m_rect.height - 35), GUI.skin.box); - GUIUnstrip.BeginVertical(GUI.skin.box, null); - GUIUnstrip.BeginHorizontal(); + GUILayout.BeginVertical(GUI.skin.box, null); + GUILayout.BeginHorizontal(null); GUI.skin.button.alignment = TextAnchor.MiddleLeft; int tabPerRow = Mathf.FloorToInt((float)((decimal)m_rect.width / 238)); int rowCount = 0; @@ -77,8 +77,8 @@ namespace Explorer if (rowCount >= tabPerRow) { rowCount = 0; - GUIUnstrip.EndHorizontal(); - GUIUnstrip.BeginHorizontal(); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(null); } rowCount++; @@ -87,18 +87,18 @@ namespace Explorer GUI.color = focused ? Color.green : Color.white; var window = WindowManager.Windows[i]; - if (GUIUnstrip.Button(color + window.Title + "", new GUILayoutOption[] { GUILayout.Width(200) })) + if (GUILayout.Button(color + window.Title + "", new GUILayoutOption[] { GUILayout.Width(200) })) { TargetTabID = i; } - if (GUIUnstrip.Button("X", new GUILayoutOption[] { GUILayout.Width(22) })) + if (GUILayout.Button("X", new GUILayoutOption[] { GUILayout.Width(22) })) { window.DestroyWindow(); } } GUI.color = Color.white; - GUIUnstrip.EndHorizontal(); - GUIUnstrip.EndVertical(); + GUILayout.EndHorizontal(); + GUILayout.EndVertical(); GUI.skin.button.alignment = TextAnchor.MiddleCenter; m_targetWindow.WindowFunction(m_targetWindow.windowID); diff --git a/src/UnstripFixes/GUIUnstrip.cs b/src/UnstripFixes/GUIUnstrip.cs index b413190..7fd71bc 100644 --- a/src/UnstripFixes/GUIUnstrip.cs +++ b/src/UnstripFixes/GUIUnstrip.cs @@ -52,21 +52,6 @@ namespace Explorer return m_scrollStack; } - // ======== Fix for GUIUtility.ScreenToGuiPoint ======== - - public static Vector2 ScreenToGUIPoint(Vector2 screenPoint) - { - return GUIClip.ClipToWindow(InternalScreenToWindowPoint(screenPoint)); - } - - private static Vector2 InternalScreenToWindowPoint(Vector2 screenPoint) - { - GUIUtility.InternalScreenToWindowPoint_Injected(ref screenPoint, out Vector2 result); - return result; - } - - // ================= Fix for Space ================= - public static void Space(float pixels) { GUIUtility.CheckOnGUI(); @@ -82,7 +67,19 @@ namespace Explorer } } - // ================= Fix for BeginArea ================= + // fix for repeatbutton + + static public bool RepeatButton(Texture image, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(image), GUI.skin.button, options); } + static public bool RepeatButton(string text, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(text), GUI.skin.button, options); } + static public bool RepeatButton(GUIContent content, params GUILayoutOption[] options) { return DoRepeatButton(content, GUI.skin.button, options); } + static public bool RepeatButton(Texture image, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(image), style, options); } + static public bool RepeatButton(string text, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(text), style, options); } + // Make a repeating button. The button returns true as long as the user holds down the mouse + static public bool RepeatButton(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(content, style, options); } + static bool DoRepeatButton(GUIContent content, GUIStyle style, GUILayoutOption[] options) + { return GUI.RepeatButton(LayoutUtilityUnstrip.GetRect(content, style, options), content, style); } + + // 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); } @@ -92,6 +89,7 @@ namespace Explorer 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()); @@ -106,6 +104,7 @@ namespace Explorer GUI.BeginGroup(g.rect, content, style); } + // Close a GUILayout block started with BeginArea static public void EndArea() { if (Event.current.type == EventType.Used) @@ -115,7 +114,7 @@ namespace Explorer GUI.EndGroup(); } - // ================= Fix for BeginGroup ================= + // 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); } @@ -152,196 +151,7 @@ namespace Explorer GUIClip.Internal_Pop(); } - // ================= Fix for BeginVertical ================= - - public static void BeginVertical(params GUILayoutOption[] options) { BeginVertical(GUIContent.none, GUIStyle.none, options); } - public static void BeginVertical(GUIStyle style, params GUILayoutOption[] options) { BeginVertical(GUIContent.none, style, options); } - public static void BeginVertical(string text, GUIStyle style, params GUILayoutOption[] options) { BeginVertical(GUIContent.Temp(text), style, options); } - public static void BeginVertical(Texture image, GUIStyle style, params GUILayoutOption[] options) { BeginVertical(GUIContent.Temp(image), style, options); } - - public static void BeginVertical(GUIContent content, GUIStyle style, params GUILayoutOption[] options) - { - var g = GUILayoutUtility.BeginLayoutGroup(style, options, Il2CppType.Of()); - g.isVertical = true; - if (style != GUIStyle.none || content != GUIContent.none) - GUI.Box(g.rect, content, style); - } - - public static void EndVertical() - { - GUILayoutUtility.EndLayoutGroup(); - } - - // ================= Fix for BeginHorizontal ================== - - public static void BeginHorizontal(params GUILayoutOption[] options) { BeginHorizontal(GUIContent.none, GUIStyle.none, options); } - public static void BeginHorizontal(GUIStyle style, params GUILayoutOption[] options) { BeginHorizontal(GUIContent.none, style, options); } - public static void BeginHorizontal(string text, GUIStyle style, params GUILayoutOption[] options) { BeginHorizontal(GUIContent.Temp(text), style, options); } - - public static void BeginHorizontal(Texture image, GUIStyle style, params GUILayoutOption[] options) - { BeginHorizontal(GUIContent.Temp(image), style, options); } - public static void BeginHorizontal(GUIContent content, GUIStyle style, params GUILayoutOption[] options) - { - GUILayoutGroup g = GUILayoutUtility.BeginLayoutGroup(style, options, Il2CppType.Of()); - g.isVertical = false; - if (style != GUIStyle.none || content != GUIContent.none) - GUI.Box(g.rect, content, style); - } - - public static void EndHorizontal() - { - GUILayoutUtility.EndLayoutGroup(); - } - - // =========== Fix for GUI elements ============= - - static public void Label(Texture image, params GUILayoutOption[] options) { DoLabel(GUIContent.Temp(image), GUI.skin.label, options); } - static public void Label(string text, params GUILayoutOption[] options) { DoLabel(GUIContent.Temp(text), GUI.skin.label, options); } - static public void Label(GUIContent content, params GUILayoutOption[] options) { DoLabel(content, GUI.skin.label, options); } - static public void Label(Texture image, GUIStyle style, params GUILayoutOption[] options) { DoLabel(GUIContent.Temp(image), style, options); } - static public void Label(string text, GUIStyle style, params GUILayoutOption[] options) { DoLabel(GUIContent.Temp(text), style, options); } - // Make an auto-layout label. - static public void Label(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { DoLabel(content, style, options); } - static void DoLabel(GUIContent content, GUIStyle style, GUILayoutOption[] options) - { GUI.Label(LayoutUtilityUnstrip.GetRect(content, style, options), content, style); } - - static public void Box(Texture image, params GUILayoutOption[] options) { DoBox(GUIContent.Temp(image), GUI.skin.box, options); } - static public void Box(string text, params GUILayoutOption[] options) { DoBox(GUIContent.Temp(text), GUI.skin.box, options); } - static public void Box(GUIContent content, params GUILayoutOption[] options) { DoBox(content, GUI.skin.box, options); } - static public void Box(Texture image, GUIStyle style, params GUILayoutOption[] options) { DoBox(GUIContent.Temp(image), style, options); } - static public void Box(string text, GUIStyle style, params GUILayoutOption[] options) { DoBox(GUIContent.Temp(text), style, options); } - // Make an auto-layout box. - static public void Box(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { DoBox(content, style, options); } - static void DoBox(GUIContent content, GUIStyle style, GUILayoutOption[] options) - { GUI.Box(LayoutUtilityUnstrip.GetRect(content, style, options), content, style); } - - static public bool Button(Texture image, params GUILayoutOption[] options) { return DoButton(GUIContent.Temp(image), GUI.skin.button, options); } - static public bool Button(string text, params GUILayoutOption[] options) { return DoButton(GUIContent.Temp(text), GUI.skin.button, options); } - static public bool Button(GUIContent content, params GUILayoutOption[] options) { return DoButton(content, GUI.skin.button, options); } - static public bool Button(Texture image, GUIStyle style, params GUILayoutOption[] options) { return DoButton(GUIContent.Temp(image), style, options); } - static public bool Button(string text, GUIStyle style, params GUILayoutOption[] options) { return DoButton(GUIContent.Temp(text), style, options); } - // Make a single press button. The user clicks them and something happens immediately. - static public bool Button(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { return DoButton(content, style, options); } - static bool DoButton(GUIContent content, GUIStyle style, GUILayoutOption[] options) - { return GUI.Button(LayoutUtilityUnstrip.GetRect(content, style, options), content, style); } - - static public bool RepeatButton(Texture image, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(image), GUI.skin.button, options); } - static public bool RepeatButton(string text, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(text), GUI.skin.button, options); } - static public bool RepeatButton(GUIContent content, params GUILayoutOption[] options) { return DoRepeatButton(content, GUI.skin.button, options); } - static public bool RepeatButton(Texture image, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(image), style, options); } - static public bool RepeatButton(string text, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(GUIContent.Temp(text), style, options); } - // Make a repeating button. The button returns true as long as the user holds down the mouse - static public bool RepeatButton(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { return DoRepeatButton(content, style, options); } - static bool DoRepeatButton(GUIContent content, GUIStyle style, GUILayoutOption[] options) - { return RepeatButton(LayoutUtilityUnstrip.GetRect(content, style, options), content, style); } - - public static string TextField(string text, params GUILayoutOption[] options) { return DoTextField(text, -1, false, GUI.skin.textField, options); } - public static string TextField(string text, int maxLength, params GUILayoutOption[] options) { return DoTextField(text, maxLength, false, GUI.skin.textField, options); } - public static string TextField(string text, GUIStyle style, params GUILayoutOption[] options) { return DoTextField(text, -1, false, style, options); } - // Make a single-line text field where the user can edit a string. - public static string TextField(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options) { return DoTextField(text, maxLength, false, style, options); } - - public static string TextArea(string text, params GUILayoutOption[] options) { return DoTextField(text, -1, true, GUI.skin.textArea, options); } - public static string TextArea(string text, int maxLength, params GUILayoutOption[] options) { return DoTextField(text, maxLength, true, GUI.skin.textArea, options); } - public static string TextArea(string text, GUIStyle style, params GUILayoutOption[] options) { return DoTextField(text, -1, true, style, options); } - // Make a multi-line text field where the user can edit a string. - public static string TextArea(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options) { return DoTextField(text, maxLength, true, style, options); } - - static string DoTextField(string text, int maxLength, bool multiline, GUIStyle style, GUILayoutOption[] options) - { - int id = GUIUtility.GetControlID(FocusType.Keyboard); - GUIContent content; - Rect r; - if (GUIUtility.keyboardControl != id) - content = GUIContent.Temp(text); - else - content = GUIContent.Temp(text + GUIUtility.compositionString); - - r = LayoutUtilityUnstrip.GetRect(content, style, options); - if (GUIUtility.keyboardControl == id) - content = GUIContent.Temp(text); - GUI.DoTextField(r, id, content, multiline, maxLength, style); - return content.text; - } - - static public bool Toggle(bool value, Texture image, params GUILayoutOption[] options) { return DoToggle(value, GUIContent.Temp(image), GUI.skin.toggle, options); } - static public bool Toggle(bool value, string text, params GUILayoutOption[] options) { return DoToggle(value, GUIContent.Temp(text), GUI.skin.toggle, options); } - static public bool Toggle(bool value, GUIContent content, params GUILayoutOption[] options) { return DoToggle(value, content, GUI.skin.toggle, options); } - static public bool Toggle(bool value, Texture image, GUIStyle style, params GUILayoutOption[] options) { return DoToggle(value, GUIContent.Temp(image), style, options); } - static public bool Toggle(bool value, string text, GUIStyle style, params GUILayoutOption[] options) { return DoToggle(value, GUIContent.Temp(text), style, options); } - // Make an on/off toggle button. - static public bool Toggle(bool value, GUIContent content, GUIStyle style, params GUILayoutOption[] options) { return DoToggle(value, content, style, options); } - - static bool DoToggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options) - { return GUI.Toggle(LayoutUtilityUnstrip.GetRect(content, style, options), value, content, style); } - - // =========== Fix for GUI.RepeatButton (not GUILayout) =========== - - public static bool RepeatButton(Rect position, string text) - { - return DoRepeatButton(position, GUIContent.Temp(text), GUI.s_Skin.button, FocusType.Passive); - } - - public static bool RepeatButton(Rect position, Texture image) - { - return DoRepeatButton(position, GUIContent.Temp(image), GUI.s_Skin.button, FocusType.Passive); - } - - public static bool RepeatButton(Rect position, GUIContent content) - { - return DoRepeatButton(position, content, GUI.s_Skin.button, FocusType.Passive); - } - - public static bool RepeatButton(Rect position, string text, GUIStyle style) - { - return DoRepeatButton(position, GUIContent.Temp(text), style, FocusType.Passive); - } - - public static bool RepeatButton(Rect position, Texture image, GUIStyle style) - { - return DoRepeatButton(position, GUIContent.Temp(image), style, FocusType.Passive); - } - - public static bool RepeatButton(Rect position, GUIContent content, GUIStyle style) - { - return DoRepeatButton(position, content, style, FocusType.Passive); - } - - private static bool DoRepeatButton(Rect position, GUIContent content, GUIStyle style, FocusType focusType) - { - int id = GUIUtility.GetControlID(GUI.s_RepeatButtonHash, focusType, position); - switch (Event.current.GetTypeForControl(id)) - { - case EventType.MouseDown: - // If the mouse is inside the button, we say that we're the hot control - if (position.Contains(Event.current.mousePosition)) - { - GUIUtility.hotControl = id; - Event.current.Use(); - } - return false; - case EventType.MouseUp: - if (GUIUtility.hotControl == id) - { - GUIUtility.hotControl = 0; - - // If we got the mousedown, the mouseup is ours as well - // (no matter if the click was in the button or not) - Event.current.Use(); - - // But we only return true if the button was actually clicked - return position.Contains(Event.current.mousePosition); - } - return false; - case EventType.Repaint: - style.Draw(position, content, id, false, position.Contains(Event.current.mousePosition)); - return id == GUIUtility.hotControl && position.Contains(Event.current.mousePosition); - } - return false; - } - - - // ================= Fix for BeginScrollView. ======================= + // Fix for BeginScrollView. public static Vector2 BeginScrollView(Vector2 scroll, params GUILayoutOption[] options) { @@ -350,7 +160,7 @@ namespace Explorer { try { - return GUIUnstrip.BeginScrollView(scroll, options); + return GUILayout.BeginScrollView(scroll, options); } catch { @@ -382,7 +192,7 @@ namespace Explorer if (!ScrollFailed) { - GUIUnstrip.EndScrollView(); + GUILayout.EndScrollView(); } else if (!ManualUnstripFailed) {