Esempio n. 1
0
        // -----------------------
        void OnGUI()
        {
            const float BUTTON_HEIGHT          = 30;
            const float TOOLBAR_HEIGHT         = 34;
            const float PROP_BOX_BUTTON_HEIGHT = 20;
            const float MAX_PROP_BOX_HEIGHT    = 300;
            const float ENTRY_LIST_REL_HEIGHT  = 0.55f;


            float entryListHeight = (this.position.height - TOOLBAR_HEIGHT) - PROP_BOX_BUTTON_HEIGHT - 100;
            float propBoxHeight   = Mathf.Min((MAX_PROP_BOX_HEIGHT), (entryListHeight * (1.0f - ENTRY_LIST_REL_HEIGHT)));


            GUILayout.Box(GUIContent.none, CFEditorStyles.Inst.headerAssistant, GUILayout.ExpandWidth(true));


            EditorGUILayout.BeginHorizontal(CFEditorStyles.Inst.toolbarBG);

            this.recordingOn = CFGUI.PushButton(
                new GUIContent("Capture in progress!", CFEditorStyles.Inst.greenDotTex, "Editor must be in Play mode to catch Input calls!"),
                new GUIContent("Stopped. Press to begin capture", CFEditorStyles.Inst.pauseTex, "Editor must be in Play mode to catch Input calls!"),
                this.recordingOn, CFEditorStyles.Inst.buttonStyle, GUILayout.Height(BUTTON_HEIGHT), GUILayout.ExpandWidth(true));

            GUI.backgroundColor = (Color.white);

            if (GUILayout.Button("Clear", GUILayout.Height(BUTTON_HEIGHT), GUILayout.Width(70)))
            {
                this.ClearEntries();
            }

            EditorGUILayout.EndHorizontal();


            if (this.selectedRig == null)
            {
                EditorGUILayout.HelpBox("No rig selected!! Select one to be able to easily create controls or bind commands!", MessageType.Warning);
            }
            else
            {
                EditorGUILayout.HelpBox("Rig: " + this.selectedRig.name, MessageType.None);
            }

            if (!CFUtils.editorStopped && (this.logEntries.Count > 0))
            {
                EditorGUILayout.HelpBox("Remember to stop Editor before binding or creating controls!", MessageType.Warning);
            }


            this.scrollPos = EditorGUILayout.BeginScrollView(this.scrollPos, CFEditorStyles.Inst.transpSunkenBG, GUILayout.ExpandHeight(true));     //GUILayout.Height(entryListHeight));

            if (this.logEntries.Count == 0)
            {
                GUILayout.Box("Nothing captured yet!" + (CFUtils.editorStopped ? "\nTo capture anything hit the PLAY button!" : ""),
                              CFEditorStyles.Inst.centeredTextTranspBG);
            }
            else
            {
                for (int i = this.logEntries.Count - 1; i >= 0; --i)
                {
                    //GUILayout.Label("[" + i + "] : " + this.logEntries[i].ToString());
                    this.logEntries[i].DrawListElemGUI(this);
                }
            }

            EditorGUILayout.EndScrollView();

            if (this.selectedEntry != null)
            {
                this.propBoxOn = CFGUI.PushButton(
                    new GUIContent("Hide Properties", CFEditorStyles.Inst.texMoveDown),
                    new GUIContent("Show Properties", CFEditorStyles.Inst.texMoveUp),
                    this.propBoxOn, CFEditorStyles.Inst.buttonStyle);

                if (this.propBoxOn)
                {
                    this.propBoxScroll = EditorGUILayout.BeginScrollView(this.propBoxScroll, CFEditorStyles.Inst.transpSunkenBG, GUILayout.Height(propBoxHeight));

                    this.selectedEntry.DrawPropertiesGUI();

                    EditorGUILayout.EndScrollView();
                }
            }
        }