Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            //Get our manager
            m_capture = (PegasusCapture)target;

            //Set up the box style
            if (m_boxStyle == null)
            {
                m_boxStyle = new GUIStyle(GUI.skin.box);
                m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor;
                m_boxStyle.fontStyle        = FontStyle.Bold;
                m_boxStyle.alignment        = TextAnchor.UpperLeft;
            }

            //Setup the wrap style
            if (m_wrapStyle == null)
            {
                m_wrapStyle           = new GUIStyle(GUI.skin.label);
                m_wrapStyle.fontStyle = FontStyle.Normal;
                m_wrapStyle.wordWrap  = true;
            }

            //Text intro
            GUILayout.BeginVertical(string.Format("Pegasus ({0}.{1})", PegasusConstants.MajorVersion, PegasusConstants.MinorVersion), m_boxStyle);
            GUILayout.Space(20);
            EditorGUILayout.LabelField("Welcome to Pegasus Capture!\nPress Play and then your selected hot key to capture POI for your flythrough. Then press Create Pegasus to create a Pegasus fly through after you have finshed.\nNOTE: You can adjust the rotation & position damping on the Pegasus you create to make your play back more accurate.", m_wrapStyle);
            GUILayout.EndVertical();

            EditorGUI.BeginChangeCheck();

            GUILayout.Space(5);

            KeyCode     keyCodeCapture = (KeyCode)EditorGUILayout.EnumPopup(GetLabel("Capture Key"), m_capture.m_keyCodeCapture);
            Camera      mainCamera     = (Camera)EditorGUILayout.ObjectField(GetLabel("Target Camera"), m_capture.m_mainCamera, typeof(Camera), true);
            PegasusPath path           = (PegasusPath)EditorGUILayout.ObjectField(GetLabel("Pegasus Path"), m_capture.m_path, typeof(PegasusPath), false);
            bool        enableOnStart  = EditorGUILayout.Toggle(GetLabel("Enable On Start"), m_capture.m_enableOnStart);
            bool        clearOnStart   = EditorGUILayout.Toggle(GetLabel("Clear On Start"), m_capture.m_clearOnStart);
            bool        showReticule   = EditorGUILayout.Toggle(GetLabel("Show Reticule"), m_capture.m_showReticule);

            if (path == null || path.m_path.Count == 0)
            {
                GUI.enabled = false;
            }

            if (DisplayButton(GetLabel("Create Pegasus")))
            {
                path.CreatePegasusFromPath();
                enableOnStart = false;
            }

            GUI.enabled = true;

            GUILayout.Space(5f);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(m_capture, "Made changes");

                m_capture.m_mainCamera   = mainCamera;
                m_capture.m_path         = path;
                m_capture.m_clearOnStart = clearOnStart;
                ;

                if (m_capture.m_keyCodeCapture != keyCodeCapture)
                {
                    m_capture.m_keyCodeCapture = keyCodeCapture;
                    m_capture.UpdateReticuleText();
                }

                if (m_capture.m_showReticule != showReticule || m_capture.m_enableOnStart != enableOnStart)
                {
                    m_capture.m_enableOnStart = enableOnStart;
                    m_capture.m_showReticule  = showReticule;
                    m_capture.UpdateReticuleVisibility();
                }

                EditorUtility.SetDirty(m_capture);
            }
        }