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,11 +1,11 @@
|
||||
using Content.Shared.Input;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Content.Client.UserInterface.AdminMenu
|
||||
{
|
||||
|
||||
@@ -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 = () =>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
{
|
||||
}
|
||||
@@ -9,8 +9,6 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
{
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace Content.Client.UserInterface
|
||||
//Round end text
|
||||
if (!string.IsNullOrEmpty(roundEnd))
|
||||
{
|
||||
var roundendLabel = new RichTextLabel();
|
||||
roundendLabel.SetMarkup(Loc.GetString(roundEnd));
|
||||
RoundEndSummaryTab.AddChild(roundendLabel);
|
||||
var roundEndLabel = new RichTextLabel();
|
||||
roundEndLabel.SetMarkup(Loc.GetString(roundEnd));
|
||||
RoundEndSummaryTab.AddChild(roundEndLabel);
|
||||
}
|
||||
|
||||
//Duration
|
||||
@@ -72,27 +72,27 @@ namespace Content.Client.UserInterface
|
||||
//Put observers at the bottom of the list. Put antags on top.
|
||||
var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);
|
||||
//Create labels for each player info.
|
||||
foreach (var plyinfo in manifestSortedList)
|
||||
foreach (var playerInfo in manifestSortedList)
|
||||
{
|
||||
var playerInfoText = new RichTextLabel()
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.Fill,
|
||||
};
|
||||
|
||||
if (plyinfo.Observer)
|
||||
if (playerInfo.Observer)
|
||||
{
|
||||
playerInfoText.SetMarkup(
|
||||
Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
|
||||
plyinfo.PlayerOOCName, plyinfo.PlayerICName));
|
||||
playerInfo.PlayerOOCName, playerInfo.PlayerICName));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: On Hover display a popup detailing more play info.
|
||||
//For example: their antag goals and if they completed them sucessfully.
|
||||
var icNameColor = plyinfo.Antag ? "red" : "white";
|
||||
var icNameColor = playerInfo.Antag ? "red" : "white";
|
||||
playerInfoText.SetMarkup(
|
||||
Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
|
||||
plyinfo.PlayerOOCName, icNameColor, plyinfo.PlayerICName, Loc.GetString(plyinfo.Role)));
|
||||
playerInfo.PlayerOOCName, icNameColor, playerInfo.PlayerICName, Loc.GetString(playerInfo.Role)));
|
||||
}
|
||||
innerScrollContainer.AddChild(playerInfoText);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Client.UserInterface.Stylesheets;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
|
||||
Reference in New Issue
Block a user