Unity/C# кодер
Регистрация: 03.10.2005
Адрес: Россия, Рязань
Сообщений: 7,568
Написано 3,006 полезных сообщений (для 5,323 пользователей)
|
Ответ: Вопросы от новичка
Держи мой вариант:

using UnityEngine;
public class LayoutArea : System.IDisposable { public LayoutArea(Rect areaRect) { GUILayout.BeginArea(areaRect); }
public LayoutArea(Rect areaRect, GUIStyle style) { GUILayout.BeginArea(areaRect, style); }
public LayoutArea(Rect areaRect, GUIContent content, GUIStyle style) { GUILayout.BeginArea(areaRect, content, style); }
public LayoutArea(Rect areaRect, GUIContent content) { GUILayout.BeginArea(areaRect, content); }
public LayoutArea(Rect areaRect, string content, GUIStyle style) { GUILayout.BeginArea(areaRect, content, style); }
public LayoutArea(Rect areaRect, string content) { GUILayout.BeginArea(areaRect, content); }
public void Dispose() { GUILayout.EndArea(); } }
public class LayoutHorizontal : System.IDisposable { public LayoutHorizontal(params GUILayoutOption[] options) { GUILayout.BeginHorizontal(options); }
public LayoutHorizontal(Texture2D content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); }
public LayoutHorizontal(GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(style, options); }
public LayoutHorizontal(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); }
public LayoutHorizontal(string content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); }
public void Dispose() { GUILayout.EndHorizontal(); } }
public class LayoutHorizontalCenter : System.IDisposable {
public LayoutHorizontalCenter(params GUILayoutOption[] options) { GUILayout.BeginHorizontal(options); GUILayout.FlexibleSpace(); }
public LayoutHorizontalCenter(Texture2D content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); GUILayout.FlexibleSpace(); }
public LayoutHorizontalCenter(GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(style, options); GUILayout.FlexibleSpace(); }
public LayoutHorizontalCenter(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); GUILayout.FlexibleSpace(); }
public LayoutHorizontalCenter(string content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginHorizontal(content, style, options); GUILayout.FlexibleSpace(); }
public void Dispose() { GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }
public class LayoutVertical : System.IDisposable { public LayoutVertical(params GUILayoutOption[] options) { GUILayout.BeginVertical(options); }
public LayoutVertical(Texture2D content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginVertical(content, style, options); }
public LayoutVertical(GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginVertical(style, options); }
public LayoutVertical(GUIContent content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginVertical(content, style, options); }
public LayoutVertical(string content, GUIStyle style, params GUILayoutOption[] options) { GUILayout.BeginVertical(content, style, options); }
public void Dispose() { GUILayout.EndVertical(); } }
public class LayoutScrollView : System.IDisposable { public LayoutScrollView(ref Vector2 scroll, params GUILayoutOption[] options) { scroll = GUILayout.BeginScrollView(scroll, options); }
public LayoutScrollView(ref Vector2 scroll, bool alwaysShowHorizontal, bool alwaysShowVertical, params GUILayoutOption[] options) { scroll = GUILayout.BeginScrollView(scroll, alwaysShowHorizontal, alwaysShowVertical, options); }
public LayoutScrollView(ref Vector2 scroll, GUIStyle style, params GUILayoutOption[] options) { scroll = GUILayout.BeginScrollView(scroll, style, options); }
public LayoutScrollView(ref Vector2 scroll, string content, GUIStyle style, params GUILayoutOption[] options) { scroll = GUILayout.BeginScrollView(scroll, content, style, options); }
public void Dispose() { GUILayout.EndScrollView(); } }
public class LayoutCenter : System.IDisposable { public LayoutCenter() { GUILayout.FlexibleSpace(); }
public void Dispose() { GUILayout.FlexibleSpace(); } }
public class LayoutLeft : System.IDisposable { public void Dispose() { GUILayout.FlexibleSpace(); } }
public class LayoutRight : System.IDisposable { public LayoutRight() { GUILayout.FlexibleSpace(); }
public void Dispose() { } }
public class LayoutColor : System.IDisposable { private readonly Color _color;
public LayoutColor(Color color) { _color = GUI.color; GUI.color = new Color(color.r, color.g, color.b, color.a * _color.a); }
public void Dispose() { GUI.color = _color; } }
public class LayoutContentColor : System.IDisposable { private readonly Color _color;
public LayoutContentColor(Color color) { _color = GUI.contentColor; GUI.contentColor = new Color(color.r, color.g, color.b, color.a * _color.a); }
public void Dispose() { GUI.contentColor = _color; } }
public class LayoutBackgroundColor : System.IDisposable { private readonly Color _color;
public LayoutBackgroundColor(Color color) { _color = GUI.backgroundColor; GUI.backgroundColor = new Color(color.r, color.g, color.b, color.a * _color.a); }
public void Dispose() { GUI.backgroundColor = _color; } }
public class LayoutEnabled : System.IDisposable { private readonly bool _enabled; private Color _color; public LayoutEnabled(bool enabled) { _enabled = GUI.enabled; GUI.enabled = enabled; }
public void Dispose() { GUI.enabled = _enabled; } }
Использование
using(new LayoutArea(new Rect(0,0,Screen.width, Screen.height))) { ... }
|