Пример #1
0
        public static IDisposable LabelWidth(float width)
        {
            var prevWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = width;
            return(DisposableAction.Create(() => EditorGUIUtility.labelWidth = prevWidth));
        }
Пример #2
0
        public static IDisposable Color(Color color)
        {
            var oldColor = GUI.color;

            GUI.color = color;
            return(DisposableAction.Create(() => GUI.color = oldColor));
        }
Пример #3
0
        public static IDisposable Enabled(bool enabled)
        {
            bool wasEnabled = GUI.enabled;

            GUI.enabled = wasEnabled && enabled;
            return(DisposableAction.Create(() => GUI.enabled = wasEnabled));
        }
Пример #4
0
 public static IDisposable Area(Rect rect)
 {
     GUILayout.BeginArea(rect);
     return(DisposableAction.Create(() => GUILayout.EndArea()));
 }
Пример #5
0
 internal static IDisposable Horizontal(params GUILayoutOption[] options)
 {
     EditorGUILayout.BeginHorizontal(options);
     return(DisposableAction.Create(EditorGUILayout.EndHorizontal));
 }
Пример #6
0
 internal static IDisposable Vertical(GUIStyle style, params GUILayoutOption[] options)
 {
     EditorGUILayout.BeginVertical(style, options);
     return(DisposableAction.Create(EditorGUILayout.EndVertical));
 }
Пример #7
0
 public static IDisposable ScrollViewWindow(Vector2 scroll)
 {
     EditorGUILayout.BeginScrollView(scroll, false, false, GUIStyle.none, GUIStyle.none, GUIStyle.none);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }
Пример #8
0
 public static IDisposable ScrollView(ref Vector2 scroll, GUIStyle style, params GUILayoutOption[] options)
 {
     scroll = EditorGUILayout.BeginScrollView(scroll, style, options);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }
Пример #9
0
 public static IDisposable ScrollView(ref Vector2 scroll)
 {
     scroll = EditorGUILayout.BeginScrollView(scroll);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }