public void Log(ResultKind messageKind, IAnalysisContext context, FormattedMessage message) { foreach (IResultLogger logger in Loggers) { logger.Log(messageKind, context, message); } }
public TutorialWindow() { Title = "The Tutorial!"; //Get section header font var cache = IoCManager.Resolve <IResourceCache>(); var inputManager = IoCManager.Resolve <IInputManager>(); Font headerFont = new VectorFont(cache.GetResource <FontResource>("/Textures/Interface/Nano/NotoSans/NotoSans-Regular.ttf"), _headerFontSize); var scrollContainer = new ScrollContainer(); scrollContainer.AddChild(VBox = new VBoxContainer()); Contents.AddChild(scrollContainer); //Intro VBox.AddChild(new Label { FontOverride = headerFont, Text = "Intro" }); AddFormattedText(IntroContents); string Key(BoundKeyFunction func) { return(FormattedMessage.EscapeText(inputManager.GetKeyFunctionButtonString(func))); } //Controls VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nControls" }); // Moved this down here so that Rider shows which args correspond to which format spot. AddFormattedText(Loc.GetString(@"Movement: [color=#a4885c]{0} {1} {2} {3}[/color] Switch hands: [color=#a4885c]{4}[/color] Use held item: [color=#a4885c]{5}[/color] Drop held item: [color=#a4885c]{6}[/color] Smart equip from backpack: [color=#a4885c]{24}[/color] Smart equip from belt: [color=#a4885c]{25}[/color] Open inventory: [color=#a4885c]{7}[/color] Open character window: [color=#a4885c]{8}[/color] Open crafting window: [color=#a4885c]{9}[/color] Focus chat: [color=#a4885c]{10}[/color] Focus OOC: [color=#a4885c]{26}[/color] Focus Admin Chat: [color=#a4885c]{27}[/color] Use hand/object in hand: [color=#a4885c]{22}[/color] Do wide attack: [color=#a4885c]{23}[/color] Use targeted entity: [color=#a4885c]{11}[/color] Throw held item: [color=#a4885c]{12}[/color] Pull entity: [color=#a4885c]{30}[/color] Move pulled entity: [color=#a4885c]{29}[/color] Stop pulling: [color=#a4885c]{32}[/color] Examine entity: [color=#a4885c]{13}[/color] Point somewhere: [color=#a4885c]{28}[/color] Open entity context menu: [color=#a4885c]{14}[/color] Toggle combat mode: [color=#a4885c]{15}[/color] Toggle console: [color=#a4885c]{16}[/color] Toggle UI: [color=#a4885c]{17}[/color] Toggle debug overlay: [color=#a4885c]{18}[/color] Toggle entity spawner: [color=#a4885c]{19}[/color] Toggle tile spawner: [color=#a4885c]{20}[/color] Toggle sandbox window: [color=#a4885c]{21}[/color] Toggle admin menu [color=#a4885c]{31}[/color]", Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight), Key(SwapHands), Key(ActivateItemInHand), Key(Drop), Key(OpenInventoryMenu), Key(OpenCharacterMenu), Key(OpenCraftingMenu), Key(FocusChat), Key(ActivateItemInWorld), Key(ThrowItemInHand), Key(ExamineEntity), Key(OpenContextMenu), Key(ToggleCombatMode), Key(ShowDebugConsole), Key(HideUI), Key(ShowDebugMonitors), Key(OpenEntitySpawnWindow), Key(OpenTileSpawnWindow), Key(OpenSandboxWindow), Key(Use), Key(WideAttack), Key(SmartEquipBackpack), Key(SmartEquipBelt), Key(FocusOOC), Key(FocusAdminChat), Key(Point), Key(TryPullObject), Key(MovePulledObject), Key(OpenAdminMenu), Key(ReleasePulledObject))); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" }); AddFormattedText(GameplayContents); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = Loc.GetString("\nSandbox spawner", Key(OpenSandboxWindow)) }); AddFormattedText(SandboxSpawnerContents); //Feedback VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nFeedback" }); AddFormattedText(FeedbackContents); }
static ExamineSystem() { _entityNotFoundMessage = new FormattedMessage(); _entityNotFoundMessage.AddText("That entity doesn't exist"); }
public override void DoExamine(FormattedMessage message, bool inDetailsRange) { message.AddMarkup(Loc.GetString("Next, add [color=yellow]{0}x[/color] [color=cyan]{1}[/color].", Amount, MaterialPrototype.Name)); }
/// <summary> /// Creates a new examine tooltip with arbitrary info. /// </summary> public abstract void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor);
void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { message.AddMarkup(Loc.GetString($"The battery indicator displays: {BatteryStateText[_lightState]}.")); }
protected override async void Run() { var code = InputBar.Text; InputBar.Clear(); // Remove > or . at the end of the output panel. OutputPanel.RemoveEntry(^ 1); _inputBuffer.AppendLine(code); _linesEntered += 1; var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(_inputBuffer.ToString()), ScriptInstanceShared.ParseOptions); if (!SyntaxFactory.IsCompleteSubmission(tree)) { if (_linesEntered == 1) { OutputPanel.AddText($"> {code}"); } else { OutputPanel.AddText($". {code}"); } OutputPanel.AddText("."); return; } code = _inputBuffer.ToString().Trim(); // Remove echo of partial submission from the output panel. for (var i = 1; i < _linesEntered; i++) { OutputPanel.RemoveEntry(^ 1); } _inputBuffer.Clear(); _linesEntered = 0; Script newScript; if (_state != null) { newScript = _state.Script.ContinueWith(code); } else { var options = ScriptInstanceShared.GetScriptOptions(_reflectionManager); newScript = CSharpScript.Create(code, options, typeof(IScriptGlobals)); } // Compile ahead of time so that we can do syntax highlighting correctly for the echo. newScript.Compile(); // Echo entered script. var echoMessage = new FormattedMessage(); echoMessage.PushColor(Color.FromHex("#D4D4D4")); echoMessage.AddText("> "); ScriptInstanceShared.AddWithSyntaxHighlighting(newScript, echoMessage, code, _highlightWorkspace); OutputPanel.AddMessage(echoMessage); try { if (_state != null) { _state = await newScript.RunFromAsync(_state, _ => true); } else { _state = await newScript.RunAsync(_globals); } } catch (CompilationErrorException e) { var msg = new FormattedMessage(); msg.PushColor(Color.Crimson); foreach (var diagnostic in e.Diagnostics) { msg.AddText(diagnostic.ToString()); msg.AddText("\n"); } OutputPanel.AddMessage(msg); OutputPanel.AddText(">"); return; } if (_state.Exception != null) { var msg = new FormattedMessage(); msg.PushColor(Color.Crimson); msg.AddText(CSharpObjectFormatter.Instance.FormatException(_state.Exception)); OutputPanel.AddMessage(msg); } else if (ScriptInstanceShared.HasReturnValue(newScript)) { var msg = new FormattedMessage(); msg.AddText(CSharpObjectFormatter.Instance.FormatObject(_state.ReturnValue)); OutputPanel.AddMessage(msg); } OutputPanel.AddText(">"); }
internal AttachmentsKeyboard(FormattedMessage message) : base(message) { }
public void Examine(FormattedMessage message, bool inDetailsRange) { if (!inDetailsRange) { return; } if (Seed == null) { message.AddMarkup(Loc.GetString("plant-holder-component-nothing-planted-message") + "\n"); } else if (!Dead) { message.AddMarkup(Loc.GetString("plant-holder-component-something-already-growing-message", ("seedName", Seed.DisplayName), ("toBeForm", Seed.DisplayName.EndsWith('s') ? "are" : "is")) + "\n"); if (Health <= Seed.Endurance / 2) { message.AddMarkup(Loc.GetString("plant-holder-component-something-already-growing-low-health-message", ("healthState", Loc.GetString(Age > Seed.Lifespan ? "plant-holder-component-plant-old-adjective" : "plant-holder-component-plant-unhealthy-adjective"))) + "\n"); } } else { message.AddMarkup(Loc.GetString("plant-holder-component-dead-plant-matter-message") + "\n"); } if (WeedLevel >= 5) { message.AddMarkup(Loc.GetString("plant-holder-component-weed-high-level-message") + "\n"); } if (PestLevel >= 5) { message.AddMarkup(Loc.GetString("plant-holder-component-pest-high-level-message") + "\n"); } message.AddMarkup(Loc.GetString($"plant-holder-component-water-level-message", ("waterLevel", (int)WaterLevel)) + "\n"); message.AddMarkup(Loc.GetString($"plant-holder-component-nutrient-level-message", ("nutritionLevel", (int)NutritionLevel)) + "\n"); if (DrawWarnings) { if (Toxins > 40f) { message.AddMarkup(Loc.GetString("plant-holder-component-toxins-high-warning") + "\n"); } if (ImproperLight) { message.AddMarkup(Loc.GetString("plant-holder-component-light-improper-warning") + "\n"); } if (ImproperHeat) { message.AddMarkup(Loc.GetString("plant-holder-component-heat-improper-warning") + "\n"); } if (ImproperPressure) { message.AddMarkup(Loc.GetString("plant-holder-component-pressure-improper-warning") + "\n"); } if (_missingGas > 0) { message.AddMarkup(Loc.GetString("plant-holder-component-gas-missing-warning") + "\n"); } } }
public override void DoExamine(FormattedMessage message, bool inDetailsRange) { message.AddMarkup(string.IsNullOrEmpty(Name) ? Loc.GetString("Next, insert an entity with a {0} component.", Component) // Terrible. : Loc.GetString("Next, insert {0}", Name)); }
public abstract void DoExamine(FormattedMessage message, bool inDetailsRange);
private FormattedMessage CreateMarkup(EntityUid uid, HealthExaminableComponent component, DamageableComponent damage) { var msg = new FormattedMessage(); var first = true; foreach (var type in component.ExaminableTypes) { if (!damage.Damage.DamageDict.TryGetValue(type, out var dmg)) { continue; } if (dmg == FixedPoint2.Zero) { continue; } FixedPoint2 closest = FixedPoint2.Zero; string chosenLocStr = string.Empty; foreach (var threshold in component.Thresholds) { var str = $"health-examinable-{component.LocPrefix}-{type}-{threshold}"; var tempLocStr = Loc.GetString($"health-examinable-{component.LocPrefix}-{type}-{threshold}", ("target", uid)); // i.e., this string doesn't exist, because theres nothing for that threshold if (tempLocStr == str) { continue; } if (dmg > threshold && threshold > closest) { chosenLocStr = tempLocStr; closest = threshold; } } if (closest == FixedPoint2.Zero) { continue; } if (!first) { msg.PushNewline(); } else { first = false; } msg.AddMarkup(chosenLocStr); } if (msg.IsEmpty) { msg.AddMarkup(Loc.GetString($"health-examinable-{component.LocPrefix}-none")); } // Anything else want to add on to this? RaiseLocalEvent(uid, new HealthBeingExaminedEvent(msg), true); return(msg); }
public HealthBeingExaminedEvent(FormattedMessage message) { Message = message; }
public void SetInfoBlob(string markup) { _richTextLabel.SetMessage(FormattedMessage.FromMarkup(markup)); }
public void Log(ResultKind messageKind, IAnalysisContext context, FormattedMessage message) { throw new NotImplementedException(); }
public void Examine(FormattedMessage message, bool inDetailsRange) { var text = Loc.GetString("It's a [color=white]{0}[/color] magazine of [color=white]{1}[/color] caliber.", MagazineType, Caliber); message.AddMarkup(text); }
public void Examine(FormattedMessage message, bool inDetailsRange) { var text = Loc.GetString("It's [color=white]{0}[/color] ammo.", Caliber); message.AddMarkup(text); }
public ExamineInfoResponseMessage(EntityUid entityUid, FormattedMessage message) { EntityUid = entityUid; Message = message; }
internal MaximizedKeyboard(FormattedMessage message) : base(message) { }
public void Examine(FormattedMessage message, bool inDetailsRange) { if (!inDetailsRange) { return; } if (Seed == null) { message.AddMarkup(Loc.GetString("It has nothing planted in it.\n")); } else if (!Dead) { message.AddMarkup(Loc.GetString($"[color=green]{Seed.DisplayName}[/color] {(Seed.DisplayName.EndsWith('s') ? "are" : "is")} growing here.\n")); if (Health <= Seed.Endurance / 2) { message.AddMarkup(Loc.GetString($"The plant looks [color=red]{(Age > Seed.Lifespan ? "old and wilting" : "unhealthy")}[/color].\n")); } } else { message.AddMarkup(Loc.GetString("It is full of [color=red]dead plant matter[/color].\n")); } if (WeedLevel >= 5) { message.AddMarkup(Loc.GetString("It is filled with [color=green]weeds[/color]!\n")); } if (PestLevel >= 5) { message.AddMarkup(Loc.GetString("It is filled with [color=gray]tiny worms[/color]!\n")); } message.AddMarkup(Loc.GetString($"Water: [color=cyan]{(int)WaterLevel}[/color]\n")); message.AddMarkup(Loc.GetString($"Nutrient: [color=orange]{(int)NutritionLevel}[/color]\n")); if (DrawWarnings) { if (Toxins > 40f) { message.AddMarkup(Loc.GetString("The [color=red]toxicity level alert[/color] is flashing red.\n")); } if (ImproperLight) { message.AddMarkup(Loc.GetString("The [color=yellow]improper light level alert[/color] is blinking.\n")); } if (ImproperHeat) { message.AddMarkup(Loc.GetString("The [color=orange]improper temperature level alert[/color] is blinking.\n")); } if (ImproperPressure) { message.AddMarkup(Loc.GetString("The [color=lightblue]improper environment pressure alert[/color] is blinking.\n")); } if (_missingGas > 0) { message.AddMarkup(Loc.GetString("The [color=cyan]improper gas environment alert[/color] is blinking.\n")); } } }
public bool Execute(IDebugConsole console, params string[] args) { var window = new SS14Window { CustomMinimumSize = (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 VBoxContainer(); 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 { SizeFlagsVertical = Control.SizeFlags.FillExpand }; 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(); message.AddText("Foo\n"); message.PushColor(Color.Red); message.AddText("Bar"); message.Pop(); rich.SetMessage(message); 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 { CustomMinimumSize = (50, 50), Text = $"{x}, {y}" });
public override void Examine(FormattedMessage message, bool inDetailsRange) { base.Examine(message, inDetailsRange); message.AddMarkup(Loc.GetString("\nIt uses [color=white]{0}[/color] ammo.", _caliber)); }
/// <summary> /// Push another message parsed from markup into this examine result, on its own line. /// </summary> /// <seealso cref="PushText"/> /// <seealso cref="PushMessage"/> public void PushMarkup(string markup) { PushMessage(FormattedMessage.FromMarkup(markup)); }
public void Examine(FormattedMessage message, bool inDetailsRange) { var loc = Location == null ? "<null>" : $"'{Location}'"; message.AddText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc))); }
public void Examine(FormattedMessage message, bool inDetailsRange) { message.AddMarkup(Loc.GetString("It's currently on {0} mode, and holds {1} charges.", _mode.ToString(), this._ammo)); }
public override void DoExamine(FormattedMessage message, bool inDetailsRange) { }
public void SetMessage(FormattedMessage message) { _message = message; _entry = new RichTextEntry(_message); _updateEntry(); }
public AddFormattedMessageArgs(FormattedMessage message) { Message = message; }
public void Examine(FormattedMessage message, bool inDetailsRange) { var loc = Location == null ? "<null>" : $"'{Location}'"; message.AddText(Loc.GetString("This one's location ID is {0}", loc)); }
/// <inheritdoc /> public void AddFormattedLine(FormattedMessage message) { AddFormatted?.Invoke(this, new AddFormattedMessageArgs(message)); }
public void Log(ResultKind messageKind, IAnalysisContext context, FormattedMessage message) { throw new NotImplementedException(); }
public void Examine(FormattedMessage message, bool inDetailsRange) { var text = Loc.GetString("ammo-component-on-examine", ("caliber", Caliber)); message.AddMarkup(text); }