Ejemplo n.º 1
0
        private void windowMinimality(int id)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(" ━ ", GUI.skin.button, null))
            {
                winStart = 1;
            }
            if (GUILayout.Button(" ロ ", GUI.skin.button, null))
            {
                winStart = 2;
            }
            if (GUILayout.Button(" ✖ ", GUI.skin.button, null))
            {
                winStart = 0;
            }
            GUILayout.EndHorizontal();

            GUILayout.Label("LogConsole", buttonStyle, null);

            GUILayout.EndVertical();
            titleBar_dragArea = GUILayoutUtility.GetLastRect();

            if (titleBar_dragArea.size.x == 1)
            {
                return;
            }

            if (titleBar_dragArea.Contains(Event.current.mousePosition))
            {
                Cursors.SetCursor(CursorType.SizeNS);
                if (Event.current.rawType == EventType.MouseDown)
                {
                    dragging = true;
                }
            }
            else
            {
                if (!dragging)
                {
                    Cursors.SetCursor(CursorType.Arrow);
                }
            }
        }
Ejemplo n.º 2
0
        private void DrawLog()
        {
            GUILayout.BeginVertical();

            posLeft = GUILayout.BeginScrollView(posLeft,
                                                GUILayout.MinHeight(splitterPos),
                                                GUILayout.Height(splitterPos),
                                                GUILayout.MaxHeight(splitterPos),
                                                GUILayout.ExpandWidth(true));

            int logStart = 0;

            for (int i = 0; i < logDatas.Count; i++)
            {
                LogData logData = logDatas[i];

                if (!logLevels.Contains(logData.logLevel))
                {
                    continue;
                }
                logStart += 1;
                if (GUILayout.Toggle(selectLog == i, string.Format("[{0}] [{1}] {2}\n{3}", logData.logTime.ToString(TIME_FORMATER), logData.logLevel, logData.logMessage, logData.logBasicData), logStart % 2 == 0 ? LogStyle1 : LogStyle2, GUILayout.ExpandWidth(true), GUILayout.Height(logHeight)))
                {
                    if (selectLog == i)
                    {
                        continue;
                    }
                    selectLog   = i;
                    detailedLog = string.Format("[{0}] [{1}] {2}\n{3}\n{4}", logData.logTime.ToString(TIME_FORMATER), logData.logLevel, logData.logMessage, logData.logBasicData, logData.logTrack);
                }
            }

            GUILayout.EndScrollView();

            // 分割线
            GUILayout.Box("", SplitterStyle,
                          GUILayout.Height(6),
                          GUILayout.ExpandWidth(true));
            splitterRect = GUILayoutUtility.GetLastRect();

            // 显示详细信息
            posRight = GUILayout.BeginScrollView(posRight,
                                                 GUILayout.ExpandWidth(true),
                                                 GUILayout.ExpandHeight(true));
            GUILayout.Label(detailedLog, LogStyle1);
            GUILayout.EndScrollView();

            GUILayout.EndVertical();

            if (Event.current != null)
            {
                if (Event.current.rawType == EventType.MouseUp)
                {
                    if (dragging)
                    {
                        dragging = false;
                        Cursors.SetCursor(CursorType.Arrow);
                    }
                }

                if (dragging)
                {
                    splitterPos = Event.current.mousePosition.y - 83;
                    if (splitterPos >= windowRect.height - logHeight - 110)
                    {
                        splitterPos = windowRect.height - logHeight - 110;
                    }

                    if (splitterPos <= logHeight)
                    {
                        splitterPos = logHeight;
                    }
                }

                if (splitterRect.size.x == 1)
                {
                    return;
                }

                if (splitterRect.Contains(Event.current.mousePosition))
                {
                    Cursors.SetCursor(CursorType.SizeNS);
                    if (Event.current.rawType == EventType.MouseDown)
                    {
                        dragging = true;
                    }
                }
                else
                {
                    if (!dragging)
                    {
                        Cursors.SetCursor(CursorType.Arrow);
                    }
                }
            }
            else
            {
                if (dragging)
                {
                    dragging = false;
                }
            }
        }