public void AddLine(string text, ChatChannel channel, Color color)
        {
            if (!ThreadUtility.IsOnMainThread())
            {
                var formatted = new FormattedMessage(3);
                formatted.PushColor(color);
                formatted.AddText(text);
                formatted.Pop();
                _messageQueue.Enqueue(formatted);
                return;
            }

            _flushQueue();
            if (!firstLine)
            {
                Contents.NewLine();
            }
            else
            {
                firstLine = false;
            }

            Contents.PushColor(color);
            Contents.AddText(text);
            Contents.Pop(); // Pop the color off.
        }
示例#2
0
        private void UpdateLabel()
        {
            DisplayLabel.Clear();
            DisplayLabel.PushTable(2);
            AddText("Name", Colors.White);
            AddText("Value", Colors.White);

            foreach (string key in DebugInfoList.Keys)
            {
                string text = "";
                try
                {
                    text = DebugInfoList[key].InfoFunction.Invoke();
                    AddText(key, DebugInfoList[key].Color);
                    AddText(text, DebugInfoList[key].Color);
                }
                catch (Exception ex)
                {
                    // Something went wrong
                    MDLog.Debug(LOG_CAT, ex.ToString());
                }
            }

            DisplayLabel.Pop();
        }
示例#3
0
 public void AddLine(string text, ChatChannel channel, Color color)
 {
     if (!firstLine)
     {
         Contents.NewLine();
     }
     else
     {
         firstLine = false;
     }
     Contents.PushColor(color);
     Contents.AddText(text);
     Contents.Pop(); // Pop the color off.
 }
示例#4
0
        public void Write([NotNull] string text, [NotNull] RichTextLabel label)
        {
            Ensure.Any.IsNotNull(text, nameof(text));
            Ensure.Any.IsNotNull(label, nameof(label));

            if (Color.HasValue)
            {
                label.PushColor(Color.Value);
            }
            if (Underline)
            {
                label.PushUnderline();
            }

            if (Bold || Italics)
            {
                var sb = new StringBuilder(text.Length + 7 * 2);

                if (Bold)
                {
                    sb.Append("[b]");
                }
                if (Italics)
                {
                    sb.Append("[i]");
                }

                sb.Append(text);

                if (Italics)
                {
                    sb.Append("[/i]");
                }
                if (Bold)
                {
                    sb.Append("[/b]");
                }

                label.AppendBbcode(sb.ToString());
            }
            else
            {
                label.AddText(text);
            }

            if (Color.HasValue || Underline)
            {
                label.Pop();
            }
        }
示例#5
0
        private void UpdateLabel()
        {
            DisplayLabel.Clear();
            DisplayLabel.PushTable(2);

            foreach (string Category in OnScreenDebugManager.DebugInfoCategoryMap.Keys)
            {
                if (OnScreenDebugManager.HiddenCategories.Contains(Category))
                {
                    continue;
                }

                AddCateogryTitle(Category);

                Dictionary <string, OnScreenDebugInfo> DebugInfoList = OnScreenDebugManager.DebugInfoCategoryMap[Category];

                foreach (string key in DebugInfoList.Keys)
                {
                    try
                    {
                        string text = DebugInfoList[key].InfoFunction.Invoke();
                        AddTextCell(key, DebugInfoList[key].Color);
                        AddTextCell(text, DebugInfoList[key].Color);
                    }
                    catch (Exception ex)
                    {
                        // Something went wrong
                        GD.Print(ex.ToString());
                    }
                }

                AddEmptyLine();
            }

            DisplayLabel.Pop();
        }
示例#6
0
        public void Write(string text, RichTextLabel label)
        {
            Ensure.That(text, nameof(text)).IsNotNull();
            Ensure.That(label, nameof(label)).IsNotNull();

            Color.Iter(label.PushColor);

            if (Underline)
            {
                label.PushUnderline();
            }

            if (Bold || Italics)
            {
                var sb = new StringBuilder(text.Length + 7 * 2);

                if (Bold)
                {
                    sb.Append("[b]");
                }
                if (Italics)
                {
                    sb.Append("[i]");
                }

                sb.Append(text);

                if (Italics)
                {
                    sb.Append("[/i]");
                }
                if (Bold)
                {
                    sb.Append("[/b]");
                }

                label.AppendBbcode(sb.ToString());
            }
            else
            {
                label.AddText(text);
            }

            if (Color.IsSome || Underline)
            {
                label.Pop();
            }
        }
示例#7
0
        public void AddLine(string message, ChatChannel channel, Color color)
        {
            if (Disposed)
            {
                return;
            }

            if (ChannelBlacklist.Contains(channel))
            {
                return;
            }

            if (!firstLine)
            {
                contents.NewLine();
            }
            else
            {
                firstLine = false;
            }
            contents.PushColor(color);
            contents.AddText(message);
            contents.Pop(); // Pop the color off.
        }