Esempio n. 1
0
        private void OnLogMessageReceived(string condition, string stackTrace, LogType type)
        {
            ConsoleLogEntry logEntry = null;

            if (MessageAdded != null || m_store)
            {
                logEntry = new ConsoleLogEntry(type, condition, stackTrace);

                m_log.Enqueue(logEntry);
                UpdateCounters(type, 1);
                if (m_log.Count > m_clearThreshold)
                {
                    ConsoleLogEntry[] removedItems = new ConsoleLogEntry[m_clearThreshold - m_maxItems];
                    for (int i = 0; i < removedItems.Length; ++i)
                    {
                        ConsoleLogEntry removedLogEntry = m_log.Dequeue();
                        removedItems[i] = removedLogEntry;
                        UpdateCounters(removedLogEntry.LogType, -1);
                    }


                    if (MessagesRemoved != null)
                    {
                        MessagesRemoved(this, removedItems);
                    }
                }
            }

            if (MessageAdded != null)
            {
                MessageAdded(this, logEntry);
            }
        }
        private void OnItemDataBinding(object sender, VirtualizingTreeViewItemDataBindingArgs e)
        {
            ConsoleLogEntry logEntry = (ConsoleLogEntry)e.Item;

            TextMeshProUGUI text = e.ItemPresenter.GetComponentInChildren <TextMeshProUGUI>(true);

            text.text = logEntry.Condition;

            Image icon = e.ItemPresenter.GetComponentsInChildren <Image>(true)[2];

            icon.gameObject.SetActive(true);
            switch (logEntry.LogType)
            {
            case LogType.Assert:
            case LogType.Error:
            case LogType.Exception:
                icon.sprite = m_errorIcon;
                icon.color  = m_errorColor;
                break;

            case LogType.Warning:
                icon.sprite = m_warningIcon;
                icon.color  = m_warningColor;
                break;

            case LogType.Log:
                icon.sprite = m_infoIcon;
                icon.color  = m_infoColor;
                break;
            }
            e.HasChildren = false;
        }
Esempio n. 3
0
        private void OnMessageAdded(IRuntimeConsole console, ConsoleLogEntry arg)
        {
            m_image.gameObject.SetActive(true);
            m_text.gameObject.SetActive(true);

            switch (arg.LogType)
            {
            case LogType.Log:
                m_image.sprite = m_infoIcon;
                m_image.color  = m_infoColor;
                break;

            case LogType.Warning:
                m_image.sprite = m_warningIcon;
                m_image.color  = m_warningColor;
                break;

            case LogType.Error:
            case LogType.Assert:
            case LogType.Exception:
                m_image.sprite = m_errorIcon;
                m_image.color  = m_errorColor;
                break;
            }

            m_text.text = arg.Condition;
        }
 private void OnSelectionChanged(object sender, SelectionChangedArgs e)
 {
     if (e.NewItem != null)
     {
         ConsoleLogEntry logEntry = (ConsoleLogEntry)e.NewItem;
         m_stackTrace.text = logEntry.Condition + " " + logEntry.StackTrace;
     }
     else
     {
         m_stackTrace.text = null;
     }
 }
Esempio n. 5
0
        protected virtual void OnLogMessageReceived(string condition, string stackTrace, LogType type)
        {
            if (!AcceptMessage(condition, stackTrace, type))
            {
                return;
            }

            ConsoleLogEntry logEntry = null;

            if (MessageAdded != null || m_store)
            {
                logEntry = new ConsoleLogEntry(type, condition, stackTrace);
                if (BeforeMessageAdded != null)
                {
                    ConsoleLogCancelArgs args = new ConsoleLogCancelArgs(logEntry);
                    BeforeMessageAdded(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }

                m_log.Enqueue(logEntry);
                UpdateCounters(type, 1);
                if (m_log.Count > m_clearThreshold)
                {
                    ConsoleLogEntry[] removedItems = new ConsoleLogEntry[m_clearThreshold - m_maxItems];
                    for (int i = 0; i < removedItems.Length; ++i)
                    {
                        ConsoleLogEntry removedLogEntry = m_log.Dequeue();
                        removedItems[i] = removedLogEntry;
                        UpdateCounters(removedLogEntry.LogType, -1);
                    }

                    if (MessagesRemoved != null)
                    {
                        MessagesRemoved(this, removedItems);
                    }
                }
            }



            if (MessageAdded != null)
            {
                MessageAdded(this, logEntry);
            }
        }
        private void OnMessageAdded(IRuntimeConsole console, ConsoleLogEntry logEntry)
        {
            bool scroll = false;

            if (m_scrollRect.Index + m_scrollRect.VisibleItemsCount == m_scrollRect.ItemsCount)
            {
                scroll = true;
            }

            if (CanAdd(logEntry.LogType))
            {
                m_treeView.Add(logEntry);
            }
            UpdateCounters();

            if (scroll)
            {
                m_scrollRect.verticalNormalizedPosition = 0;
            }
        }
Esempio n. 7
0
 public ConsoleLogCancelArgs(ConsoleLogEntry logEntry)
 {
     LogEntry = logEntry;
 }