Converts AdminMenu to partially use XAML (#3231)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Add Atmos}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Add Atmos}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,43 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class AddAtmosWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IMapGrid>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
foreach (var grid in _data)
|
||||
{
|
||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Index;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Add Gas}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc TileX}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="TileXSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc TileY}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="TileYSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Gas}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GasOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Amount}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="AmountSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Add Gas}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,64 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class AddGasWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IMapGrid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
foreach (var grid in _gridData)
|
||||
{
|
||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
|
||||
}
|
||||
|
||||
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
|
||||
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Index;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"addgas {TileXSpin.Value} {TileYSpin.Value} {gridIndex} {gasId} {AmountSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<MarginContainer
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:at="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab"
|
||||
MarginLeftOverride="4"
|
||||
MarginTopOverride="4" MarginRightOverride="4"
|
||||
MarginBottomOverride="4"
|
||||
CustomMinimumSize="50 50">
|
||||
<GridContainer Columns="4">
|
||||
<amc:UICommandButton Text="{Loc Add Atmos}" Command="addatmos" WindowType="{x:Type at:AddAtmosWindow}" />
|
||||
<amc:UICommandButton Text="{Loc Add Gas}" Command="addgas" WindowType="{x:Type at:AddGasWindow}" />
|
||||
<amc:UICommandButton Text="{Loc Fill Gas}" Command="fillgas" WindowType="{x:Type at:FillGasWindow}" />
|
||||
<amc:UICommandButton Text="{Loc Set Temperature}" Command="settemp"
|
||||
WindowType="{x:Type at:SetTemperatureWindow}" />
|
||||
</GridContainer>
|
||||
</MarginContainer>
|
||||
@@ -0,0 +1,11 @@
|
||||
#nullable enable
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class AtmosTab : MarginContainer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Fill Gas}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Gas}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GasOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Amount}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="AmountSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Fill Gas}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,64 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Shared.Atmos;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class FillGasWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IMapGrid>? _gridData;
|
||||
private IEnumerable<GasPrototype>? _gasData;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill out grids
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
foreach (var grid in _gridData)
|
||||
{
|
||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
|
||||
// Fill out gases
|
||||
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
|
||||
foreach (var gas in _gasData)
|
||||
{
|
||||
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
|
||||
}
|
||||
|
||||
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
|
||||
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_gridData == null || _gasData == null)
|
||||
return;
|
||||
|
||||
var gridList = _gridData.ToList();
|
||||
var gridIndex = gridList[GridOptions.SelectedId].Index;
|
||||
|
||||
var gasList = _gasData.ToList();
|
||||
var gasId = gasList[GasOptions.SelectedId].ID;
|
||||
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"fillgas {gridIndex} {gasId} {AmountSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Set Temperature}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc TileX}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="TileXSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc TileY}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="TileYSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Temperature}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<SpinBox Name="TemperatureSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Set Temperature}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,44 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class SetTemperatureWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IMapGrid>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
foreach (var grid in _data)
|
||||
{
|
||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||
}
|
||||
|
||||
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Index;
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user