2023-07-08 14:08:32 +10:00
|
|
|
|
using System.Numerics;
|
|
|
|
|
|
using Robust.Client.AutoGenerated;
|
2023-06-01 00:29:31 +02:00
|
|
|
|
using Robust.Client.Console;
|
|
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
|
|
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Bql;
|
|
|
|
|
|
|
|
|
|
|
|
[GenerateTypedNameReferences]
|
2023-08-02 16:09:08 -05:00
|
|
|
|
internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
|
2023-06-01 00:29:31 +02:00
|
|
|
|
{
|
|
|
|
|
|
private readonly IClientConsoleHost _console;
|
|
|
|
|
|
private readonly ILocalizationManager _loc;
|
|
|
|
|
|
|
2023-08-02 16:09:08 -05:00
|
|
|
|
public ToolshedVisualizeWindow(IClientConsoleHost console, ILocalizationManager loc)
|
2023-06-01 00:29:31 +02:00
|
|
|
|
{
|
|
|
|
|
|
_console = console;
|
|
|
|
|
|
_loc = loc;
|
|
|
|
|
|
|
|
|
|
|
|
RobustXamlLoader.Load(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-08 14:08:32 +10:00
|
|
|
|
protected override Vector2 ContentsMinimumSize => new(500, 700);
|
2023-06-01 00:29:31 +02:00
|
|
|
|
|
2023-09-11 09:42:41 +10:00
|
|
|
|
public void Update((string name, NetEntity entity)[] entities)
|
2023-06-01 00:29:31 +02:00
|
|
|
|
{
|
|
|
|
|
|
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 }
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|