Cargo economy balance (#11123)
Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
This commit is contained in:
29
Content.Client/UserInterface/StatValuesEui.cs
Normal file
29
Content.Client/UserInterface/StatValuesEui.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Client.Eui;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.UserInterface;
|
||||
|
||||
namespace Content.Client.UserInterface;
|
||||
|
||||
public sealed class StatValuesEui : BaseEui
|
||||
{
|
||||
private readonly StatsWindow _window;
|
||||
|
||||
public StatValuesEui()
|
||||
{
|
||||
_window = new StatsWindow();
|
||||
_window.Title = "Melee stats";
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += Closed;
|
||||
}
|
||||
|
||||
public override void HandleMessage(EuiMessageBase msg)
|
||||
{
|
||||
base.HandleMessage(msg);
|
||||
|
||||
if (msg is not StatValuesEuiMessage eui)
|
||||
return;
|
||||
|
||||
_window.Title = eui.Title;
|
||||
_window.UpdateValues(eui.Headers, eui.Values);
|
||||
}
|
||||
}
|
||||
11
Content.Client/UserInterface/StatsWindow.xaml
Normal file
11
Content.Client/UserInterface/StatsWindow.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
Title="Stats window"
|
||||
MinSize="600 400">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<ScrollContainer HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
SizeFlagsStretchRatio="6">
|
||||
<GridContainer Name="Values"/>
|
||||
</ScrollContainer>
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
48
Content.Client/UserInterface/StatsWindow.xaml.cs
Normal file
48
Content.Client/UserInterface/StatsWindow.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Content.Client.Administration.UI.CustomControls;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class StatsWindow : DefaultWindow
|
||||
{
|
||||
public StatsWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
public void UpdateValues(List<string> headers, List<string[]> values)
|
||||
{
|
||||
Values.DisposeAllChildren();
|
||||
Values.Columns = headers.Count;
|
||||
|
||||
for (var i = 0; i < headers.Count; i++)
|
||||
{
|
||||
var item = headers[i];
|
||||
Values.AddChild(new Label()
|
||||
{
|
||||
Text = item,
|
||||
});
|
||||
}
|
||||
|
||||
values.Sort((x, y) => string.Compare(x[0], y[0], StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
for (var i = 0; i < values.Count; i++)
|
||||
{
|
||||
var value = values[i];
|
||||
|
||||
for (var j = 0; j < value.Length; j++)
|
||||
{
|
||||
Values.AddChild(new Label()
|
||||
{
|
||||
Text = value[j],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user