Ejemplo n.º 1
0
        private void OnGUI()
        {
            scrollView = Gl.BeginScrollView(scrollView);
            {
                Gl.TextArea(log);
            }
            Gl.EndScrollView();

            EditorUtil.HorizontalRule();

            Gl.BeginHorizontal();
            {
                Gl.Label("Save Log:", Gl.ExpandWidth(false));
                outputPath = Gl.TextField(outputPath);
            }
            Gl.EndHorizontal();

            Gl.BeginHorizontal();
            {
                if (Gl.Button("Save"))
                {
                    PrintLog();
                }

                if (Gl.Button("Close"))
                {
                    Close();
                }
            }
            Gl.EndHorizontal();
        }
Ejemplo n.º 2
0
        void OnGUI()
        {
            if (!model.enable)
            {
                model.enable = ToggleLeft("Log", model.enable); return;
            }
            instance = this; // TODO: why do this here?
            BeginHorizontal();
            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                model.SelectPreviousFrame();
                SceneView.RepaintAll();
            }
            GL.Button(frameNo, GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                model.SelectNextFrame();
                SceneView.RepaintAll();
            }
            GL.FlexibleSpace();
            EndHorizontal();
            //
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            GL.TextArea(model.output, GL.ExpandHeight(true));
            EndScrollView();
            //
            GUI.backgroundColor = Color.white;
            //
            var w30 = GL.MaxWidth(30f);

            BeginHorizontal();
            model.enable = ToggleLeft($"Log", model.enable, GL.MaxWidth(60));
            model.trails = ToggleLeft("Trails", model.trails, GL.MaxWidth(50));
            GL.Label("Offset: ", GL.ExpandWidth(false));
            var rs = model.renderSettings;

            rs.offset = FloatField(model.renderSettings.offset, w30);
            GL.Label("Size: ", w30);
            rs.size = FloatField(rs.size, w30);
            GL.Label("Col: ", w30);
            rs.color = EditorGUILayout.ColorField(rs.color);
            EndHorizontal();
        }
Ejemplo n.º 3
0
        void OnGUI()
        {
            if (!Config.enable)
            {
                Config.enable = ToggleLeft("Enable Logging", Config.enable); return;
            }
            //
            model.current = Selection.activeGameObject;
            instance      = this;
            BeginHorizontal();
            Config.useSelection = ToggleLeft("Use Selection", Config.useSelection,
                                             GL.MaxWidth(90f));
            Config.allFrames = ToggleLeft("History", Config.allFrames,
                                          GL.MaxWidth(60));
            // TODO - make return type filtering available with the global history
            if (model.applicableSelection)
            {
                GL.Label("→", GL.MaxWidth(25f));
                Config.rtypeIndex = Popup(Config.rtypeIndex, rtypeOptions);
            }
            EndHorizontal();
            if (!Config.useSelection)
            {
                model.current = null;
            }
            BeginHorizontal();
            int frameNo = browsing ? selectedFrame.index : Time.frameCount;

            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                SelectPrev();
            }
            GL.Button($"#{frameNo}", GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                SelectNext();
            }
            GL.FlexibleSpace();
            Config.step = ToggleLeft("Step", Config.step, GL.MaxWidth(48f));
            EndHorizontal();
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            string log = model.Output(useHistory, rtypeOptions[Config.rtypeIndex]);

            if (currentLog != log && Config.step)
            {
                Ed.isPaused = true;
            }
            currentLog = log;
            GL.TextArea(browsing ? selectedFrame.Format() : log,
                        GL.ExpandHeight(true));
            EndScrollView();
            GUI.backgroundColor = Color.white;
            BeginHorizontal();
            Config.enable = ToggleLeft(
                $"Enable Logging ({Logger.injectionTimeMs}ms)",
                Config.enable, GL.ExpandWidth(true));
            if (!Application.isPlaying)
            {
                if (GL.Button($"Clear", GL.MaxWidth(90f)))
                {
                    Clear();
                }
            }
            EndHorizontal();
            BeginHorizontal();
            GL.Label("Trail offset: ", GL.MaxWidth(60f));
            Config.trailOffset = FloatField(Config.trailOffset,
                                            GL.MaxWidth(30f));
            GL.Label("Size: ", GL.MaxWidth(30f));
            Config.handleSize = FloatField(Config.handleSize, GL.MaxWidth(30f));
            EndHorizontal();
        }