private bool DrawHandlerButtons(int curHandlerIdx, GameEventListener listener, SerializedProperty mutedProperty) { ResetColor(); //Draw mute button if (GUILayout.Button(new GUIContent(mutedProperty.boolValue ? "U": "M", mutedProperty.boolValue ? "Unmute" : "Mute"), GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(20))) { mutedProperty.boolValue = !mutedProperty.boolValue; } //Draw shift down button if (curHandlerIdx == listener.handlers.Count - 1) { EditorGUI.BeginDisabledGroup(true); GUILayout.Button("﹀", GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(25)); EditorGUI.EndDisabledGroup(); } else { if (GUILayout.Button(new GUIContent("﹀", "Shift Handler Down"), GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(25))) { Undo.RecordObject(listener, "Shift Handler Down"); listener.ShiftHandlerDown(curHandlerIdx); serializedObject.ApplyModifiedProperties(); } } //Draw shift up button if (curHandlerIdx == 0) { EditorGUI.BeginDisabledGroup(true); GUILayout.Button("︿", GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(25)); EditorGUI.EndDisabledGroup(); } else { if (GUILayout.Button(new GUIContent("︿", "Shift Handler Up"), GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(25))) { Undo.RecordObject(listener, "Shift Handler Up"); listener.ShiftHandlerUp(curHandlerIdx); serializedObject.ApplyModifiedProperties(); } } //Draw delete button if (GUILayout.Button(new GUIContent("X", "Remove Handler"), GUI.skin.FindStyle("PreButton"), GUILayout.MaxWidth(20))) { if (listener.handlers[curHandlerIdx].TargetCount > 0) { if (EditorUtility.DisplayDialog("Warning!", "Are you sure you want to remove this handler?", "Yes", "No")) { Undo.RecordObject(listener, "Remove Handler"); listener.RemoveHandler(curHandlerIdx); serializedObject.ApplyModifiedProperties(); GUILayout.EndHorizontal(); return true; } } else { listener.RemoveHandler(curHandlerIdx); serializedObject.ApplyModifiedProperties(); GUILayout.EndHorizontal(); return true; } } return false; }