Removed LocalizationManager dependencies (#2059)

* Removed LocalizationManager dependencies

* Fixed error

Co-authored-by: David Tan <>
This commit is contained in:
DTanxxx
2020-09-17 09:55:50 +12:00
committed by GitHub
parent 6b4fbc211f
commit 27a5a7a09c
19 changed files with 99 additions and 130 deletions

View File

@@ -17,8 +17,6 @@ namespace Content.Client.Chat
public delegate void FilterToggledHandler(ChatBox chatBox, BaseButton.ButtonToggledEventArgs e); public delegate void FilterToggledHandler(ChatBox chatBox, BaseButton.ButtonToggledEventArgs e);
private readonly ILocalizationManager _localize = IoCManager.Resolve<ILocalizationManager>();
public HistoryLineEdit Input { get; private set; } public HistoryLineEdit Input { get; private set; }
public OutputPanel Contents { get; } public OutputPanel Contents { get; }
@@ -79,7 +77,7 @@ namespace Content.Client.Chat
AllButton = new Button AllButton = new Button
{ {
Text = _localize.GetString("All"), Text = Loc.GetString("All"),
Name = "ALL", Name = "ALL",
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand, SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand,
ToggleMode = true, ToggleMode = true,
@@ -87,14 +85,14 @@ namespace Content.Client.Chat
LocalButton = new Button LocalButton = new Button
{ {
Text = _localize.GetString("Local"), Text = Loc.GetString("Local"),
Name = "Local", Name = "Local",
ToggleMode = true, ToggleMode = true,
}; };
OOCButton = new Button OOCButton = new Button
{ {
Text = _localize.GetString("OOC"), Text = Loc.GetString("OOC"),
Name = "OOC", Name = "OOC",
ToggleMode = true, ToggleMode = true,
}; };
@@ -104,7 +102,7 @@ namespace Content.Client.Chat
{ {
AdminButton = new Button AdminButton = new Button
{ {
Text = _localize.GetString("Admin"), Text = Loc.GetString("Admin"),
Name = "Admin", Name = "Admin",
ToggleMode = true, ToggleMode = true,
}; };

View File

@@ -12,8 +12,6 @@ namespace Content.Client.Command
{ {
public class CommunicationsConsoleMenu : SS14Window public class CommunicationsConsoleMenu : SS14Window
{ {
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
protected override Vector2? CustomSize => new Vector2(600, 400); protected override Vector2? CustomSize => new Vector2(600, 400);
private CommunicationsConsoleBoundUserInterface Owner { get; set; } private CommunicationsConsoleBoundUserInterface Owner { get; set; }
@@ -25,7 +23,7 @@ namespace Content.Client.Command
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = _localizationManager.GetString("Communications Console"); Title = Loc.GetString("Communications Console");
Owner = owner; Owner = owner;
_countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)}; _countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)};
@@ -53,11 +51,11 @@ namespace Content.Client.Command
if (!Owner.CountdownStarted) if (!Owner.CountdownStarted)
{ {
_countdownLabel.SetMessage(""); _countdownLabel.SetMessage("");
_emergencyShuttleButton.Text = _localizationManager.GetString("Call emergency shuttle"); _emergencyShuttleButton.Text = Loc.GetString("Call emergency shuttle");
return; return;
} }
_emergencyShuttleButton.Text = _localizationManager.GetString("Recall emergency shuttle"); _emergencyShuttleButton.Text = Loc.GetString("Recall emergency shuttle");
_countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s"); _countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
} }

View File

@@ -16,7 +16,6 @@ namespace Content.Client
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IGameHud _gameHud = default!; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
private EscapeMenu _escapeMenu; private EscapeMenu _escapeMenu;
@@ -32,7 +31,7 @@ namespace Content.Client
if (obj.NewState is GameScreenBase) if (obj.NewState is GameScreenBase)
{ {
// Switched TO GameScreen. // Switched TO GameScreen.
_escapeMenu = new EscapeMenu(_clientConsole, _localizationManager); _escapeMenu = new EscapeMenu(_clientConsole);
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false; _escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;

View File

@@ -10,7 +10,6 @@ namespace Content.Client.GameObjects.Components.Access
{ {
public class IdCardConsoleBoundUserInterface : BoundUserInterface public class IdCardConsoleBoundUserInterface : BoundUserInterface
{ {
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
@@ -23,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Access
{ {
base.Open(); base.Open();
_window = new IdCardConsoleWindow(this, _localizationManager, _prototypeManager); _window = new IdCardConsoleWindow(this, _prototypeManager);
_window.Title = Owner.Owner.Name; _window.Title = Owner.Owner.Name;
_window.OnClose += Close; _window.OnClose += Close;
_window.OpenCentered(); _window.OpenCentered();

View File

@@ -29,8 +29,6 @@ namespace Content.Client.GameObjects.Components.Access
private readonly IdCardConsoleBoundUserInterface _owner; private readonly IdCardConsoleBoundUserInterface _owner;
private readonly ILocalizationManager _loc;
private readonly Dictionary<string, Button> _accessButtons = new Dictionary<string, Button>(); private readonly Dictionary<string, Button> _accessButtons = new Dictionary<string, Button>();
private string _lastFullName; private string _lastFullName;
@@ -38,9 +36,8 @@ namespace Content.Client.GameObjects.Components.Access
protected override Vector2? CustomSize => (650, 270); protected override Vector2? CustomSize => (650, 270);
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, ILocalizationManager loc, IPrototypeManager prototypeManager) public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
{ {
_loc = loc;
_owner = owner; _owner = owner;
var vBox = new VBoxContainer(); var vBox = new VBoxContainer();
@@ -49,11 +46,11 @@ namespace Content.Client.GameObjects.Components.Access
Columns = 3, Columns = 3,
Children = Children =
{ {
new Label {Text = loc.GetString("Privileged ID:")}, new Label {Text = Loc.GetString("Privileged ID:")},
(_privilegedIdButton = new Button()), (_privilegedIdButton = new Button()),
(_privilegedIdLabel = new Label()), (_privilegedIdLabel = new Label()),
new Label {Text = loc.GetString("Target ID:")}, new Label {Text = Loc.GetString("Target ID:")},
(_targetIdButton = new Button()), (_targetIdButton = new Button()),
(_targetIdLabel = new Label()) (_targetIdLabel = new Label())
} }
@@ -75,7 +72,7 @@ namespace Content.Client.GameObjects.Components.Access
// Name // Name
(_fullNameLabel = new Label (_fullNameLabel = new Label
{ {
Text = loc.GetString("Full name:") Text = Loc.GetString("Full name:")
}), }),
(_fullNameLineEdit = new LineEdit (_fullNameLineEdit = new LineEdit
{ {
@@ -83,14 +80,14 @@ namespace Content.Client.GameObjects.Components.Access
}), }),
(_fullNameSaveButton = new Button (_fullNameSaveButton = new Button
{ {
Text = loc.GetString("Save"), Text = Loc.GetString("Save"),
Disabled = true Disabled = true
}), }),
// Title // Title
(_jobTitleLabel = new Label (_jobTitleLabel = new Label
{ {
Text = loc.GetString("Job title:") Text = Loc.GetString("Job title:")
}), }),
(_jobTitleLineEdit = new LineEdit (_jobTitleLineEdit = new LineEdit
{ {
@@ -98,7 +95,7 @@ namespace Content.Client.GameObjects.Components.Access
}), }),
(_jobTitleSaveButton = new Button (_jobTitleSaveButton = new Button
{ {
Text = loc.GetString("Save"), Text = Loc.GetString("Save"),
Disabled = true Disabled = true
}), }),
}, },
@@ -148,14 +145,14 @@ namespace Content.Client.GameObjects.Components.Access
public void UpdateState(IdCardConsoleBoundUserInterfaceState state) public void UpdateState(IdCardConsoleBoundUserInterfaceState state)
{ {
_privilegedIdButton.Text = state.IsPrivilegedIdPresent _privilegedIdButton.Text = state.IsPrivilegedIdPresent
? _loc.GetString("Eject") ? Loc.GetString("Eject")
: _loc.GetString("Insert"); : Loc.GetString("Insert");
_privilegedIdLabel.Text = state.PrivilegedIdName; _privilegedIdLabel.Text = state.PrivilegedIdName;
_targetIdButton.Text = state.IsTargetIdPresent _targetIdButton.Text = state.IsTargetIdPresent
? _loc.GetString("Eject") ? Loc.GetString("Eject")
: _loc.GetString("Insert"); : Loc.GetString("Insert");
_targetIdLabel.Text = state.TargetIdName; _targetIdLabel.Text = state.TargetIdName;

View File

@@ -14,7 +14,6 @@ namespace Content.Client.GameObjects.Components.Actor
[RegisterComponent] [RegisterComponent]
public sealed class CharacterInfoComponent : Component, ICharacterUI public sealed class CharacterInfoComponent : Component, ICharacterUI
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
private CharacterInfoControl _control; private CharacterInfoControl _control;
@@ -28,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Actor
{ {
base.OnAdd(); base.OnAdd();
Scene = _control = new CharacterInfoControl(_resourceCache, _loc); Scene = _control = new CharacterInfoControl(_resourceCache);
} }
public override void Initialize() public override void Initialize()
@@ -42,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Actor
_control.NameLabel.Text = Owner.Name; _control.NameLabel.Text = Owner.Name;
// ReSharper disable once StringLiteralTypo // ReSharper disable once StringLiteralTypo
_control.SubText.Text = _loc.GetString("Professional Greyshirt"); _control.SubText.Text = Loc.GetString("Professional Greyshirt");
} }
private sealed class CharacterInfoControl : VBoxContainer private sealed class CharacterInfoControl : VBoxContainer
@@ -51,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Actor
public Label NameLabel { get; } public Label NameLabel { get; }
public Label SubText { get; } public Label SubText { get; }
public CharacterInfoControl(IResourceCache resourceCache, ILocalizationManager loc) public CharacterInfoControl(IResourceCache resourceCache)
{ {
AddChild(new HBoxContainer AddChild(new HBoxContainer
{ {
@@ -76,17 +75,17 @@ namespace Content.Client.GameObjects.Components.Actor
AddChild(new Placeholder(resourceCache) AddChild(new Placeholder(resourceCache)
{ {
PlaceholderText = loc.GetString("Health & status effects") PlaceholderText = Loc.GetString("Health & status effects")
}); });
AddChild(new Placeholder(resourceCache) AddChild(new Placeholder(resourceCache)
{ {
PlaceholderText = loc.GetString("Objectives") PlaceholderText = Loc.GetString("Objectives")
}); });
AddChild(new Placeholder(resourceCache) AddChild(new Placeholder(resourceCache)
{ {
PlaceholderText = loc.GetString("Antagonist Roles") PlaceholderText = Loc.GetString("Antagonist Roles")
}); });
} }
} }

View File

@@ -18,7 +18,6 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
[UsedImplicitly] [UsedImplicitly]
public class HumanInventoryInterfaceController : InventoryInterfaceController public class HumanInventoryInterfaceController : InventoryInterfaceController
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
@@ -40,7 +39,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
base.Initialize(); base.Initialize();
_window = new HumanInventoryWindow(_loc, _resourceCache); _window = new HumanInventoryWindow(_resourceCache);
_window.OnClose += () => GameHud.InventoryButtonDown = false; _window.OnClose += () => GameHud.InventoryButtonDown = false;
foreach (var (slot, button) in _window.Buttons) foreach (var (slot, button) in _window.Buttons)
{ {
@@ -192,9 +191,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
public IReadOnlyDictionary<Slots, ItemSlotButton> Buttons { get; } public IReadOnlyDictionary<Slots, ItemSlotButton> Buttons { get; }
public HumanInventoryWindow(ILocalizationManager loc, IResourceCache resourceCache) public HumanInventoryWindow(IResourceCache resourceCache)
{ {
Title = loc.GetString("Your Inventory"); Title = Loc.GetString("Your Inventory");
Resizable = false; Resizable = false;
var buttonDict = new Dictionary<Slots, ItemSlotButton>(); var buttonDict = new Dictionary<Slots, ItemSlotButton>();

View File

@@ -32,8 +32,6 @@ namespace Content.Client.Research
private ItemList _unlockableTechnologies; private ItemList _unlockableTechnologies;
private ItemList _futureTechnologies; private ItemList _futureTechnologies;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
public Button UnlockButton { get; private set; } public Button UnlockButton { get; private set; }
public Button ServerSelectionButton { get; private set; } public Button ServerSelectionButton { get; private set; }
public Button ServerSyncButton { get; private set; } public Button ServerSyncButton { get; private set; }
@@ -44,7 +42,7 @@ namespace Content.Client.Research
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = _localizationManager.GetString("R&D Console"); Title = Loc.GetString("R&D Console");
Owner = owner; Owner = owner;
@@ -110,8 +108,8 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 3, SizeFlagsStretchRatio = 3,
}; };
_pointLabel = new Label() { Text = _localizationManager.GetString("Research Points") + ": 0" }; _pointLabel = new Label() { Text = Loc.GetString("Research Points") + ": 0" };
_pointsPerSecondLabel = new Label() { Text = _localizationManager.GetString("Points per Second") + ": 0" }; _pointsPerSecondLabel = new Label() { Text = Loc.GetString("Points per Second") + ": 0" };
var vboxPointsButtons = new VBoxContainer() var vboxPointsButtons = new VBoxContainer()
{ {
@@ -120,9 +118,9 @@ namespace Content.Client.Research
SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand,
}; };
ServerSelectionButton = new Button() { Text = _localizationManager.GetString("Server list") }; ServerSelectionButton = new Button() { Text = Loc.GetString("Server list") };
ServerSyncButton = new Button() { Text = _localizationManager.GetString("Sync")}; ServerSyncButton = new Button() { Text = Loc.GetString("Sync")};
UnlockButton = new Button() { Text = _localizationManager.GetString("Unlock"), Disabled = true }; UnlockButton = new Button() { Text = Loc.GetString("Unlock"), Disabled = true };
vboxPointsButtons.AddChild(ServerSelectionButton); vboxPointsButtons.AddChild(ServerSelectionButton);
@@ -268,8 +266,8 @@ namespace Content.Client.Research
_technologyIcon.Texture = TechnologySelected.Icon.Frame0(); _technologyIcon.Texture = TechnologySelected.Icon.Frame0();
_technologyName.Text = TechnologySelected.Name; _technologyName.Text = TechnologySelected.Name;
_technologyDescription.Text = TechnologySelected.Description+$"\n{TechnologySelected.RequiredPoints} " + _localizationManager.GetString("research points"); _technologyDescription.Text = TechnologySelected.Description+$"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research points");
_technologyRequirements.Text = _localizationManager.GetString("No technology requirements."); _technologyRequirements.Text = Loc.GetString("No technology requirements.");
var prototypeMan = IoCManager.Resolve<IPrototypeManager>(); var prototypeMan = IoCManager.Resolve<IPrototypeManager>();
@@ -278,7 +276,7 @@ namespace Content.Client.Research
var requiredId = TechnologySelected.RequiredTechnologies[i]; var requiredId = TechnologySelected.RequiredTechnologies[i];
if (!prototypeMan.TryIndex(requiredId, out TechnologyPrototype prototype)) continue; if (!prototypeMan.TryIndex(requiredId, out TechnologyPrototype prototype)) continue;
if (i == 0) if (i == 0)
_technologyRequirements.Text = _localizationManager.GetString("Requires") + $": {prototype.Name}"; _technologyRequirements.Text = Loc.GetString("Requires") + $": {prototype.Name}";
else else
_technologyRequirements.Text += $", {prototype.Name}"; _technologyRequirements.Text += $", {prototype.Name}";
} }
@@ -289,8 +287,8 @@ namespace Content.Client.Research
/// </summary> /// </summary>
public void PopulatePoints() public void PopulatePoints()
{ {
_pointLabel.Text = _localizationManager.GetString("Research Points") + $": {Owner.Points}"; _pointLabel.Text = Loc.GetString("Research Points") + $": {Owner.Points}";
_pointsPerSecondLabel.Text = _localizationManager.GetString("Points per second") + $": {Owner.PointsPerSecond}"; _pointsPerSecondLabel.Text = Loc.GetString("Points per second") + $": {Owner.PointsPerSecond}";
} }
/// <summary> /// <summary>

View File

@@ -31,7 +31,7 @@ namespace Content.Client.Sandbox
public Button ShowMarkersButton; //Shows spawn points public Button ShowMarkersButton; //Shows spawn points
public Button ShowBbButton; //Shows bounding boxes public Button ShowBbButton; //Shows bounding boxes
public SandboxWindow(ILocalizationManager loc) public SandboxWindow()
{ {
Resizable = false; Resizable = false;
@@ -40,34 +40,34 @@ namespace Content.Client.Sandbox
var vBox = new VBoxContainer { SeparationOverride = 4 }; var vBox = new VBoxContainer { SeparationOverride = 4 };
Contents.AddChild(vBox); Contents.AddChild(vBox);
RespawnButton = new Button { Text = loc.GetString("Respawn") }; RespawnButton = new Button { Text = Loc.GetString("Respawn") };
vBox.AddChild(RespawnButton); vBox.AddChild(RespawnButton);
SpawnEntitiesButton = new Button { Text = loc.GetString("Spawn Entities") }; SpawnEntitiesButton = new Button { Text = Loc.GetString("Spawn Entities") };
vBox.AddChild(SpawnEntitiesButton); vBox.AddChild(SpawnEntitiesButton);
SpawnTilesButton = new Button { Text = loc.GetString("Spawn Tiles") }; SpawnTilesButton = new Button { Text = Loc.GetString("Spawn Tiles") };
vBox.AddChild(SpawnTilesButton); vBox.AddChild(SpawnTilesButton);
GiveFullAccessButton = new Button { Text = loc.GetString("Give AA Id") }; GiveFullAccessButton = new Button { Text = Loc.GetString("Give AA Id") };
vBox.AddChild(GiveFullAccessButton); vBox.AddChild(GiveFullAccessButton);
GiveAghostButton = new Button { Text = loc.GetString("Ghost") }; GiveAghostButton = new Button { Text = Loc.GetString("Ghost") };
vBox.AddChild(GiveAghostButton); vBox.AddChild(GiveAghostButton);
ToggleLightButton = new Button { Text = loc.GetString("Toggle Lights"), ToggleMode = true }; ToggleLightButton = new Button { Text = Loc.GetString("Toggle Lights"), ToggleMode = true };
vBox.AddChild(ToggleLightButton); vBox.AddChild(ToggleLightButton);
ToggleSubfloorButton = new Button { Text = loc.GetString("Toggle Subfloor"), ToggleMode = true }; ToggleSubfloorButton = new Button { Text = Loc.GetString("Toggle Subfloor"), ToggleMode = true };
vBox.AddChild(ToggleSubfloorButton); vBox.AddChild(ToggleSubfloorButton);
SuicideButton = new Button { Text = loc.GetString("Suicide") }; SuicideButton = new Button { Text = Loc.GetString("Suicide") };
vBox.AddChild(SuicideButton); vBox.AddChild(SuicideButton);
ShowMarkersButton = new Button { Text = loc.GetString("Show Spawns"), ToggleMode = true }; ShowMarkersButton = new Button { Text = Loc.GetString("Show Spawns"), ToggleMode = true };
vBox.AddChild(ShowMarkersButton); vBox.AddChild(ShowMarkersButton);
ShowBbButton = new Button { Text = loc.GetString("Show Bb"), ToggleMode = true }; ShowBbButton = new Button { Text = Loc.GetString("Show Bb"), ToggleMode = true };
vBox.AddChild(ShowBbButton); vBox.AddChild(ShowBbButton);
} }
} }
@@ -77,7 +77,7 @@ namespace Content.Client.Sandbox
[Dependency] private readonly IClientConsole _console = default!; [Dependency] private readonly IClientConsole _console = default!;
[Dependency] private readonly IGameHud _gameHud = default!; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IClientNetManager _netManager = default!; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly ILocalizationManager _localization = default!; [Dependency] private readonly ILocalizationManager _localization = default!;
[Dependency] private readonly IPlacementManager _placementManager = default!; [Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
@@ -163,7 +163,7 @@ namespace Content.Client.Sandbox
return; return;
} }
_window = new SandboxWindow(_localization); _window = new SandboxWindow();
_window.OnClose += WindowOnOnClose; _window.OnClose += WindowOnOnClose;

View File

@@ -31,7 +31,6 @@ namespace Content.Client.State
[Dependency] private readonly IClientNetManager _netManager = default!; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IGameController _controllerProxy = default!; [Dependency] private readonly IGameController _controllerProxy = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
@@ -105,10 +104,10 @@ namespace Content.Client.State
var inputName = _mainMenuControl.UserNameBox.Text.Trim(); var inputName = _mainMenuControl.UserNameBox.Text.Trim();
if (!UsernameHelpers.IsNameValid(inputName, out var reason)) if (!UsernameHelpers.IsNameValid(inputName, out var reason))
{ {
var invalidReason = _loc.GetString(reason.ToText()); var invalidReason = Loc.GetString(reason.ToText());
_userInterfaceManager.Popup( _userInterfaceManager.Popup(
_loc.GetString("Invalid username:\n{0}", invalidReason), Loc.GetString("Invalid username:\n{0}", invalidReason),
_loc.GetString("Invalid Username")); Loc.GetString("Invalid Username"));
return; return;
} }

View File

@@ -15,8 +15,6 @@ namespace Content.Client.UserInterface.Cargo
{ {
public class CargoConsoleMenu : SS14Window public class CargoConsoleMenu : SS14Window
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
protected override Vector2? CustomSize => (400, 600); protected override Vector2? CustomSize => (400, 600);
public CargoConsoleBoundUserInterface Owner { get; private set; } public CargoConsoleBoundUserInterface Owner { get; private set; }
@@ -48,15 +46,15 @@ namespace Content.Client.UserInterface.Cargo
Owner = owner; Owner = owner;
if (Owner.RequestOnly) if (Owner.RequestOnly)
Title = _loc.GetString("Cargo Request Console"); Title = Loc.GetString("Cargo Request Console");
else else
Title = _loc.GetString("Cargo Shuttle Console"); Title = Loc.GetString("Cargo Shuttle Console");
var rows = new VBoxContainer(); var rows = new VBoxContainer();
var accountName = new HBoxContainer(); var accountName = new HBoxContainer();
var accountNameLabel = new Label { var accountNameLabel = new Label {
Text = _loc.GetString("Account Name: "), Text = Loc.GetString("Account Name: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_accountNameLabel = new Label { _accountNameLabel = new Label {
@@ -69,7 +67,7 @@ namespace Content.Client.UserInterface.Cargo
var points = new HBoxContainer(); var points = new HBoxContainer();
var pointsLabel = new Label var pointsLabel = new Label
{ {
Text = _loc.GetString("Points: "), Text = Loc.GetString("Points: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_pointsLabel = new Label _pointsLabel = new Label
@@ -83,12 +81,12 @@ namespace Content.Client.UserInterface.Cargo
var shuttleStatus = new HBoxContainer(); var shuttleStatus = new HBoxContainer();
var shuttleStatusLabel = new Label var shuttleStatusLabel = new Label
{ {
Text = _loc.GetString("Shuttle Status: "), Text = Loc.GetString("Shuttle Status: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_shuttleStatusLabel = new Label _shuttleStatusLabel = new Label
{ {
Text = _loc.GetString("Away") // Shuttle.Status Text = Loc.GetString("Away") // Shuttle.Status
}; };
shuttleStatus.AddChild(shuttleStatusLabel); shuttleStatus.AddChild(shuttleStatusLabel);
shuttleStatus.AddChild(_shuttleStatusLabel); shuttleStatus.AddChild(_shuttleStatusLabel);
@@ -97,7 +95,7 @@ namespace Content.Client.UserInterface.Cargo
var shuttleCapacity = new HBoxContainer(); var shuttleCapacity = new HBoxContainer();
var shuttleCapacityLabel = new Label var shuttleCapacityLabel = new Label
{ {
Text = _loc.GetString("Order Capacity: "), Text = Loc.GetString("Order Capacity: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_shuttleCapacityLabel = new Label _shuttleCapacityLabel = new Label
@@ -111,13 +109,13 @@ namespace Content.Client.UserInterface.Cargo
var buttons = new HBoxContainer(); var buttons = new HBoxContainer();
CallShuttleButton = new Button() CallShuttleButton = new Button()
{ {
Text = _loc.GetString("Call Shuttle"), Text = Loc.GetString("Call Shuttle"),
TextAlign = Label.AlignMode.Center, TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.FillExpand SizeFlagsHorizontal = SizeFlags.FillExpand
}; };
PermissionsButton = new Button() PermissionsButton = new Button()
{ {
Text = _loc.GetString("Permissions"), Text = Loc.GetString("Permissions"),
TextAlign = Label.AlignMode.Center TextAlign = Label.AlignMode.Center
}; };
buttons.AddChild(CallShuttleButton); buttons.AddChild(CallShuttleButton);
@@ -127,13 +125,13 @@ namespace Content.Client.UserInterface.Cargo
var category = new HBoxContainer(); var category = new HBoxContainer();
_categories = new OptionButton _categories = new OptionButton
{ {
Prefix = _loc.GetString("Categories: "), Prefix = Loc.GetString("Categories: "),
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1 SizeFlagsStretchRatio = 1
}; };
_searchBar = new LineEdit _searchBar = new LineEdit
{ {
PlaceHolder = _loc.GetString("Search"), PlaceHolder = Loc.GetString("Search"),
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1 SizeFlagsStretchRatio = 1
}; };
@@ -166,14 +164,14 @@ namespace Content.Client.UserInterface.Cargo
SizeFlagsVertical = SizeFlags.FillExpand SizeFlagsVertical = SizeFlags.FillExpand
}; };
var rAndOVBox = new VBoxContainer(); var rAndOVBox = new VBoxContainer();
var requestsLabel = new Label { Text = _loc.GetString("Requests") }; var requestsLabel = new Label { Text = Loc.GetString("Requests") };
_requests = new VBoxContainer // replace with scroll box so that approval buttons can be added _requests = new VBoxContainer // replace with scroll box so that approval buttons can be added
{ {
StyleClasses = { "transparentItemList" }, StyleClasses = { "transparentItemList" },
SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1, SizeFlagsStretchRatio = 1,
}; };
var ordersLabel = new Label { Text = _loc.GetString("Orders") }; var ordersLabel = new Label { Text = Loc.GetString("Orders") };
_orders = new VBoxContainer _orders = new VBoxContainer
{ {
StyleClasses = { "transparentItemList" }, StyleClasses = { "transparentItemList" },
@@ -262,14 +260,14 @@ namespace Content.Client.UserInterface.Cargo
_categoryStrings.Clear(); _categoryStrings.Clear();
_categories.Clear(); _categories.Clear();
_categoryStrings.Add(_loc.GetString("All")); _categoryStrings.Add(Loc.GetString("All"));
var search = _searchBar.Text.Trim().ToLowerInvariant(); var search = _searchBar.Text.Trim().ToLowerInvariant();
foreach (var prototype in Owner.Market.Products) foreach (var prototype in Owner.Market.Products)
{ {
if (!_categoryStrings.Contains(prototype.Category)) if (!_categoryStrings.Contains(prototype.Category))
{ {
_categoryStrings.Add(_loc.GetString(prototype.Category)); _categoryStrings.Add(Loc.GetString(prototype.Category));
} }
} }
_categoryStrings.Sort(); _categoryStrings.Sort();

View File

@@ -8,8 +8,6 @@ namespace Content.Client.UserInterface.Cargo
{ {
class CargoConsoleOrderMenu : SS14Window class CargoConsoleOrderMenu : SS14Window
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
public LineEdit Requester { get; set; } public LineEdit Requester { get; set; }
public LineEdit Reason { get; set; } public LineEdit Reason { get; set; }
public SpinBox Amount { get; set; } public SpinBox Amount { get; set; }
@@ -19,22 +17,22 @@ namespace Content.Client.UserInterface.Cargo
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = _loc.GetString("Order Form"); Title = Loc.GetString("Order Form");
var vBox = new VBoxContainer(); var vBox = new VBoxContainer();
var gridContainer = new GridContainer { Columns = 2 }; var gridContainer = new GridContainer { Columns = 2 };
var requesterLabel = new Label { Text = _loc.GetString("Name:") }; var requesterLabel = new Label { Text = Loc.GetString("Name:") };
Requester = new LineEdit(); Requester = new LineEdit();
gridContainer.AddChild(requesterLabel); gridContainer.AddChild(requesterLabel);
gridContainer.AddChild(Requester); gridContainer.AddChild(Requester);
var reasonLabel = new Label { Text = _loc.GetString("Reason:") }; var reasonLabel = new Label { Text = Loc.GetString("Reason:") };
Reason = new LineEdit(); Reason = new LineEdit();
gridContainer.AddChild(reasonLabel); gridContainer.AddChild(reasonLabel);
gridContainer.AddChild(Reason); gridContainer.AddChild(Reason);
var amountLabel = new Label { Text = _loc.GetString("Amount:") }; var amountLabel = new Label { Text = Loc.GetString("Amount:") };
Amount = new SpinBox Amount = new SpinBox
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
@@ -51,7 +49,7 @@ namespace Content.Client.UserInterface.Cargo
SubmitButton = new Button() SubmitButton = new Button()
{ {
Text = _loc.GetString("OK"), Text = Loc.GetString("OK"),
TextAlign = Label.AlignMode.Center, TextAlign = Label.AlignMode.Center,
}; };
vBox.AddChild(SubmitButton); vBox.AddChild(SubmitButton);

View File

@@ -10,8 +10,6 @@ namespace Content.Client.UserInterface.Cargo
{ {
public class GalacticBankSelectionMenu : SS14Window public class GalacticBankSelectionMenu : SS14Window
{ {
[Dependency] private readonly ILocalizationManager _loc = default!;
private ItemList _accounts; private ItemList _accounts;
private int _accountCount = 0; private int _accountCount = 0;
private string[] _accountNames = new string[] { }; private string[] _accountNames = new string[] { };
@@ -26,7 +24,7 @@ namespace Content.Client.UserInterface.Cargo
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = _loc.GetString("Galactic Bank Selection"); Title = Loc.GetString("Galactic Bank Selection");
_accounts = new ItemList() { SelectMode = ItemList.ItemListSelectMode.Single }; _accounts = new ItemList() { SelectMode = ItemList.ItemListSelectMode.Single };

View File

@@ -9,16 +9,14 @@ namespace Content.Client.UserInterface
internal sealed class EscapeMenu : SS14Window internal sealed class EscapeMenu : SS14Window
{ {
private readonly IClientConsole _console; private readonly IClientConsole _console;
private readonly ILocalizationManager _localizationManager;
private BaseButton DisconnectButton; private BaseButton DisconnectButton;
private BaseButton QuitButton; private BaseButton QuitButton;
private BaseButton OptionsButton; private BaseButton OptionsButton;
private OptionsMenu optionsMenu; private OptionsMenu optionsMenu;
public EscapeMenu(IClientConsole console, ILocalizationManager localizationManager) public EscapeMenu(IClientConsole console)
{ {
_localizationManager = localizationManager;
_console = console; _console = console;
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
@@ -37,15 +35,15 @@ namespace Content.Client.UserInterface
var vBox = new VBoxContainer {SeparationOverride = 4}; var vBox = new VBoxContainer {SeparationOverride = 4};
Contents.AddChild(vBox); Contents.AddChild(vBox);
OptionsButton = new Button {Text = _localizationManager.GetString("Options")}; OptionsButton = new Button {Text = Loc.GetString("Options")};
OptionsButton.OnPressed += OnOptionsButtonClicked; OptionsButton.OnPressed += OnOptionsButtonClicked;
vBox.AddChild(OptionsButton); vBox.AddChild(OptionsButton);
DisconnectButton = new Button {Text = _localizationManager.GetString("Disconnect")}; DisconnectButton = new Button {Text = Loc.GetString("Disconnect")};
DisconnectButton.OnPressed += OnDisconnectButtonClicked; DisconnectButton.OnPressed += OnDisconnectButtonClicked;
vBox.AddChild(DisconnectButton); vBox.AddChild(DisconnectButton);
QuitButton = new Button {Text = _localizationManager.GetString("Quit Game")}; QuitButton = new Button {Text = Loc.GetString("Quit Game")};
QuitButton.OnPressed += OnQuitButtonClicked; QuitButton.OnPressed += OnQuitButtonClicked;
vBox.AddChild(QuitButton); vBox.AddChild(QuitButton);
} }

View File

@@ -76,7 +76,6 @@ namespace Content.Client.UserInterface
private VBoxContainer _combatPanelContainer; private VBoxContainer _combatPanelContainer;
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IInputManager _inputManager = default!;
public Control HandsContainer { get; private set; } public Control HandsContainer { get; private set; }
@@ -130,7 +129,7 @@ namespace Content.Client.UserInterface
// Escape // Escape
_buttonEscapeMenu = new TopButton(escapeTexture, "Esc") _buttonEscapeMenu = new TopButton(escapeTexture, "Esc")
{ {
ToolTip = _loc.GetString("Open escape menu.") ToolTip = Loc.GetString("Open escape menu.")
}; };
_topButtonsContainer.AddChild(_buttonEscapeMenu); _topButtonsContainer.AddChild(_buttonEscapeMenu);
@@ -140,7 +139,7 @@ namespace Content.Client.UserInterface
// Tutorial // Tutorial
_buttonTutorial = new TopButton(tutorialTexture, "F1") _buttonTutorial = new TopButton(tutorialTexture, "F1")
{ {
ToolTip = _loc.GetString("Open tutorial.") ToolTip = Loc.GetString("Open tutorial.")
}; };
_topButtonsContainer.AddChild(_buttonTutorial); _topButtonsContainer.AddChild(_buttonTutorial);
@@ -150,7 +149,7 @@ namespace Content.Client.UserInterface
// Character // Character
_buttonCharacterMenu = new TopButton(characterTexture, "C") _buttonCharacterMenu = new TopButton(characterTexture, "C")
{ {
ToolTip = _loc.GetString("Open character menu."), ToolTip = Loc.GetString("Open character menu."),
Visible = false Visible = false
}; };
@@ -161,7 +160,7 @@ namespace Content.Client.UserInterface
// Inventory // Inventory
_buttonInventoryMenu = new TopButton(inventoryTexture, "I") _buttonInventoryMenu = new TopButton(inventoryTexture, "I")
{ {
ToolTip = _loc.GetString("Open inventory menu."), ToolTip = Loc.GetString("Open inventory menu."),
Visible = false Visible = false
}; };
@@ -172,7 +171,7 @@ namespace Content.Client.UserInterface
// Crafting // Crafting
_buttonCraftingMenu = new TopButton(craftingTexture, "G") _buttonCraftingMenu = new TopButton(craftingTexture, "G")
{ {
ToolTip = _loc.GetString("Open crafting menu."), ToolTip = Loc.GetString("Open crafting menu."),
Visible = false Visible = false
}; };
@@ -183,7 +182,7 @@ namespace Content.Client.UserInterface
// Sandbox // Sandbox
_buttonSandboxMenu = new TopButton(sandboxTexture, "B") _buttonSandboxMenu = new TopButton(sandboxTexture, "B")
{ {
ToolTip = _loc.GetString("Open sandbox menu."), ToolTip = Loc.GetString("Open sandbox menu."),
Visible = false Visible = false
}; };
@@ -220,7 +219,7 @@ namespace Content.Client.UserInterface
{ {
(_combatModeButton = new Button (_combatModeButton = new Button
{ {
Text = _loc.GetString("Combat Mode"), Text = Loc.GetString("Combat Mode"),
ToggleMode = true ToggleMode = true
}), }),
(_targetingDoll = new TargetingDoll(_resourceCache)) (_targetingDoll = new TargetingDoll(_resourceCache))

View File

@@ -16,22 +16,19 @@ namespace Content.Server.Administration
{ {
get get
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>(); return Loc.GetString("Deletes entities with the specified components.");
return localizationManager.GetString("Deletes entities with the specified components.");
} }
} }
public string Help public string Help
{ {
get get
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>(); return Loc.GetString("Usage: deleteewc <componentName_1> <componentName_2> ... <componentName_n>\nDeletes any entities with the components specified.");
return localizationManager.GetString("Usage: deleteewc <componentName_1> <componentName_2> ... <componentName_n>\nDeletes any entities with the components specified.");
} }
} }
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args) public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
if (args.Length < 1) if (args.Length < 1)
{ {
shell.SendText(player, Help); shell.SendText(player, Help);
@@ -55,7 +52,7 @@ namespace Content.Server.Administration
count += 1; count += 1;
} }
shell.SendText(player, localizationManager.GetString("Deleted {0} entities", count)); shell.SendText(player, Loc.GetString("Deleted {0} entities", count));
} }
} }
} }

View File

@@ -15,28 +15,25 @@ namespace Content.Server.Administration
{ {
get get
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>(); return Loc.GetString("Fully heals a mob.");
return localizationManager.GetString("Fully heals a mob.");
} }
} }
public string Help public string Help
{ {
get get
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>(); return Loc.GetString("Usage: rejuvenate <mobUid_1> <mobUid_2> ... <mobUid_n>\nAttempts to heal the user's mob if no arguments are provided.");
return localizationManager.GetString("Usage: rejuvenate <mobUid_1> <mobUid_2> ... <mobUid_n>\nAttempts to heal the user's mob if no arguments are provided.");
} }
} }
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args) public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{ {
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
if (args.Length < 1 && player != null) //Try to heal the users mob if applicable if (args.Length < 1 && player != null) //Try to heal the users mob if applicable
{ {
shell.SendText(player, localizationManager.GetString("Healing the user's mob since no arguments were provided.")); shell.SendText(player, Loc.GetString("Healing the user's mob since no arguments were provided."));
if (player.AttachedEntity == null) if (player.AttachedEntity == null)
{ {
shell.SendText(player, localizationManager.GetString("There's no entity attached to the user.")); shell.SendText(player, Loc.GetString("There's no entity attached to the user."));
return; return;
} }
RejuvenateVerb.PerformRejuvenate(player.AttachedEntity); RejuvenateVerb.PerformRejuvenate(player.AttachedEntity);
@@ -47,7 +44,7 @@ namespace Content.Server.Administration
{ {
if(!EntityUid.TryParse(arg, out var uid) || !entityManager.TryGetEntity(uid, out var entity)) if(!EntityUid.TryParse(arg, out var uid) || !entityManager.TryGetEntity(uid, out var entity))
{ {
shell.SendText(player, localizationManager.GetString("Could not find entity {0}", arg)); shell.SendText(player, Loc.GetString("Could not find entity {0}", arg));
continue; continue;
} }
RejuvenateVerb.PerformRejuvenate(entity); RejuvenateVerb.PerformRejuvenate(entity);

View File

@@ -40,7 +40,6 @@ namespace Content.Server.Chat
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
[Dependency] private readonly IServerNetManager _netManager = default!; [Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly IMoMMILink _mommiLink = default!; [Dependency] private readonly IMoMMILink _mommiLink = default!;
[Dependency] private readonly IConGroupController _conGroupController = default!; [Dependency] private readonly IConGroupController _conGroupController = default!;
@@ -186,7 +185,7 @@ namespace Content.Server.Chat
var msg = _netManager.CreateNetMessage<MsgChatMessage>(); var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Dead; msg.Channel = ChatChannel.Dead;
msg.Message = message; msg.Message = message;
msg.MessageWrap = $"{_localizationManager.GetString("DEAD")}: {player.AttachedEntity.Name}: {{0}}"; msg.MessageWrap = $"{Loc.GetString("DEAD")}: {player.AttachedEntity.Name}: {{0}}";
msg.SenderEntity = player.AttachedEntityUid.GetValueOrDefault(); msg.SenderEntity = player.AttachedEntityUid.GetValueOrDefault();
_netManager.ServerSendToMany(msg, clients.ToList()); _netManager.ServerSendToMany(msg, clients.ToList());
} }
@@ -211,7 +210,7 @@ namespace Content.Server.Chat
msg.Channel = ChatChannel.AdminChat; msg.Channel = ChatChannel.AdminChat;
msg.Message = message; msg.Message = message;
msg.MessageWrap = $"{_localizationManager.GetString("ADMIN")}: {player.SessionId}: {{0}}"; msg.MessageWrap = $"{Loc.GetString("ADMIN")}: {player.SessionId}: {{0}}";
_netManager.ServerSendToMany(msg, clients.ToList()); _netManager.ServerSendToMany(msg, clients.ToList());
} }

View File

@@ -960,7 +960,7 @@ namespace Content.Server.GameTicking
{ {
var gmTitle = MakeGamePreset(null).ModeTitle; var gmTitle = MakeGamePreset(null).ModeTitle;
var desc = MakeGamePreset(null).Description; var desc = MakeGamePreset(null).Description;
return _localization.GetString(@"Hi and welcome to [color=white]Space Station 14![/color] return Loc.GetString(@"Hi and welcome to [color=white]Space Station 14![/color]
The current game mode is: [color=white]{0}[/color]. The current game mode is: [color=white]{0}[/color].
[color=yellow]{1}[/color]", gmTitle, desc); [color=yellow]{1}[/color]", gmTitle, desc);
@@ -989,7 +989,6 @@ The current game mode is: [color=white]{0}[/color].
[Dependency] private IServerNetManager _netManager = default!; [Dependency] private IServerNetManager _netManager = default!;
[Dependency] private IDynamicTypeFactory _dynamicTypeFactory = default!; [Dependency] private IDynamicTypeFactory _dynamicTypeFactory = default!;
[Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ILocalizationManager _localization = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!; [Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
[Dependency] private readonly IBaseServer _baseServer = default!; [Dependency] private readonly IBaseServer _baseServer = default!;