3
3
using System . Linq ;
4
4
using System . Text ;
5
5
using System . Threading . Tasks ;
6
+ using System . Reflection ;
7
+ using UnhollowerRuntimeLib ;
6
8
using UnityEngine ;
7
9
using Object = UnityEngine . Object ;
8
10
9
11
namespace Explorer
10
12
{
11
13
public class UIHelpers
12
14
{
13
- private static bool ScrollUnstrippingFailed = false ;
14
-
15
- public static Vector2 BeginScrollView ( Vector2 scroll ) => BeginScrollView ( scroll , null ) ;
16
-
17
- public static Vector2 BeginScrollView ( Vector2 scroll , GUIStyle style , params GUILayoutOption [ ] layoutOptions )
18
- {
19
- if ( ScrollUnstrippingFailed ) return scroll ;
20
-
21
- try
22
- {
23
- if ( style != null )
24
- return GUILayout . BeginScrollView ( scroll , style , layoutOptions ) ;
25
- else
26
- return GUILayout . BeginScrollView ( scroll , layoutOptions ) ;
27
- }
28
- catch
29
- {
30
- ScrollUnstrippingFailed = true ;
31
- return scroll ;
32
- }
33
- }
34
-
35
- public static void EndScrollView ( )
36
- {
37
- if ( ScrollUnstrippingFailed ) return ;
38
-
39
- GUILayout . EndScrollView ( ) ;
40
- }
41
-
42
15
// helper for "Instantiate" button on UnityEngine.Objects
43
16
public static void InstantiateButton ( Object obj , float width = 100 )
44
17
{
@@ -51,13 +24,13 @@ public static void InstantiateButton(Object obj, float width = 100)
51
24
}
52
25
53
26
// helper for drawing a styled button for a GameObject or Transform
54
- public static void GameobjButton ( object _obj , Action < Transform > specialInspectMethod = null , bool showSmallInspectBtn = true , float width = 380 )
27
+ public static void GOButton ( object _obj , Action < Transform > specialInspectMethod = null , bool showSmallInspectBtn = true , float width = 380 )
55
28
{
56
29
var obj = ( _obj as GameObject ) ?? ( _obj as Transform ) . gameObject ;
57
30
58
- bool children = obj . transform . childCount > 0 ;
31
+ bool hasChild = obj . transform . childCount > 0 ;
59
32
60
- string label = children ? "[" + obj . transform . childCount + " children] " : "" ;
33
+ string label = hasChild ? $ "[ { obj . transform . childCount } children] " : "" ;
61
34
label += obj . name ;
62
35
63
36
bool enabled = obj . activeSelf ;
@@ -80,10 +53,10 @@ public static void GameobjButton(object _obj, Action<Transform> specialInspectMe
80
53
color = Color . red ;
81
54
}
82
55
83
- FastGameobjButton ( _obj , color , label , obj . activeSelf , specialInspectMethod , showSmallInspectBtn , width ) ;
56
+ GOButton_Impl ( _obj , color , label , obj . activeSelf , specialInspectMethod , showSmallInspectBtn , width ) ;
84
57
}
85
58
86
- public static void FastGameobjButton ( object _obj , Color activeColor , string label , bool enabled , Action < Transform > specialInspectMethod = null , bool showSmallInspectBtn = true , float width = 380 )
59
+ public static void GOButton_Impl ( object _obj , Color activeColor , string label , bool enabled , Action < Transform > specialInspectMethod = null , bool showSmallInspectBtn = true , float width = 380 )
87
60
{
88
61
var obj = _obj as GameObject ?? ( _obj as Transform ) . gameObject ;
89
62
0 commit comments