private void DrawEventHeader(TEvent[] EditorEvents) { // Add or remove current event. EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayoutExtensions.Label("Events"); if (EditorEvents != null) { EditorGUI.BeginDisabledGroup(EditorEvents.Length < 1); } if (EditorGUILayoutExtensions.Button("Remove")) { this.myTarget.EditorEvents = RemoveAudioEvent(EditorEvents, this.selectedEventIndex); } if (EditorEvents != null) { EditorGUI.EndDisabledGroup(); } if (EditorGUILayoutExtensions.Button("Add")) { this.myTarget.EditorEvents = AddAudioEvent(EditorEvents); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }
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.EditorEvents = RemoveAudioEvent(EditorEvents, this.selectedEventIndex); } } if (EditorGUILayoutExtensions.Button("Add")) { this.MyTarget.EditorEvents = 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); }