示例#1
0
 public static void TryOpenLogWindow()
 {
     if (StaticConstructorOnStartupUtility.coreStaticAssetsLoaded || UnityData.IsInMainThread)
     {
         EditWindow_Log.TryAutoOpen();
     }
 }
示例#2
0
 private static void PostMessage()
 {
     if (openOnMessage)
     {
         TryOpenLogWindow();
         EditWindow_Log.SelectLastMessage(expandDetailsPane: true);
     }
 }
示例#3
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Tiny;
            WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f);

            if (widgetRow.ButtonText("Clear", "Clear all log messages.", true, false))
            {
                Log.Clear();
                EditWindow_Log.ClearAll();
            }
            if (widgetRow.ButtonText("Trace big", "Set the stack trace to be large on screen.", true, false))
            {
                EditWindow_Log.detailsPaneHeight = 700f;
            }
            if (widgetRow.ButtonText("Trace medium", "Set the stack trace to be medium-sized on screen.", true, false))
            {
                EditWindow_Log.detailsPaneHeight = 300f;
            }
            if (widgetRow.ButtonText("Trace small", "Set the stack trace to be small on screen.", true, false))
            {
                EditWindow_Log.detailsPaneHeight = 100f;
            }
            if (EditWindow_Log.canAutoOpen)
            {
                if (widgetRow.ButtonText("Auto-open is ON", string.Empty, true, false))
                {
                    EditWindow_Log.canAutoOpen = false;
                }
            }
            else if (widgetRow.ButtonText("Auto-open is OFF", string.Empty, true, false))
            {
                EditWindow_Log.canAutoOpen = true;
            }
            if (widgetRow.ButtonText("Copy to clipboard", "Copy all messages to the clipboard.", true, false))
            {
                this.CopyAllMessagesToClipboard();
            }
            Text.Font = GameFont.Small;
            Rect rect = new Rect(inRect);

            rect.yMin += 26f;
            rect.yMax  = inRect.height;
            if (EditWindow_Log.selectedMessage != null)
            {
                rect.yMax -= EditWindow_Log.detailsPaneHeight;
            }
            Rect detailsRect = new Rect(inRect);

            detailsRect.yMin = rect.yMax;
            this.DoMessagesListing(rect);
            this.DoMessageDetails(detailsRect, inRect);
            if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Mouse.IsOver(rect))
            {
                EditWindow_Log.ClearSelectedMessage();
            }
            EditWindow_Log.detailsPaneHeight = Mathf.Max(EditWindow_Log.detailsPaneHeight, 10f);
            EditWindow_Log.detailsPaneHeight = Mathf.Min(EditWindow_Log.detailsPaneHeight, inRect.height - 80f);
        }
示例#4
0
 public static void SelectLastMessage(bool expandDetailsPane = false)
 {
     EditWindow_Log.ClearSelectedMessage();
     EditWindow_Log.SelectedMessage          = Log.Messages.LastOrDefault <LogMessage>();
     EditWindow_Log.messagesScrollPosition.y = (float)Log.Messages.Count <LogMessage>() * 30f;
     if (expandDetailsPane)
     {
         EditWindow_Log.detailsPaneHeight = 9999f;
     }
 }
示例#5
0
 private static void PostMessage()
 {
     if (Log.openOnMessage)
     {
         Log.TryOpenLogWindow();
         EditWindow_Log.SelectLastMessage(true);
     }
     Log.messageCount++;
     if (Log.messageCount == 1000 && Log.ReachedMaxMessagesLimit)
     {
         Log.Warning("Reached max messages limit. Stopping logging to avoid spam.", true);
     }
 }
示例#6
0
 private static void PostMessage()
 {
     if (openOnMessage)
     {
         TryOpenLogWindow();
         EditWindow_Log.SelectLastMessage(expandDetailsPane: true);
     }
     messageCount++;
     if (messageCount == 1000 && ReachedMaxMessagesLimit)
     {
         Warning("Reached max messages limit. Stopping logging to avoid spam.", ignoreStopLoggingLimit: true);
     }
 }
示例#7
0
 public void Enqueue(LogMessage msg)
 {
     if (lastMessage != null && msg.CanCombineWith(lastMessage))
     {
         lastMessage.repeats++;
         return;
     }
     lastMessage = msg;
     messages.Enqueue(msg);
     if (messages.Count > maxMessages)
     {
         EditWindow_Log.Notify_MessageDequeued(messages.Dequeue());
     }
 }
示例#8
0
 public void Enqueue(LogMessage msg)
 {
     if (this.lastMessage != null && msg.CanCombineWith(this.lastMessage))
     {
         this.lastMessage.repeats++;
         return;
     }
     this.lastMessage = msg;
     this.messages.Enqueue(msg);
     if (this.messages.Count > this.maxMessages)
     {
         LogMessage oldMessage = this.messages.Dequeue();
         EditWindow_Log.Notify_MessageDequeued(oldMessage);
     }
 }
示例#9
0
        private void DoMessagesListing(Rect listingRect)
        {
            Rect viewRect = new Rect(0f, 0f, listingRect.width - 16f, this.listingViewHeight + 100f);

            Widgets.BeginScrollView(listingRect, ref EditWindow_Log.messagesScrollPosition, viewRect, true);
            float width = viewRect.width - 28f;

            Text.Font = GameFont.Tiny;
            float num  = 0f;
            bool  flag = false;

            foreach (LogMessage current in Log.Messages)
            {
                float num2 = Text.CalcHeight(current.text, width);
                if (num2 > 30f)
                {
                    num2 = 30f;
                }
                GUI.color = new Color(1f, 1f, 1f, 0.7f);
                Rect rect = new Rect(4f, num, 28f, num2);
                Widgets.Label(rect, current.repeats.ToStringCached());
                Rect rect2 = new Rect(28f, num, width, num2);
                if (EditWindow_Log.selectedMessage == current)
                {
                    GUI.DrawTexture(rect2, EditWindow_Log.SelectedMessageTex);
                }
                else if (flag)
                {
                    GUI.DrawTexture(rect2, EditWindow_Log.AltMessageTex);
                }
                if (Widgets.ButtonInvisible(rect2, false))
                {
                    EditWindow_Log.ClearSelectedMessage();
                    EditWindow_Log.SelectedMessage = current;
                }
                GUI.color = current.Color;
                Widgets.Label(rect2, current.text);
                num += num2;
                flag = !flag;
            }
            if (Event.current.type == EventType.Layout)
            {
                this.listingViewHeight = num;
            }
            Widgets.EndScrollView();
            GUI.color = Color.white;
        }
示例#10
0
 public void Enqueue(LogMessage msg)
 {
     if (lastMessage != null && msg.CanCombineWith(lastMessage))
     {
         lastMessage.repeats++;
     }
     else
     {
         lastMessage = msg;
         messages.Enqueue(msg);
         if (messages.Count > maxMessages)
         {
             LogMessage oldMessage = messages.Dequeue();
             EditWindow_Log.Notify_MessageDequeued(oldMessage);
         }
     }
 }
示例#11
0
 public static void Clear()
 {
     EditWindow_Log.ClearSelectedMessage();
     Log.messageQueue.Clear();
     Log.ResetMessageCount();
 }
示例#12
0
 public static void ClearAll()
 {
     EditWindow_Log.ClearSelectedMessage();
     EditWindow_Log.messagesScrollPosition = Vector2.zero;
 }
示例#13
0
 internal static void Clear()
 {
     EditWindow_Log.ClearSelectedMessage();
     Log.messageQueue.Clear();
 }