public void Log(string sawmillName, LogEvent message) { if (sawmillName == "CON") { return; } var formatted = new FormattedMessage.Builder(); var robustLevel = message.Level.ToRobust(); formatted.PushColor(Color.DarkGray); formatted.AddText("["); formatted.PushColor(LogLevelToColor(robustLevel)); formatted.AddText(LogMessage.LogLevelToName(robustLevel)); formatted.Pop(); formatted.AddText($"] {sawmillName}: "); formatted.Pop(); formatted.PushColor(Color.LightGray); formatted.AddText(message.RenderMessage()); formatted.Pop(); if (message.Exception != null) { formatted.AddText("\n"); formatted.AddText(message.Exception.ToString()); } Console.AddFormattedLine(formatted.Build()); }
public void ReceiveResponse(MsgScriptResponse response) { RunButton.Disabled = false; // Remove > or . at the end of the output panel. OutputPanel.RemoveEntry(^ 1); _linesEntered += 1; if (!response.WasComplete) { if (_linesEntered == 1) { OutputPanel.AddText($"> {_lastEnteredText}"); } else { OutputPanel.AddText($". {_lastEnteredText}"); } OutputPanel.AddText("."); return; } // Remove echo of partial submission from the output panel. for (var i = 1; i < _linesEntered; i++) { OutputPanel.RemoveEntry(^ 1); } _linesEntered = 0; // Echo entered script. var echoMessage = new FormattedMessage.Builder(); echoMessage.PushColor(Color.FromHex("#D4D4D4")); echoMessage.AddText("> "); echoMessage.AddMessage(response.Echo); OutputPanel.AddMessage(echoMessage.Build()); OutputPanel.AddMessage(response.Response); OutputPanel.AddText(">"); }
public FormattedMessage GetExamineText(EntityUid entity, EntityUid?examiner) { var message = new FormattedMessage.Builder(); if (examiner == null) { return(new(new Section[] {})); } var doNewline = false; //Add an entity description if one is declared if (!string.IsNullOrEmpty(EntityManager.GetComponent <MetaDataComponent>(entity).EntityDescription)) { message.AddText(EntityManager.GetComponent <MetaDataComponent>(entity).EntityDescription); doNewline = true; } message.PushColor(Color.DarkGray); // Raise the event and let things that subscribe to it change the message... var isInDetailsRange = IsInDetailsRange(examiner.Value, entity); var examinedEvent = new ExaminedEvent(message, entity, examiner.Value, isInDetailsRange, doNewline); RaiseLocalEvent(entity, examinedEvent); //Add component statuses from components that report one foreach (var examineComponent in EntityManager.GetComponents <IExamine>(entity)) { examineComponent.Examine(message, isInDetailsRange); if (doNewline) { message.AddText("\n"); } doNewline = true; } return(message.Build()); }
public Entry(LiteResult result) { MouseFilter = MouseFilterMode.Stop; Result = result; var compl = new FormattedMessage.Builder(); var dim = Color.FromHsl((0f, 0f, 0.8f, 1f)); // warning: ew ahead string basen = "default"; if (Result.Tags.Contains("Interface")) { basen = "interface name"; } else if (Result.Tags.Contains("Class")) { basen = "class name"; } else if (Result.Tags.Contains("Struct")) { basen = "struct name"; } else if (Result.Tags.Contains("Keyword")) { basen = "keyword"; } else if (Result.Tags.Contains("Namespace")) { basen = "namespace name"; } else if (Result.Tags.Contains("Method")) { basen = "method name"; } else if (Result.Tags.Contains("Property")) { basen = "property name"; } else if (Result.Tags.Contains("Field")) { basen = "field name"; } Color basec = ScriptingColorScheme.ColorScheme[basen]; compl.PushColor(basec * dim); compl.AddText(Result.DisplayTextPrefix); compl.PushColor(basec); compl.AddText(Result.DisplayText); compl.PushColor(basec * dim); compl.AddText(Result.DisplayTextSuffix); compl.AddText(" [" + String.Join(", ", Result.Tags) + "]"); if (Result.InlineDescription.Length != 0) { compl.PushNewline(); compl.AddText(": "); compl.PushColor(Color.LightSlateGray); compl.AddText(Result.InlineDescription); } SetMessage(compl.Build()); }
public void Execute(IConsoleShell shell, string argStr, string[] args) { var window = new SS14Window { MinSize = (500, 400) }; var tabContainer = new TabContainer(); window.Contents.AddChild(tabContainer); var scroll = new ScrollContainer(); tabContainer.AddChild(scroll); //scroll.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide); var vBox = new BoxContainer { Orientation = LayoutOrientation.Vertical }; scroll.AddChild(vBox); var progressBar = new ProgressBar { MaxValue = 10, Value = 5 }; vBox.AddChild(progressBar); var optionButton = new OptionButton(); optionButton.AddItem("Honk"); optionButton.AddItem("Foo"); optionButton.AddItem("Bar"); optionButton.AddItem("Baz"); optionButton.OnItemSelected += eventArgs => optionButton.SelectId(eventArgs.Id); vBox.AddChild(optionButton); var tree = new Tree { VerticalExpand = true }; var root = tree.CreateItem(); root.Text = "Honk!"; var child = tree.CreateItem(); child.Text = "Foo"; for (var i = 0; i < 20; i++) { child = tree.CreateItem(); child.Text = $"Bar {i}"; } vBox.AddChild(tree); var rich = new RichTextLabel(); var message = new FormattedMessage.Builder(); message.AddText("Foo\n"); message.PushColor(Color.Red); message.AddText("Bar"); message.Pop(); rich.SetMessage(message.Build()); vBox.AddChild(rich); var itemList = new ItemList(); tabContainer.AddChild(itemList); for (var i = 0; i < 10; i++) { itemList.AddItem(i.ToString()); } var grid = new GridContainer { Columns = 3 }; tabContainer.AddChild(grid); for (var y = 0; y < 3; y++) { for (var x = 0; x < 3; x++) { grid.AddChild(new Button { MinSize = (50, 50), Text = $"{x}, {y}" });