-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathColoredBoxGroupDrawer.cs
More file actions
62 lines (51 loc) · 1.65 KB
/
ColoredBoxGroupDrawer.cs
File metadata and controls
62 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using UnityEngine;
using System.Diagnostics;
#if UNITY_EDITOR
using Sirenix.OdinInspector.Editor;
using Sirenix.Utilities.Editor;
#endif
namespace Sirenix.OdinInspector.ColoredBoxGroup
{
#if UNITY_EDITOR
public class ColoredBoxGroupDrawer : OdinGroupDrawer<ColoredBoxGroupAttribute>
{
/// <summary>
/// Draw the stuff
/// </summary>
/// <param name="label">Label string</param>
protected override void DrawPropertyLayout(GUIContent label)
{
GUILayout.Space(Attribute.MarginTop);
var headerLabel = Attribute.LabelText;
if (Attribute.ShowLabel)
{
if (string.IsNullOrEmpty(headerLabel))
{
headerLabel = "";
}
}
GUIHelper.PushColor(new Color(Attribute.R, Attribute.G, Attribute.B, Attribute.A));
SirenixEditorGUI.BeginBox();
SirenixEditorGUI.BeginBoxHeader();
{
GUIHelper.PopColor();
if (Attribute.ShowLabel)
{
SirenixEditorGUI.Title(headerLabel, null,
Attribute.CenterLabel ? TextAlignment.Center : TextAlignment.Left, false,
Attribute.BoldLabel);
}
}
SirenixEditorGUI.EndBoxHeader();
foreach (var t in Property.Children)
{
t.Draw();
}
SirenixEditorGUI.EndBox();
GUILayout.Space(Attribute.MarginBottom);
}
}
#else
public class ColoredBoxGroupDrawer { }
#endif
}