4 namespace HKI.Core.Loc.Editor
9 [CustomPropertyDrawer(typeof(AudioLocalization.AudioLocalizationElement))]
13 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
15 float languageRectWidth = 80.0f;
16 float volumeLabelRectWidth = 50.0f;
17 float volumeRectWidth = position.width * 0.15f;
18 float pitchLabelRectWidth = 35.0f;
19 float pitchRectWidth = position.width * 0.35f;
22 Rect languageRect =
new Rect(position.x, position.y, languageRectWidth, position.height);
23 Rect localizationClipRect =
new Rect(position.x + languageRectWidth + space, position.y, position.width - languageRectWidth - 5 * space - volumeRectWidth - pitchRectWidth - volumeLabelRectWidth - pitchLabelRectWidth, position.height);
24 Rect volumeLabelRect =
new Rect(position.x + position.width - pitchRectWidth - 3 * space - pitchLabelRectWidth - volumeRectWidth - volumeLabelRectWidth, position.y, volumeLabelRectWidth, position.height);
25 Rect volumeRect =
new Rect(position.x + position.width - pitchRectWidth - 2 * space - pitchLabelRectWidth - volumeRectWidth, position.y, volumeRectWidth, position.height);
26 Rect pitchLabelRect =
new Rect(position.x + position.width - pitchRectWidth - space - pitchLabelRectWidth, position.y, pitchLabelRectWidth, position.height);
27 Rect pitchRect =
new Rect(position.x + position.width - pitchRectWidth, position.y, pitchRectWidth, position.height);
29 EditorGUI.PropertyField(languageRect, property.FindPropertyRelative(
"Language"), GUIContent.none);
30 EditorGUI.PropertyField(localizationClipRect, property.FindPropertyRelative(
"Clip"), GUIContent.none);
31 EditorGUI.LabelField(volumeLabelRect,
"Volume:");
32 EditorGUI.PropertyField(volumeRect, property.FindPropertyRelative(
"Volume"), GUIContent.none);
33 EditorGUI.LabelField(pitchLabelRect,
"Pitch:");
34 EditorGUI.PropertyField(pitchRect, property.FindPropertyRelative(
"Pitch"), GUIContent.none);
Custom property drawer for the AudioLocalizationElement class.
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)