Exemplo n.º 1
0
        /// <summary>
        /// Debug 对应的回调处理
        /// </summary>
        /// <param name="message">信息.</param>
        /// <param name="stackTrace">信息的来源</param>
        /// <param name="type">信息类型 (error, exception, warning, assert).</param>
        private void HandleLog(string message, string stackTrace, LogType type)
        {
            List <DebugerGUI.Log> logs = this.logs;

            DebugerGUI.Log log = new DebugerGUI.Log()
            {
                message    = string.Concat(new object[] { "<size=", this.FontSize, ">", message, "</size>" }),
                stackTrace = string.Concat(new object[] { "<size=", this.FontSize, ">", stackTrace, "</size>" }),
                type       = type
            };
            logs.Add(log);
            this.TrimExcessLogs();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绘制log列表
        /// </summary>
        private void DrawLogsList()
        {
            GUIStyle gs_vertica  = GUI.skin.verticalScrollbar;
            GUIStyle gs1_vertica = GUI.skin.verticalScrollbarThumb;

            gs_vertica.fixedWidth  = this.ScrollbarSize;
            gs1_vertica.fixedWidth = this.ScrollbarSize;
            GUIStyle gs_horizontal  = GUI.skin.horizontalScrollbar;
            GUIStyle gs1_horizontal = GUI.skin.horizontalScrollbarThumb;

            gs_horizontal.fixedHeight  = this.ScrollbarSize;
            gs1_horizontal.fixedHeight = this.ScrollbarSize;
            this.scrollPosition        = GUILayout.BeginScrollView(this.scrollPosition, false, true, Array.Empty <GUILayoutOption>());
            for (int i = 0; i < this.logs.Count; i++)
            {
                DebugerGUI.Log log = this.logs[i];
                if ((!this.collapse ? false : i > 0))
                {
                    string previousMessage = this.logs[i - 1].message;
                    if (log.message == previousMessage)
                    {
                        goto Label0;
                    }
                }
                GUI.contentColor = DebugerGUI.logTypeColors[log.type];
                GUILayout.Label(log.message, Array.Empty <GUILayoutOption>());
                if (this.StackLog)
                {
                    GUILayout.Label(log.stackTrace, Array.Empty <GUILayoutOption>());
                }
                Label0 :;
            }
            GUI.color = Color.magenta;
            GUILayout.EndScrollView();
            gs_vertica.fixedWidth      = 0f;
            gs1_vertica.fixedWidth     = 0f;
            gs_horizontal.fixedHeight  = 0f;
            gs1_horizontal.fixedHeight = 0f;
            GUI.contentColor           = Color.white;
        }