Пример #1
0
    public void OnGUI()
    {
        //Set up the basic style, based on the Unity defaults
        //A bit hacky, but means we don't have to ship an editor guistyle and can fit in to pro and free skins
        Color    defaultLineColor  = GUI.backgroundColor;
        GUIStyle unityLogLineEven  = null;
        GUIStyle unityLogLineOdd   = null;
        GUIStyle unitySmallLogLine = null;

        foreach (var style in GUI.skin.customStyles)
        {
            if (style.name == "CN EntryBackEven")
            {
                unityLogLineEven = style;
            }
            else if (style.name == "CN EntryBackOdd")
            {
                unityLogLineOdd = style;
            }
            else if (style.name == "CN StatusInfo")
            {
                unitySmallLogLine = style;
            }
        }

        EntryStyleBackEven = new GUIStyle(unitySmallLogLine);

        EntryStyleBackEven.normal      = unityLogLineEven.normal;
        EntryStyleBackEven.margin      = new RectOffset(0, 0, 0, 0);
        EntryStyleBackEven.border      = new RectOffset(0, 0, 0, 0);
        EntryStyleBackEven.fixedHeight = 0;

        EntryStyleBackOdd        = new GUIStyle(EntryStyleBackEven);
        EntryStyleBackOdd.normal = unityLogLineOdd.normal;
        // EntryStyleBackOdd = new GUIStyle(unityLogLine);


        SizerLineColour = new Color(defaultLineColor.r * 0.5f, defaultLineColor.g * 0.5f, defaultLineColor.b * 0.5f);

        // GUILayout.BeginVertical(GUILayout.Height(topPanelHeaderHeight), GUILayout.MinHeight(topPanelHeaderHeight));
        ResizeTopPane();
        DrawPos = Vector2.zero;
        DrawToolbar();
        DrawFilter();

        DrawChannels();

        float logPanelHeight = CurrentTopPaneHeight - DrawPos.y;

        if (Dirty)
        {
            CurrentLogList = EditorLogger.CopyLogInfo();
        }
        DrawLogList(logPanelHeight);

        DrawPos.y += DividerHeight;

        DrawLogDetails();

        HandleCopyToClipboard();

        //If we're dirty, do a repaint
        Dirty = false;
        if (MakeDirty)
        {
            Dirty     = true;
            MakeDirty = false;
            Repaint();
        }
    }
Пример #2
0
        public void OnGUI()
        {
            Color    defaultLineColor  = GUI.backgroundColor;
            GUIStyle unityLogLineEven  = null;
            GUIStyle unityLogLineOdd   = null;
            GUIStyle unitySmallLogLine = null;

            foreach (var style in GUI.skin.customStyles)
            {
                if (style.name == "CN EntryBackEven")
                {
                    unityLogLineEven = style;
                }
                else if (style.name == "CN EntryBackOdd")
                {
                    unityLogLineOdd = style;
                }
                else if (style.name == "CN StatusInfo")
                {
                    unitySmallLogLine = style;
                }
            }

            EntryStyleBackEven = new GUIStyle(unitySmallLogLine);

            EntryStyleBackEven.normal      = unityLogLineEven.normal;
            EntryStyleBackEven.margin      = new RectOffset(0, 0, 0, 0);
            EntryStyleBackEven.border      = new RectOffset(0, 0, 0, 0);
            EntryStyleBackEven.fixedHeight = 0;

            EntryStyleBackOdd        = new GUIStyle(EntryStyleBackEven);
            EntryStyleBackOdd.normal = unityLogLineOdd.normal;
            // EntryStyleBackOdd = new GUIStyle(unityLogLine);


            SizerLineColour = new Color(defaultLineColor.r * 0.5f, defaultLineColor.g * 0.5f, defaultLineColor.b * 0.5f);

            // GUILayout.BeginVertical(GUILayout.Height(topPanelHeaderHeight), GUILayout.MinHeight(topPanelHeaderHeight));
            ResizeTopPane();
            DrawPos = Vector2.zero;
            DrawToolbar();

            float logPanelHeight = position.height - CurrentTopPaneHeight - DrawPos.y;

            logPanelHeight = Mathf.Clamp(logPanelHeight, 100, position.height - 100);

            if (Dirty)
            {
                CurrentLogList = EditorLogger.CopyLogInfo();
            }
            DrawLogList(logPanelHeight);

            DrawPos.y += DividerHeight;

            DrawLogDetails();

            HandleCopyToClipboard();

            //If we're dirty, do a repaint
            Dirty = false;
            if (MakeDirty)
            {
                Dirty     = true;
                MakeDirty = false;
                Repaint();
            }
        }