public void CreateGesture(string gestureName, bool isSynchronized = false) { gestureSettings.CreateGesture(gestureName, isSynchronized); GenerateGesturesMenu(); }
private void ShowGestureListElements(SerializedProperty list, EditorListOption options) { if (!list.isArray) { EditorGUILayout.HelpBox(list.name + " is neither an array nor a list", MessageType.Error); return; } bool showElementLabels = (options & EditorListOption.ElementLabels) != 0; bool showButtons = (options & EditorListOption.Buttons) != 0; // render the list for (int i = 0; i < list.arraySize; i++) { string controlName = "Gesture Control " + i; if (showButtons) { EditorGUILayout.BeginHorizontal(); } if (showElementLabels) { EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i)); } else { //Was is this one? GUI.SetNextControlName(controlName); //We cannot use BeginCheck() on this because that will fire and event on EVERY keystroke. EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i).FindPropertyRelative("name"), GUIContent.none); } if (showButtons) { ShowGestureListHandedness(i); ShowGestureListTotalExamples(i); ShowGestureListButtons(list, i); EditorGUILayout.EndHorizontal(); } } // if the list is empty show the plus + button if (showButtons && list.arraySize == 0 && GUILayout.Button(addButtonContent, EditorStyles.miniButton)) { var option = DisplayDialogForGestureCreation(); switch (option) { // Create Single Gesture case 0: gestureSettings.CreateGesture("Gesture 1", false); break; // Create Double Gesture case 1: gestureSettings.CreateGesture("Gesture 1", true); break; // Cancel - do nothing case 2: break; } } }