public void SetPattern(Pattern p) { Pattern = p; }
public override void OnInspectorGUI() { // Draw the default inspector DrawDefaultInspector(); RumiaMeasure measure = target as RumiaMeasure; if (measure == null) { return; } Pattern pattern = measure.Pattern; if (!pattern) { return; } List <RumiaAction> choices = pattern.GetAllRumiaActions(); EditorGUILayout.LabelField("32nd note triggers", EditorStyles.boldLabel); EditorGUIUtility.labelWidth = 80; EditorGUIUtility.fieldWidth = 150; Color defColor = GUI.color; // Handle each group of RumiaActions to be scheduled for this instant in time for (int i = 0; i < SIZE; i++) { if (measure.RumiaActionLists[i] == null) { measure.RumiaActionLists[i] = new RumiaActionList(); } EditorGUILayout.BeginHorizontal(); List <RumiaAction> rumiaActionList = measure.RumiaActionLists[i].RumiaActions; List <string> choiceParameterList = measure.ChoiceParameterLists[i].ChoiceParameters; // Button to add a new RumiaAction GUI.color = Color.green; if (GUILayout.Button("+", GUILayout.Width(30))) { rumiaActionList.Add(new RumiaAction()); choiceParameterList.Add(null); } // Button to remove the last RumiaAction in the list GUI.color = Color.red; if (GUILayout.Button("-", GUILayout.Width(30)) && rumiaActionList.Count > 0) { rumiaActionList.RemoveAt(rumiaActionList.Count - 1); choiceParameterList.RemoveAt(choiceParameterList.Count - 1); } GUI.color = defColor; GUILayout.Label(GetLabel(i), GUILayout.Width(50)); // Handle each individual RumiaAction for (int j = 0; j < rumiaActionList.Count; j++) { // Formatting if (j > 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(117)); } // Draw the RumiaAction field RumiaAction updatedRumiaAction = rumiaActionList[j]; string updatedChoiceParameter = choiceParameterList[j]; DrawRumiaActionField(choices, ref updatedRumiaAction, ref updatedChoiceParameter); rumiaActionList[j] = updatedRumiaAction; choiceParameterList[j] = updatedChoiceParameter; } EditorGUILayout.EndHorizontal(); if ((i + 1) % ELEMENTS_PER_BEAT == 0 && i < (SIZE - 1)) { HorizontalLine(); } } EditorGUIUtility.labelWidth = 0; EditorGUIUtility.fieldWidth = 0; // Save the changes back to the object EditorUtility.SetDirty(target); }