Ejemplo n.º 1
0
 static GizmoHelper()
 {
     defaultLabelStyle = new EditorLabelStyle(EditorLabelStyle.Default)
     {
         fontSize  = normalFontSize,
         textColor = defaultTextColor
     };
 }
Ejemplo n.º 2
0
 public static void Label(GUIContent content, EditorLabelStyle style)
 {
     #if UNITY_EDITOR
     var oldBg = GUI.backgroundColor;
     GUI.backgroundColor = style.backgroundColor;
     var labelStyle = style.GetGUIStyle();
     GUILayout.Box(content, labelStyle);
     GUI.backgroundColor = oldBg;
     #endif
 }
Ejemplo n.º 3
0
 public EditorLabelStyle(EditorLabelStyle src)
 {
     fontSize        = src.fontSize;
     textColor       = src.textColor;
     backgroundColor = src.backgroundColor;
     margin          = new RectOffset(src.margin.left, src.margin.right, src.margin.top, src.margin.bottom);
     padding         = new RectOffset(src.padding.left, src.padding.right, src.padding.top, src.padding.bottom);
     alignment       = src.alignment;
     richText        = src.richText;
 }
Ejemplo n.º 4
0
        public static void Label(Vector3 position, string text, EditorLabelStyle style, LabelSize size = LabelSize.Normal)
        {
#if UNITY_EDITOR
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            var oldBgColor = GUI.backgroundColor;
            GUI.backgroundColor = style.backgroundColor;
            GUIStyle guiStyle = SetLabelSize(style.GetGUIStyle(), size);
            Handles.Label(position, text, guiStyle);
            GUI.backgroundColor = oldBgColor;
#endif
        }
Ejemplo n.º 5
0
        public static void Label(Vector3 position, string text, Color?bgColor = null, Color?textColor = null, LabelSize size = LabelSize.Normal)
        {
#if UNITY_EDITOR
            var style = new EditorLabelStyle(defaultLabelStyle);
            if (bgColor.HasValue)
            {
                style.backgroundColor = bgColor.Value;
            }
            if (textColor.HasValue)
            {
                style.textColor = textColor.Value;
            }
            Label(position, text, style, size);
#endif
        }
Ejemplo n.º 6
0
 public static void Label(string text, EditorLabelStyle style)
 {
     Label(new GUIContent(text), style);
 }
Ejemplo n.º 7
0
 public static void Label(Rect position, string text, EditorLabelStyle style)
 {
     Label(position, new GUIContent(text), style);
 }