Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client * Content.Benchmarks * Content.IntegrationTests * Content.Server * Content.Server.Database * Content.Shared * Content.Tests * Merge fixes Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -33,30 +33,30 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
|
||||
protected override Vector2? CustomSize => (500, 250);
|
||||
|
||||
private readonly List<CommandButton> _adminButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _adminButtons = new()
|
||||
{
|
||||
new KickCommandButton(),
|
||||
new DirectCommandButton("Admin Ghost", "aghost"),
|
||||
new TeleportCommandButton(),
|
||||
};
|
||||
private readonly List<CommandButton> _adminbusButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _adminbusButtons = new()
|
||||
{
|
||||
new SpawnEntitiesCommandButton(),
|
||||
new SpawnTilesCommandButton(),
|
||||
new StationEventsCommandButton(),
|
||||
};
|
||||
private readonly List<CommandButton> _debugButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _debugButtons = new()
|
||||
{
|
||||
new AddAtmosCommandButton(),
|
||||
new FillGasCommandButton(),
|
||||
};
|
||||
private readonly List<CommandButton> _roundButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _roundButtons = new()
|
||||
{
|
||||
new DirectCommandButton("Start Round", "startround"),
|
||||
new DirectCommandButton("End Round", "endround"),
|
||||
new DirectCommandButton("Restart Round", "restartround"),
|
||||
};
|
||||
private readonly List<CommandButton> _serverButtons = new List<CommandButton>
|
||||
private readonly List<CommandButton> _serverButtons = new()
|
||||
{
|
||||
new DirectCommandButton("Reboot", "restart"),
|
||||
new DirectCommandButton("Shutdown", "shutdown"),
|
||||
@@ -463,7 +463,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string RequiredCommand => "events";
|
||||
public override string? SubmitText => "Run";
|
||||
|
||||
private readonly CommandUIDropDown _eventsDropDown = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _eventsDropDown = new()
|
||||
{
|
||||
Name = "Event",
|
||||
GetData = () =>
|
||||
@@ -478,7 +478,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((string) obj).ToLower(),
|
||||
};
|
||||
|
||||
public override List<CommandUIControl> UI => new List<CommandUIControl>
|
||||
public override List<CommandUIControl> UI => new()
|
||||
{
|
||||
_eventsDropDown,
|
||||
new CommandUIButton
|
||||
@@ -510,19 +510,19 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Kick";
|
||||
public override string RequiredCommand => "kick";
|
||||
|
||||
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _playerDropDown = new()
|
||||
{
|
||||
Name = "Player",
|
||||
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
|
||||
GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})",
|
||||
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
|
||||
};
|
||||
private readonly CommandUILineEdit _reason = new CommandUILineEdit
|
||||
private readonly CommandUILineEdit _reason = new()
|
||||
{
|
||||
Name = "Reason"
|
||||
};
|
||||
|
||||
public override List<CommandUIControl> UI => new List<CommandUIControl>
|
||||
public override List<CommandUIControl> UI => new()
|
||||
{
|
||||
_playerDropDown,
|
||||
_reason
|
||||
@@ -539,7 +539,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Teleport";
|
||||
public override string RequiredCommand => "tpto";
|
||||
|
||||
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _playerDropDown = new()
|
||||
{
|
||||
Name = "Player",
|
||||
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
|
||||
@@ -547,7 +547,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
|
||||
};
|
||||
|
||||
public override List<CommandUIControl> UI => new List<CommandUIControl>
|
||||
public override List<CommandUIControl> UI => new()
|
||||
{
|
||||
_playerDropDown
|
||||
};
|
||||
@@ -563,7 +563,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Add Atmos";
|
||||
public override string RequiredCommand => "addatmos";
|
||||
|
||||
private readonly CommandUIDropDown _grid = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _grid = new()
|
||||
{
|
||||
Name = "Grid",
|
||||
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
|
||||
@@ -571,7 +571,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
|
||||
};
|
||||
|
||||
public override List<CommandUIControl> UI => new List<CommandUIControl>
|
||||
public override List<CommandUIControl> UI => new()
|
||||
{
|
||||
_grid,
|
||||
};
|
||||
@@ -587,7 +587,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
public override string Name => "Fill Gas";
|
||||
public override string RequiredCommand => "fillgas";
|
||||
|
||||
private readonly CommandUIDropDown _grid = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _grid = new()
|
||||
{
|
||||
Name = "Grid",
|
||||
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
|
||||
@@ -595,7 +595,7 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
|
||||
};
|
||||
|
||||
private readonly CommandUIDropDown _gas = new CommandUIDropDown
|
||||
private readonly CommandUIDropDown _gas = new()
|
||||
{
|
||||
Name = "Gas",
|
||||
GetData = () =>
|
||||
@@ -607,12 +607,12 @@ namespace Content.Client.UserInterface.AdminMenu
|
||||
GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(),
|
||||
};
|
||||
|
||||
private readonly CommandUISpinBox _amount = new CommandUISpinBox
|
||||
private readonly CommandUISpinBox _amount = new()
|
||||
{
|
||||
Name = "Amount"
|
||||
};
|
||||
|
||||
public override List<CommandUIControl> UI => new List<CommandUIControl>
|
||||
public override List<CommandUIControl> UI => new()
|
||||
{
|
||||
_grid,
|
||||
_gas,
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Client.UserInterface.Cargo
|
||||
public event Action<BaseButton.ButtonEventArgs> OnOrderApproved;
|
||||
public event Action<BaseButton.ButtonEventArgs> OnOrderCanceled;
|
||||
|
||||
private readonly List<string> _categoryStrings = new List<string>();
|
||||
private readonly List<string> _categoryStrings = new();
|
||||
|
||||
private Label _accountNameLabel { get; set; }
|
||||
private Label _pointsLabel { get; set; }
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
[Dependency] private readonly IResourceCache _resourceManager = default!;
|
||||
|
||||
private static readonly Dictionary<string, int> PatronTierPriority = new Dictionary<string, int>
|
||||
private static readonly Dictionary<string, int> PatronTierPriority = new()
|
||||
{
|
||||
["Nuclear Operative"] = 1,
|
||||
["Syndicate Agent"] = 2,
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
public class GhostGui : Control
|
||||
{
|
||||
private readonly Button _returnToBody = new Button() {Text = Loc.GetString("Return to body")};
|
||||
private readonly Button _ghostWarp = new Button() {Text = Loc.GetString("Ghost Warp")};
|
||||
private readonly Button _returnToBody = new() {Text = Loc.GetString("Return to body")};
|
||||
private readonly Button _ghostWarp = new() {Text = Loc.GetString("Ghost Warp")};
|
||||
private readonly GhostComponent _owner;
|
||||
|
||||
public GhostGui(GhostComponent owner)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
public partial class HumanoidProfileEditor : Control
|
||||
{
|
||||
private static readonly StyleBoxFlat HighlightedStyle = new StyleBoxFlat
|
||||
private static readonly StyleBoxFlat HighlightedStyle = new()
|
||||
{
|
||||
BackgroundColor = new Color(47, 47, 53),
|
||||
ContentMarginTopOverride = 10,
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
|
||||
public class ItemStatusPanel : Control
|
||||
{
|
||||
[ViewVariables]
|
||||
private readonly List<(IItemStatus, Control)> _activeStatusComponents = new List<(IItemStatus, Control)>();
|
||||
private readonly List<(IItemStatus, Control)> _activeStatusComponents = new();
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Label _itemNameLabel;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Client.UserInterface
|
||||
|
||||
public event Action<string> SelectedId;
|
||||
|
||||
private readonly Dictionary<string, JobButton> _jobButtons = new Dictionary<string, JobButton>();
|
||||
private readonly Dictionary<string, JobButton> _jobButtons = new();
|
||||
|
||||
public LateJoinGui()
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Content.Client.UserInterface
|
||||
|
||||
private static SpriteView MakeSpriteView(IEntity entity, Direction direction)
|
||||
{
|
||||
return new SpriteView
|
||||
return new()
|
||||
{
|
||||
Sprite = entity.GetComponent<ISpriteComponent>(),
|
||||
OverrideDirection = direction,
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
|
||||
private sealed class KeyRebindControl : Control
|
||||
{
|
||||
// List of key functions that must be registered as toggle instead.
|
||||
private static readonly HashSet<BoundKeyFunction> ToggleFunctions = new HashSet<BoundKeyFunction>
|
||||
private static readonly HashSet<BoundKeyFunction> ToggleFunctions = new()
|
||||
{
|
||||
EngineKeyFunctions.ShowDebugMonitors,
|
||||
EngineKeyFunctions.HideUI,
|
||||
@@ -31,9 +31,9 @@ namespace Content.Client.UserInterface
|
||||
private BindButton? _currentlyRebinding;
|
||||
|
||||
private readonly Dictionary<BoundKeyFunction, KeyControl> _keyControls =
|
||||
new Dictionary<BoundKeyFunction, KeyControl>();
|
||||
new();
|
||||
|
||||
private readonly List<Action> _deferCommands = new List<Action>();
|
||||
private readonly List<Action> _deferCommands = new();
|
||||
|
||||
public KeyRebindControl()
|
||||
{
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace Content.Client.ParticleAccelerator
|
||||
|
||||
PASegmentControl Segment(string name)
|
||||
{
|
||||
return new PASegmentControl(this, resourceCache, name);
|
||||
return new(this, resourceCache, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace Content.Client.UserInterface.Permissions
|
||||
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
||||
|
||||
private readonly Menu _menu;
|
||||
private readonly List<SS14Window> _subWindows = new List<SS14Window>();
|
||||
private readonly List<SS14Window> _subWindows = new();
|
||||
|
||||
private Dictionary<int, PermissionsEuiState.AdminRankData> _ranks =
|
||||
new Dictionary<int, PermissionsEuiState.AdminRankData>();
|
||||
new();
|
||||
|
||||
public PermissionsEui()
|
||||
{
|
||||
@@ -348,7 +348,7 @@ namespace Content.Client.UserInterface.Permissions
|
||||
public readonly Button? RemoveButton;
|
||||
|
||||
public readonly Dictionary<AdminFlags, (Button inherit, Button sub, Button plus)> FlagButtons
|
||||
= new Dictionary<AdminFlags, (Button, Button, Button)>();
|
||||
= new();
|
||||
|
||||
public EditAdminWindow(PermissionsEui ui, PermissionsEuiState.AdminData? data)
|
||||
{
|
||||
@@ -519,7 +519,7 @@ namespace Content.Client.UserInterface.Permissions
|
||||
public readonly LineEdit NameEdit;
|
||||
public readonly Button SaveButton;
|
||||
public readonly Button? RemoveButton;
|
||||
public readonly Dictionary<AdminFlags, CheckBox> FlagCheckBoxes = new Dictionary<AdminFlags, CheckBox>();
|
||||
public readonly Dictionary<AdminFlags, CheckBox> FlagCheckBoxes = new();
|
||||
|
||||
public EditAdminRankWindow(PermissionsEui ui, KeyValuePair<int, PermissionsEuiState.AdminRankData>? data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user