Files
tbd-station-14/Content.Client/Bql/ToolshedVisualizeWindow.xaml.cs
Moony e2b22a4cd8 Toolshed (#17895)
* ogh

* i should save my work

* ogh

* hhcdfhjbghshbxdfhghshc
- lots of bugs in parsing still
- invocation is a stub

* expr parsing works

* awawa

* Saving work

* Improve APIs a bit all around, add shortcuts.

* awa

* awa

* AAAAAA

* save work

* Move shit to engine

* lord

* bql is kill

* forgot the fucking bike rack

* bql is kill for real

* pjb will kill me

* aughfhbdj

* adgddf

* gdsgvfvxshngfgh

* b

* hfsjhghj

* a

* tf you mean i have to document it

* follow C# standards

* Assorted cleanup and documentation pass, minor bugfix in ValueRefParser.

* Start porting old commands, remove that pesky prefix in favor of integrating with the shell.

* bw

* Fix valueref up a bit, improve autocomplete for it.

* awa

* fix tests

* git shut up

* Arithmetic commands.

* parse improvements

* Update engine.

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
2023-08-02 16:09:08 -05:00

50 lines
1.7 KiB
C#

using System.Numerics;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Bql;
[GenerateTypedNameReferences]
internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
{
private readonly IClientConsoleHost _console;
private readonly ILocalizationManager _loc;
public ToolshedVisualizeWindow(IClientConsoleHost console, ILocalizationManager loc)
{
_console = console;
_loc = loc;
RobustXamlLoader.Load(this);
}
protected override Vector2 ContentsMinimumSize => new(500, 700);
public void Update((string name, EntityUid entity)[] entities)
{
StatusLabel.Text = _loc.GetString("ui-bql-results-status", ("count", entities.Length));
ItemList.RemoveAllChildren();
foreach (var (name, entity) in entities)
{
var nameLabel = new Label { Text = name, HorizontalExpand = true };
var tpButton = new Button { Text = _loc.GetString("ui-bql-results-tp") };
tpButton.OnPressed += _ => _console.ExecuteCommand($"tpto {entity}");
tpButton.ToolTip = _loc.GetString("ui-bql-results-tp-tooltip");
var vvButton = new Button { Text = _loc.GetString("ui-bql-results-vv") };
vvButton.ToolTip = _loc.GetString("ui-bql-results-vv-tooltip");
vvButton.OnPressed += _ => _console.ExecuteCommand($"vv {entity}");
ItemList.AddChild(new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
Children = { nameLabel, tpButton, vvButton }
});
}
}
}