4 namespace HKI.Core.Variables.Editor
6 [CustomPropertyDrawer(typeof(DayMonthYear))]
10 const string daySPName =
"Day";
11 const string monthSPName =
"Month";
12 const string yearSPName =
"Year";
13 const string bcadSPName =
"BCAD";
15 const float labelWidth = 120.0f;
16 const float dayLabelWidth = 40.0f;
17 const float monthLabelWidth = 45.0f;
18 const float yearLabelWidth = 40.0f;
19 const float bcadLabelWidth = 45.0f;
22 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
24 SerializedProperty daySP =
property.FindPropertyRelative(daySPName);
25 SerializedProperty monthSP =
property.FindPropertyRelative(monthSPName);
26 SerializedProperty yearSP =
property.FindPropertyRelative(yearSPName);
27 SerializedProperty bcadSP =
property.FindPropertyRelative(bcadSPName);
29 float inputFieldWidth = (position.width - labelWidth - dayLabelWidth - monthLabelWidth - yearLabelWidth - bcadLabelWidth) / 4.0f;
31 position.width = labelWidth;
32 EditorGUI.LabelField(position, label);
34 position.x += labelWidth;
35 position.width = dayLabelWidth;
36 EditorGUI.LabelField(position, daySPName);
38 position.x += dayLabelWidth;
39 position.width = inputFieldWidth;
40 EditorGUI.PropertyField(position, daySP, GUIContent.none);
42 position.x += inputFieldWidth;
43 position.width = monthLabelWidth;
44 EditorGUI.LabelField(position, monthSPName);
46 position.x += monthLabelWidth;
47 position.width = inputFieldWidth;
48 EditorGUI.PropertyField(position, monthSP, GUIContent.none);
50 position.x += inputFieldWidth;
51 position.width = yearLabelWidth;
52 EditorGUI.LabelField(position, yearSPName);
54 position.x += yearLabelWidth;
55 position.width = inputFieldWidth;
56 EditorGUI.PropertyField(position, yearSP, GUIContent.none);
58 position.x += inputFieldWidth;
59 position.width = bcadLabelWidth;
60 EditorGUI.LabelField(position, bcadSPName);
62 position.x += bcadLabelWidth;
63 position.width = inputFieldWidth;
64 EditorGUI.PropertyField(position, bcadSP, GUIContent.none);
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)