public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var state = ReadOnlyAttributeDrawer.IsEnabled(this, property); EditorGUI.BeginDisabledGroup(!state); var attribute = this.GetAttribute <AudioPopupAttribute>(); if (attribute != null) { var serializedObject = property.serializedObject; if (serializedObject.isEditingMultipleObjects == false) { ClipType clipType = attribute.clipType; if (string.IsNullOrEmpty(attribute.fieldName) == false) { var prop = PropertyExtensions.GetRelativeProperty(property, property.propertyPath, attribute.fieldName); clipType = (ClipType)((KeyValuePair <int, string>)PropertyExtensions.GetRawValue(prop, attribute)).Key; } Data data = null; var flowData = PropertyExtensions.GetRelativeProperty(property, property.propertyPath, "flowData"); if (flowData != null) { var _data = PropertyExtensions.GetRawValue(flowData, attribute) as UnityEngine.UI.Windows.Plugins.Flow.FlowData; if (_data != null) { data = _data.audio; } } if (data != null) { property.intValue = AudioPopupEditor.Draw(position, property.intValue, (result) => { property.intValue = result; property.serializedObject.ApplyModifiedPropertiesWithoutUndo(); }, clipType, data, label); property.serializedObject.ApplyModifiedPropertiesWithoutUndo(); } else { EditorGUI.PropertyField(position, property, label); } } } else { EditorGUI.PropertyField(position, property, label); } EditorGUI.EndDisabledGroup(); }
public static int DrawLayout(int id, System.Action <int> onResult, ClipType clipType, UnityEngine.UI.Windows.Audio.Data data, GUIContent label) { return(AudioPopupEditor.Draw_INTERNAL(id, onResult, clipType, data, label, new Rect(), layout: true)); }