Typo, redundant string interpolation, namespaces and imports cleanup (#2068)
* Readonly, typos and redundant string interpolations * Namespaces * Optimize imports * Address reviews * but actually * Localize missing strings * Remove redundant vars
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.EntitySystems;
|
||||
using Content.Client.StationEvents;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -18,54 +21,51 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static Robust.Client.UserInterface.Controls.BaseButton;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu
|
||||
{
|
||||
public class AdminMenuWindow : SS14Window
|
||||
{
|
||||
public TabContainer MasterTabContainer;
|
||||
public VBoxContainer PlayerList;
|
||||
public Label PlayerCount;
|
||||
public readonly TabContainer MasterTabContainer;
|
||||
public readonly VBoxContainer PlayerList;
|
||||
public readonly Label PlayerCount;
|
||||
|
||||
protected override Vector2? CustomSize => (500, 250);
|
||||
|
||||
private List<CommandButton> _adminButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _adminButtons = new List<CommandButton>
|
||||
{
|
||||
new KickCommandButton(),
|
||||
new DirectCommandButton("Admin Ghost", "aghost"),
|
||||
//TODO: teleport
|
||||
};
|
||||
private List<CommandButton> _adminbusButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _adminbusButtons = new List<CommandButton>
|
||||
{
|
||||
new SpawnEntitiesCommandButton(),
|
||||
new SpawnTilesCommandButton(),
|
||||
new StationEventsCommandButton(),
|
||||
};
|
||||
private List<CommandButton> _debugButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _debugButtons = new List<CommandButton>
|
||||
{
|
||||
new AddAtmosCommandButton(),
|
||||
new FillGasCommandButton(),
|
||||
};
|
||||
private List<CommandButton> _roundButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _roundButtons = new List<CommandButton>
|
||||
{
|
||||
new DirectCommandButton("Start Round", "startround"),
|
||||
new DirectCommandButton("End Round", "endround"),
|
||||
new DirectCommandButton("Restart Round", "restartround"),
|
||||
};
|
||||
private List<CommandButton> _serverButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _serverButtons = new List<CommandButton>
|
||||
{
|
||||
new DirectCommandButton("Reboot", "restart"),
|
||||
new DirectCommandButton("Shutdown", "shutdown"),
|
||||
};
|
||||
|
||||
private static readonly Color SeparatorColor = Color.FromHex("#3D4059");
|
||||
private class HSeperator : Control
|
||||
private class HSeparator : Control
|
||||
{
|
||||
public HSeperator()
|
||||
public HSeparator()
|
||||
{
|
||||
AddChild(new PanelContainer {
|
||||
PanelOverride = new StyleBoxFlat
|
||||
@@ -135,7 +135,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
header
|
||||
}
|
||||
});
|
||||
PlayerList.AddChild(new HSeperator());
|
||||
PlayerList.AddChild(new HSeparator());
|
||||
|
||||
var useAltColor = false;
|
||||
foreach (var player in sessions)
|
||||
@@ -232,7 +232,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
refreshButton.OnPressed += RefreshPlayerList;
|
||||
|
||||
PlayerList = new VBoxContainer();
|
||||
|
||||
|
||||
var playerVBox = new VBoxContainer
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
@@ -464,7 +464,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string RequiredCommand => "events";
|
||||
public override string? SubmitText => "Run";
|
||||
|
||||
private CommandUIDropDown _eventsDropDown = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _eventsDropDown = new CommandUIDropDown
|
||||
{
|
||||
Name = "Event",
|
||||
GetData = () =>
|
||||
@@ -487,7 +487,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
Name = "Pause",
|
||||
Handler = () =>
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events pause");
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("events pause");
|
||||
},
|
||||
},
|
||||
new CommandUIButton
|
||||
@@ -495,7 +495,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
Name = "Resume",
|
||||
Handler = () =>
|
||||
{
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand($"events resume");
|
||||
IoCManager.Resolve<IClientConsole>().ProcessCommand("events resume");
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -511,14 +511,14 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Kick";
|
||||
public override string RequiredCommand => "kick";
|
||||
|
||||
private CommandUIDropDown _playerDropDown = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown
|
||||
{
|
||||
Name = "Player",
|
||||
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
|
||||
GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})",
|
||||
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
|
||||
};
|
||||
private CommandUILineEdit _reason = new CommandUILineEdit
|
||||
private readonly CommandUILineEdit _reason = new CommandUILineEdit
|
||||
{
|
||||
Name = "Reason"
|
||||
};
|
||||
@@ -540,7 +540,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Add Atmos";
|
||||
public override string RequiredCommand => "addatmos";
|
||||
|
||||
private CommandUIDropDown _grid = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _grid = new CommandUIDropDown
|
||||
{
|
||||
Name = "Grid",
|
||||
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
|
||||
@@ -564,7 +564,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Fill Gas";
|
||||
public override string RequiredCommand => "fillgas";
|
||||
|
||||
private CommandUIDropDown _grid = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _grid = new CommandUIDropDown
|
||||
{
|
||||
Name = "Grid",
|
||||
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
|
||||
@@ -572,7 +572,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
|
||||
};
|
||||
|
||||
private CommandUIDropDown _gas = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _gas = new CommandUIDropDown
|
||||
{
|
||||
Name = "Gas",
|
||||
GetData = () =>
|
||||
|
||||
Reference in New Issue
Block a user