Exemplo n.º 1
0
        public override void DrawInputSettings()
        {
            EditorGUILayout.BeginHorizontal();

            bool isDeviceActive = (InputProfile != null) && InputProfile.IsDeviceOn;

            EditorGUI.BeginDisabledGroup(isDeviceActive);

            GUIContent[] content = new GUIContent[inputProfiles.Count];
            for (int i = 0; i < inputProfiles.Count; i++)
            {
                content[i] = new GUIContent(inputProfiles[i].Attribute.ProfileName);
            }
            int tempSelection = EditorGUILayout.Popup(new GUIContent(INPUT), mocapProfileSelection, content);


            if (mocapProfileSelection != tempSelection || InputProfile == null)
            {
                mocapProfileSelection = tempSelection;

                InputProfile = Activator.CreateInstance(inputProfiles[mocapProfileSelection].Type) as InputProfile;
                InputProfile.FrameCaptured            += MocapProfile_SkeletonFrameCaptured;
                InputProfile.InputSkeletonTypeChanged += InputProfile_InputSkeletonTypeChanged;

                // Input Profile changed.
                inputProfileChanged();
            }

            EditorGUI.EndDisabledGroup();


            bool  toggleOn = false;
            Color temp     = GUI.color;

            if (InputProfile.IsDeviceOn)
            {
                GUI.color = Color.green;
                toggleOn  = GUILayout.Toggle(InputProfile.IsDeviceOn, ON, EditorStyles.miniButton, GUILayout.Width(40f));
            }
            else
            {
                GUI.color = Color.red;
                toggleOn  = GUILayout.Toggle(InputProfile.IsDeviceOn, OFF, EditorStyles.miniButton, GUILayout.Width(40f));
            }
            GUI.color = temp;

            if (toggleOn && !InputProfile.IsDeviceOn)
            {
                Debug.Log("Cinema Mocap: Starting your device...");
                InputProfile.TurnOnDevice();
                EditorCoroutine.start(WaitForSensorAvailable());
            }
            else if (!toggleOn && InputProfile.IsDeviceOn)
            {
                if (InputProfile != null)
                {
                    if (this.RecordingState != RecordingState.NotRecording)
                    {
                        StopRecording();
                    }
                    InputProfile.TurnOffDevice();
                }

                if (OutputProfile != null)
                {
                    OutputProfile.Reset();
                }
            }

            EditorGUILayout.EndHorizontal();

            InputProfile.DrawInputSettings();
        }