public override void OnInspectorGUI() { GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector); EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), typeof(MonoScript), false); m_serializedObject.Update(); EditorGUILayout.PropertyField(m_maxPersons, new GUIContent("Max Persons", "The maximum number of person allowed in the system"), true); EditorGUILayout.PropertyField(m_useSequence, new GUIContent("Use Sequence", "Should a sequence be used (otherwise a depth camera will be used)"), true); if (m_useSequence.boolValue) { EditorGUILayout.PropertyField(m_sequencePath, new GUIContent("Sequence Path", "the sequence path (folder name, without the actual filename)"), true); } EditorGUILayout.PropertyField(m_cameraParams, new GUIContent("Camera Params", "configuration parameters for the 3D camera"), true); EditorGUILayout.PropertyField(m_gestureList, new GUIContent("Gesture List", "list of gesture Beckon SDK will try to enable and recognize"), true); EditorGUILayout.PropertyField(m_alertList, new GUIContent("Alert List", "list of alerts Beckon SDK will report"), true); EditorGUILayout.PropertyField(m_useSeparateThread, new GUIContent("Use Separate Thread", "Should processing be started in a separate thread, this may improve performance on a multi core machine. When true, pausing the game, does not pause the background processing"), true); EditorGUILayout.PropertyField(m_logSDKDebug, new GUIContent("Log SDK Debugs", "should Beckon debug messages should be displayed, (otherwise only warning and errors would be displayed)"), true); EditorGUILayout.PropertyField(m_recordingLength, new GUIContent("Recording Length", "The maximum length of a sequence recorded. Sequence recording may be toggled by pressing F12"), true); m_serializedObject.ApplyModifiedProperties(); if (Application.isPlaying) { UnityBeckonManager ubm = target as UnityBeckonManager; if (BeckonManager.BeckonInstance.IsInRecording) { recordContent.text = "Stop Recording"; } else { recordContent.text = "Start Recording"; } EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Separator(); if (GUILayout.Button(recordContent)) { ubm.ToggleRecording(); } EditorGUILayout.Separator(); EditorGUILayout.EndHorizontal(); } }
public void GestureEnabledStrategyGUI() { if ((UnityPlayerManagement.PlayerSelectionStrategies)m_lastPlayerSelectionStrategy.enumValueIndex == UnityPlayerManagement.PlayerSelectionStrategies.GestureEnabled || (UnityPlayerManagement.PlayerSelectionStrategies)m_lastPointerSelectionStrategy.enumValueIndex == UnityPlayerManagement.PlayerSelectionStrategies.GestureEnabled) { EditorGUI.indentLevel--; gestureFoldout = EditorGUILayout.Foldout(gestureFoldout, new GUIContent("Player Select Gestures", "What are the gestures used to (un)select players using GestureEnabled strategy")); if (gestureFoldout) { EditorGUI.indentLevel += 2; // if we have UnityBeckonManager with list of gesture use this list, otherwise use free text field UnityBeckonManager ubm = GameObject.FindObjectOfType(typeof(UnityBeckonManager)) as UnityBeckonManager; if (ubm != null) { string[] gestureNames = new string[ubm.GestureList.Count + 1]; ubm.GestureList.CopyTo(gestureNames, 0); gestureNames[gestureNames.Length - 1] = "---"; Rect controlRect1 = EditorGUILayout.BeginHorizontal(); GUIContent label1 = new GUIContent("Player Select Gesture", "Gesture Used to select a person as a player"); label1 = EditorGUI.BeginProperty(controlRect1, label1, m_selectPlayerGesture); EditorGUI.BeginChangeCheck(); int index = Array.FindIndex(gestureNames, (s) => { return(s == editedPlayerManagement.PlayerSelectGesture); }); if (index == -1) { index = gestureNames.Length - 1; } int selectedIndex = EditorGUILayout.Popup(label1.text, index, gestureNames); editedPlayerManagement.PlayerSelectGesture = gestureNames[selectedIndex]; if (EditorGUI.EndChangeCheck() == true) { m_selectPlayerGesture.stringValue = editedPlayerManagement.PlayerSelectGesture; } EditorGUI.EndProperty(); EditorGUILayout.EndHorizontal(); Rect controlRect2 = EditorGUILayout.BeginHorizontal(); GUIContent label2 = new GUIContent("Player Unselect Gesture", "Gesture Used to unselect a player"); label2 = EditorGUI.BeginProperty(controlRect2, label2, m_unselectPlayerGesture); EditorGUI.BeginChangeCheck(); index = Array.FindIndex(gestureNames, (s) => { return(s == editedPlayerManagement.PlayerUnselectGesture); }); if (index == -1) { index = gestureNames.Length - 1; } selectedIndex = EditorGUILayout.Popup(label2.text, index, gestureNames); editedPlayerManagement.PlayerUnselectGesture = gestureNames[selectedIndex]; if (EditorGUI.EndChangeCheck() == true) { m_unselectPlayerGesture.stringValue = editedPlayerManagement.PlayerUnselectGesture; } EditorGUI.EndProperty(); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.PropertyField(m_selectPlayerGesture); EditorGUILayout.PropertyField(m_unselectPlayerGesture); } EditorGUI.indentLevel -= 2; } EditorGUI.indentLevel++; } }