private void DrawSoundClipInspector(SerializedProperty selectedEventProperty, TEvent selectedEvent) { bool allowLoopingClip = !selectedEvent.Container.Looping; if (allowLoopingClip) { if (selectedEvent.IsContinuous()) { allowLoopingClip = false; } } for (int i = 0; i < selectedEvent.Container.Sounds.Length; i++) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].Sound")); if (EditorGUILayoutExtensions.Button("Remove")) { selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "]").DeleteCommand(); break; } EditorGUILayout.EndHorizontal(); if (!selectedEvent.IsContinuous()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].DelayCenter")); EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].DelayRandomization")); EditorGUILayout.EndHorizontal(); //Disable looping next clips in a simultaneous container only. if (allowLoopingClip) { EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Sounds.Array.data[" + i + "].Looping")); if (selectedEvent.Container.Sounds[i].Looping && selectedEvent.Container.ContainerType == AudioContainerType.Simultaneous) { allowLoopingClip = false; } } else { selectedEvent.Container.Sounds[i].Looping = false; } } } }
private void DrawEventHeader(TEvent[] EditorEvents) { // Add or remove current event. EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutExtensions.Label("Events"); using (new EditorGUI.DisabledScope((EditorEvents != null) && (EditorEvents.Length < 1))) { if (EditorGUILayoutExtensions.Button("Remove")) { this.MyTarget.Events = RemoveAudioEvent(EditorEvents, this.selectedEventIndex); } } if (EditorGUILayoutExtensions.Button("Add")) { this.MyTarget.Events = AddAudioEvent(EditorEvents); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }
private bool DrawContainerInspector(SerializedProperty selectedEventProperty, TEvent selectedEvent) { bool addedSound = false; EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.ContainerType")); if (!selectedEvent.IsContinuous()) { EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.Looping")); if (selectedEvent.Container.Looping) { EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.LoopTime")); } } // Sounds EditorGUILayout.Space(); if (selectedEvent.IsContinuous()) { EditorGUILayout.PropertyField(selectedEventProperty.FindPropertyRelative("Container.CrossfadeTime")); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sounds"); if (EditorGUILayoutExtensions.Button("Add")) { AddSound(selectedEvent); // Skip drawing sound inspector after adding a new sound. addedSound = true; } EditorGUILayout.EndHorizontal(); return(addedSound); }