Converts AdminMenu to partially use XAML (#3231)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<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.AdminTab"
|
||||
MarginLeftOverride="4"
|
||||
MarginTopOverride="4" MarginRightOverride="4"
|
||||
MarginBottomOverride="4"
|
||||
CustomMinimumSize="50 50">
|
||||
<VBoxContainer>
|
||||
<GridContainer Columns="4">
|
||||
<amc:UICommandButton Command="kick" Text="{Loc Kick}" WindowType="{x:Type at:KickWindow}" />
|
||||
<amc:UICommandButton Command="ban" Text="{Loc Ban}" WindowType="{x:Type at:BanWindow}" />
|
||||
<amc:CommandButton Command="aghost" Text="{Loc Admin Ghost}" />
|
||||
<amc:UICommandButton Command="tpto" Text="{Loc Teleport}" WindowType="{x:Type at:TeleportWindow}" />
|
||||
<amc:CommandButton Command="permissions" Text="{Loc Permissions Panel}" />
|
||||
</GridContainer>
|
||||
</VBoxContainer>
|
||||
</MarginContainer>
|
||||
@@ -0,0 +1,11 @@
|
||||
#nullable enable
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class AdminTab : MarginContainer
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Ban}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Player}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="PlayerOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Reason}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<LineEdit Name="ReasonLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Minutes}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<LineEdit Name="MinutesLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Ban}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,48 @@
|
||||
#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.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class BanWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IPlayerSession>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill the Option data
|
||||
_data = IoCManager.Resolve<IPlayerManager>().Sessions;
|
||||
foreach (var session in _data)
|
||||
{
|
||||
PlayerOptions.AddItem(GetDisplayName(session));
|
||||
}
|
||||
PlayerOptions.OnItemSelected += eventArgs => PlayerOptions.SelectId(eventArgs.Id);
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private static string GetDisplayName(IPlayerSession session)
|
||||
{
|
||||
return $"{session.Name} ({session.AttachedEntity?.Name})";
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var session = dataList[PlayerOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"ban \"{session.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\" {MinutesLine.Text}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Kick}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Player}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="PlayerOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Reason}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<LineEdit Name="ReasonLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Kick}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,48 @@
|
||||
#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.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class KickWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IPlayerSession>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill the Option data
|
||||
_data = IoCManager.Resolve<IPlayerManager>().Sessions;
|
||||
foreach (var session in _data)
|
||||
{
|
||||
PlayerOptions.AddItem(GetDisplayName(session));
|
||||
}
|
||||
PlayerOptions.OnItemSelected += eventArgs => PlayerOptions.SelectId(eventArgs.Id);
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private static string GetDisplayName(IPlayerSession session)
|
||||
{
|
||||
return $"{session.Name} ({session.AttachedEntity?.Name})";
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var session = dataList[PlayerOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"kick \"{session.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="{Loc Teleport}">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Player}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="PlayerOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="SubmitButton" Text="{Loc Teleport}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,49 @@
|
||||
#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;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class TeleportWindow : SS14Window
|
||||
{
|
||||
private IEnumerable<IPlayerSession>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// Fill the Option data
|
||||
_data = IoCManager.Resolve<IPlayerManager>().Sessions;
|
||||
foreach (var session in _data)
|
||||
{
|
||||
PlayerOptions.AddItem(GetDisplayName(session));
|
||||
}
|
||||
PlayerOptions.OnItemSelected += eventArgs => PlayerOptions.SelectId(eventArgs.Id);
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private static string GetDisplayName(IPlayerSession session)
|
||||
{
|
||||
return $"{session.Name} ({session.AttachedEntity?.Name})";
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
// Find the value
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var session = dataList[PlayerOptions.SelectedId];
|
||||
// Execute command
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"tpto \"{session.Name}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<MarginContainer
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:abt="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab"
|
||||
MarginLeftOverride="4"
|
||||
MarginTopOverride="4" MarginRightOverride="4"
|
||||
MarginBottomOverride="4"
|
||||
CustomMinimumSize="50 50">
|
||||
<GridContainer
|
||||
Columns="4">
|
||||
<amc:CommandButton Name="SpawnEntitiesButton" Text="{Loc Spawn Entities}" />
|
||||
<amc:CommandButton Name="SpawnTilesButton" Text="{Loc Spawn Tiles} " />
|
||||
<amc:UICommandButton Command="events" Text="{Loc Station Events}" WindowType="{x:Type abt:StationEventsWindow}" />
|
||||
</GridContainer>
|
||||
</MarginContainer>
|
||||
@@ -0,0 +1,42 @@
|
||||
#nullable enable
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Placement;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class AdminbusTab : MarginContainer
|
||||
{
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
|
||||
// TODO: This will probably need some command check at some point
|
||||
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnOnPressed;
|
||||
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private static void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
var manager = IoCManager.Resolve<IAdminMenuManager>();
|
||||
var window = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
|
||||
IoCManager.Resolve<IPrototypeManager>(),
|
||||
IoCManager.Resolve<IResourceCache>());
|
||||
manager.OpenCommand(window);
|
||||
}
|
||||
|
||||
private static void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
var manager = IoCManager.Resolve<IAdminMenuManager>();
|
||||
var window = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
|
||||
IoCManager.Resolve<IPlacementManager>(),
|
||||
IoCManager.Resolve<IResourceCache>());
|
||||
manager.OpenCommand(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<SS14Window
|
||||
xmlns="https://spacestation14.io" Title="Kick">
|
||||
<VBoxContainer>
|
||||
<HBoxContainer>
|
||||
<Label Text="{Loc Event}" CustomMinimumSize="100 0" />
|
||||
<Control CustomMinimumSize="50 0" />
|
||||
<OptionButton Name="EventsOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
|
||||
</HBoxContainer>
|
||||
<Button Name="PauseButton" Text="{Loc Pause}" />
|
||||
<Button Name="ResumeButton" Text="{Loc Resume}" />
|
||||
<Button Name="SubmitButton" Text="{Loc Run}" />
|
||||
</VBoxContainer>
|
||||
</SS14Window>
|
||||
@@ -0,0 +1,54 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.StationEvents;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
public partial class StationEventsWindow : SS14Window
|
||||
{
|
||||
private List<string>? _data;
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
_data = IoCManager.Resolve<IStationEventManager>().StationEvents.ToList();
|
||||
_data.Add(_data.Any() ? Loc.GetString("Not loaded") : Loc.GetString("Random"));
|
||||
foreach (var stationEvent in _data)
|
||||
{
|
||||
EventsOptions.AddItem(stationEvent);
|
||||
}
|
||||
|
||||
EventsOptions.OnItemSelected += eventArgs => EventsOptions.SelectId(eventArgs.Id);
|
||||
PauseButton.OnPressed += PauseButtonOnOnPressed;
|
||||
ResumeButton.OnPressed += ResumeButtonOnOnPressed;
|
||||
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
||||
}
|
||||
|
||||
private static void PauseButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events pause");
|
||||
}
|
||||
|
||||
private static void ResumeButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events resume");
|
||||
}
|
||||
|
||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_data == null)
|
||||
return;
|
||||
var selectedEvent = _data[EventsOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"events run \"{selectedEvent}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Content.Client/UserInterface/AdminMenu/Tabs/PlayerTab.xaml
Normal file
15
Content.Client/UserInterface/AdminMenu/Tabs/PlayerTab.xaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<MarginContainer
|
||||
xmlns="https://spacestation14.io">
|
||||
<VBoxContainer SizeFlagsVertical="Fill">
|
||||
<HBoxContainer SizeFlagsVertical="Fill">
|
||||
<Label Name="PlayerCount" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.7"
|
||||
Text="{Loc Player Count}" />
|
||||
<Button Name="RefreshButton" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.3"
|
||||
Text="{Loc Refresh}" />
|
||||
</HBoxContainer>
|
||||
<Control CustomMinimumSize="0 5" />
|
||||
<ScrollContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand">
|
||||
<VBoxContainer Name="PlayerList" />
|
||||
</ScrollContainer>
|
||||
</VBoxContainer>
|
||||
</MarginContainer>
|
||||
150
Content.Client/UserInterface/AdminMenu/Tabs/PlayerTab.xaml.cs
Normal file
150
Content.Client/UserInterface/AdminMenu/Tabs/PlayerTab.xaml.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class PlayerTab : MarginContainer
|
||||
{
|
||||
public delegate void PlayerListRefresh();
|
||||
|
||||
public event PlayerListRefresh? OnPlayerListRefresh;
|
||||
|
||||
public PlayerTab()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
RefreshButton.OnPressed += (_) => OnPlayerListRefresh?.Invoke();
|
||||
}
|
||||
|
||||
protected override void EnteredTree()
|
||||
{
|
||||
OnPlayerListRefresh?.Invoke();
|
||||
}
|
||||
|
||||
public void RefreshPlayerList(Dictionary<string, string> namesToPlayers)
|
||||
{
|
||||
PlayerList.RemoveAllChildren();
|
||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||
PlayerCount.Text = $"Players: {playerManager.PlayerCount}";
|
||||
|
||||
var altColor = Color.FromHex("#292B38");
|
||||
var defaultColor = Color.FromHex("#2F2F3B");
|
||||
|
||||
var header = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
SeparationOverride = 4,
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = "Name",
|
||||
SizeFlagsStretchRatio = 2f,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
},
|
||||
new VSeparator(),
|
||||
new Label
|
||||
{
|
||||
Text = "Player",
|
||||
SizeFlagsStretchRatio = 2f,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
}
|
||||
}
|
||||
};
|
||||
PlayerList.AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = altColor,
|
||||
},
|
||||
Children =
|
||||
{
|
||||
header
|
||||
}
|
||||
});
|
||||
PlayerList.AddChild(new HSeparator());
|
||||
|
||||
var useAltColor = false;
|
||||
foreach (var (name, player) in namesToPlayers)
|
||||
{
|
||||
var hBox = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
SeparationOverride = 4,
|
||||
Children =
|
||||
{
|
||||
new Label
|
||||
{
|
||||
Text = player,
|
||||
SizeFlagsStretchRatio = 2f,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
ClipText = true
|
||||
},
|
||||
new VSeparator(),
|
||||
new Label
|
||||
{
|
||||
Text = player,
|
||||
SizeFlagsStretchRatio = 2f,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
ClipText = true
|
||||
}
|
||||
}
|
||||
};
|
||||
PlayerList.AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = useAltColor ? altColor : defaultColor,
|
||||
},
|
||||
Children =
|
||||
{
|
||||
hBox
|
||||
}
|
||||
});
|
||||
useAltColor ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Color SeparatorColor = Color.FromHex("#3D4059");
|
||||
|
||||
private class VSeparator : PanelContainer
|
||||
{
|
||||
public VSeparator()
|
||||
{
|
||||
CustomMinimumSize = (2, 5);
|
||||
AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = SeparatorColor
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private class HSeparator : Control
|
||||
{
|
||||
public HSeparator()
|
||||
{
|
||||
AddChild(new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = SeparatorColor,
|
||||
ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Content.Client/UserInterface/AdminMenu/Tabs/RoundTab.xaml
Normal file
14
Content.Client/UserInterface/AdminMenu/Tabs/RoundTab.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<MarginContainer
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
|
||||
MarginLeftOverride="4"
|
||||
MarginTopOverride="4" MarginRightOverride="4"
|
||||
MarginBottomOverride="4"
|
||||
CustomMinimumSize="50 50">
|
||||
<GridContainer
|
||||
Columns="4">
|
||||
<amc:CommandButton Command="startround" Text="{Loc Start Round}" />
|
||||
<amc:CommandButton Command="endround" Text="{Loc End Round}" />
|
||||
<amc:CommandButton Command="restartround" Text="{Loc Restart Round}" />
|
||||
</GridContainer>
|
||||
</MarginContainer>
|
||||
11
Content.Client/UserInterface/AdminMenu/Tabs/RoundTab.xaml.cs
Normal file
11
Content.Client/UserInterface/AdminMenu/Tabs/RoundTab.xaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
#nullable enable
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class RoundTab : MarginContainer
|
||||
{
|
||||
}
|
||||
}
|
||||
13
Content.Client/UserInterface/AdminMenu/Tabs/ServerTab.xaml
Normal file
13
Content.Client/UserInterface/AdminMenu/Tabs/ServerTab.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<MarginContainer
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
|
||||
MarginLeftOverride="4"
|
||||
MarginTopOverride="4" MarginRightOverride="4"
|
||||
MarginBottomOverride="4"
|
||||
CustomMinimumSize="50 50">
|
||||
<GridContainer
|
||||
Columns="4" >
|
||||
<amc:CommandButton Command="restart" Text="{Loc Reboot}"></amc:CommandButton>
|
||||
<amc:CommandButton Command="shutdown" Text="{Loc Shutdown}"></amc:CommandButton>
|
||||
</GridContainer>
|
||||
</MarginContainer>
|
||||
@@ -0,0 +1,14 @@
|
||||
#nullable enable
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu.Tabs
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public partial class ServerTab : MarginContainer
|
||||
{
|
||||
public ServerTab()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user