Показать сообщение отдельно
Старый 08.04.2014, 09:08   #1909
pax
Unity/C# кодер
 
Аватар для pax
 
Регистрация: 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 areaRectGUIStyle style)
    {
        
GUILayout.BeginArea(areaRectstyle);
    }

    public 
LayoutArea(Rect areaRectGUIContent contentGUIStyle style)
    {
        
GUILayout.BeginArea(areaRectcontentstyle);
    }

    public 
LayoutArea(Rect areaRectGUIContent content)
    {
        
GUILayout.BeginArea(areaRectcontent);
    }

    public 
LayoutArea(Rect areaRectstring contentGUIStyle style)
    {
        
GUILayout.BeginArea(areaRectcontentstyle);
    }

    public 
LayoutArea(Rect areaRectstring content)
    {
        
GUILayout.BeginArea(areaRectcontent);
    }

    public 
void Dispose()
    {
        
GUILayout.EndArea();
    }
}



public class 
LayoutHorizontal System.IDisposable
{
    public 
LayoutHorizontal(params GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(options);
    }

    public 
LayoutHorizontal(Texture2D contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
    }

    public 
LayoutHorizontal(GUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(styleoptions);
    }

    public 
LayoutHorizontal(GUIContent contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
    }

    public 
LayoutHorizontal(string contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
    }

    public 
void Dispose()
    {
        
GUILayout.EndHorizontal();
    }
}

public class 
LayoutHorizontalCenter System.IDisposable
{

    public 
LayoutHorizontalCenter(params GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(options);
        
GUILayout.FlexibleSpace();
    }

    public 
LayoutHorizontalCenter(Texture2D contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
        
GUILayout.FlexibleSpace();
    }

    public 
LayoutHorizontalCenter(GUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(styleoptions);
        
GUILayout.FlexibleSpace();
    }

    public 
LayoutHorizontalCenter(GUIContent contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
        
GUILayout.FlexibleSpace();
    }

    public 
LayoutHorizontalCenter(string contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginHorizontal(contentstyleoptions);
        
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 contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginVertical(contentstyleoptions);
    }

    public 
LayoutVertical(GUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginVertical(styleoptions);
    }

    public 
LayoutVertical(GUIContent contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginVertical(contentstyleoptions);
    }

    public 
LayoutVertical(string contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
GUILayout.BeginVertical(contentstyleoptions);
    }

    public 
void Dispose()
    {
        
GUILayout.EndVertical();
    }
}


public class 
LayoutScrollView System.IDisposable
{
    public 
LayoutScrollView(ref Vector2 scrollparams GUILayoutOption[] options)
    {
        
scroll GUILayout.BeginScrollView(scrolloptions);
    }

    public 
LayoutScrollView(ref Vector2 scrollbool alwaysShowHorizontalbool alwaysShowVerticalparams GUILayoutOption[] options)
    {
        
scroll GUILayout.BeginScrollView(scrollalwaysShowHorizontalalwaysShowVerticaloptions);
    }

    public 
LayoutScrollView(ref Vector2 scrollGUIStyle styleparams GUILayoutOption[] options)
    {
        
scroll GUILayout.BeginScrollView(scrollstyleoptions);
    }

    public 
LayoutScrollView(ref Vector2 scrollstring contentGUIStyle styleparams GUILayoutOption[] options)
    {
        
scroll GUILayout.BeginScrollView(scrollcontentstyleoptions);
    }

    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.rcolor.gcolor.bcolor._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.rcolor.gcolor.bcolor._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.rcolor.gcolor.bcolor._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.widthScreen.height)))
{
    ...

__________________
Blitz3d to Unity Wiki
(Offline)
 
Ответить с цитированием
Сообщение было полезно следующим пользователям:
WISHMASTER35 (09.04.2014)