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

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

View File

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

View File

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

View File

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

View File

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