public override void OnInspectorGUI() { try { //DrawHeader(); GUI.changed = false; GUI.color = Color.white; if (commonEditor == null) { commonEditor = ScriptableObject.CreateInstance <MidiCommonEditor>(); } Event e = Event.current; commonEditor.DrawCaption("Midi File Player - Play Midi from the MPTK Repository", "https://paxstellar.fr/midi-file-player-detailed-view-2/"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Select Midi ", "Select Midi File to play"), GUILayout.Width(150)); if (MidiPlayerGlobal.CurrentMidiSet.MidiFiles != null && MidiPlayerGlobal.CurrentMidiSet.MidiFiles.Count > 0) { if (GUILayout.Button(new GUIContent(instance.MPTK_MidiIndex + " - " + instance.MPTK_MidiName, "Selected Midi File to play"), GUILayout.Height(30))) { InitWinSelectMidi(instance.MPTK_MidiIndex, MidiChanged); } } else { EditorGUILayout.LabelField(MidiPlayerGlobal.ErrorNoMidiFile); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); commonEditor.AllPrefab(instance); commonEditor.MidiFileParameters(instance); instance.showEvents = MidiCommonEditor.DrawFoldoutAndHelp(instance.showEvents, "Show Midi Events", "https://paxstellar.fr/midi-file-player-detailed-view-2/#Foldout-Events"); if (instance.showEvents) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(CustomEventStartPlayMidi); EditorGUILayout.PropertyField(CustomEventListNotesEvent); EditorGUILayout.PropertyField(CustomEventEndPlayMidi); serializedObject.ApplyModifiedProperties(); EditorGUI.indentLevel--; } commonEditor.MidiFileInfo(instance); commonEditor.SynthParameters(instance, serializedObject); #if SHOWDEFAULT instance.showDefault = EditorGUILayout.Foldout(instance.showDefault, "Show default editor"); if (instance.showDefault) { EditorGUI.indentLevel++; commonEditor.DrawAlertOnDefault(); DrawDefaultInspector(); EditorGUI.indentLevel--; } #endif MidiCommonEditor.SetSceneChangedIfNeed(instance, GUI.changed); } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } }
public override void OnInspectorGUI() { try { GUI.changed = false; GUI.color = Color.white; if (commonEditor == null) { commonEditor = ScriptableObject.CreateInstance <MidiCommonEditor>(); } Event e = Event.current; string soundFontSelected = "No SoundFont selected."; if (MidiPlayerGlobal.CurrentMidiSet != null && MidiPlayerGlobal.CurrentMidiSet.ActiveSounFontInfo != null) { soundFontSelected = MidiPlayerGlobal.CurrentMidiSet.ActiveSounFontInfo.Name; EditorGUILayout.LabelField(new GUIContent("SoundFont: " + soundFontSelected, MidiPlayerGlobal.HelpDefSoundFont)); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Select Midi ", "Select Midi File to play"), GUILayout.Width(150)); if (MidiPlayerGlobal.CurrentMidiSet.MidiFiles != null && MidiPlayerGlobal.CurrentMidiSet.MidiFiles.Count > 0) { if (GUILayout.Button(new GUIContent(instance.MPTK_MidiIndex + " - " + instance.MPTK_MidiName, "Selected Midi File to play"), GUILayout.Height(30))) { InitWinSelectMidi(instance.MPTK_MidiIndex, MidiChanged); } } else { EditorGUILayout.LabelField(MidiPlayerGlobal.ErrorNoMidiFile); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); commonEditor.AllPrefab(instance); commonEditor.MidiFileParameters(instance); showEvents = EditorGUILayout.Foldout(showEvents, "Show Midi Events"); if (showEvents) { EditorGUILayout.PropertyField(CustomEventStartPlayMidi); EditorGUILayout.PropertyField(CustomEventListNotesEvent); EditorGUILayout.PropertyField(CustomEventEndPlayMidi); serializedObject.ApplyModifiedProperties(); } commonEditor.MidiFileInfo(instance); commonEditor.SynthParameters(instance, serializedObject); #if SHOWDEFAULT showDefault = EditorGUILayout.Foldout(showDefault, "Show default editor"); if (showDefault) { DrawDefaultInspector(); } #endif } else { MidiCommonEditor.ErrorNoSoundFont(); } MidiCommonEditor.SetSceneChangedIfNeed(instance, GUI.changed); } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } }