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

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

View File

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

View File

@@ -14,7 +14,6 @@ namespace Content.Client.GameObjects.Components.Actor
[RegisterComponent]
public sealed class CharacterInfoComponent : Component, ICharacterUI
{
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
private CharacterInfoControl _control;
@@ -28,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Actor
{
base.OnAdd();
Scene = _control = new CharacterInfoControl(_resourceCache, _loc);
Scene = _control = new CharacterInfoControl(_resourceCache);
}
public override void Initialize()
@@ -42,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Actor
_control.NameLabel.Text = Owner.Name;
// ReSharper disable once StringLiteralTypo
_control.SubText.Text = _loc.GetString("Professional Greyshirt");
_control.SubText.Text = Loc.GetString("Professional Greyshirt");
}
private sealed class CharacterInfoControl : VBoxContainer
@@ -51,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Actor
public Label NameLabel { get; }
public Label SubText { get; }
public CharacterInfoControl(IResourceCache resourceCache, ILocalizationManager loc)
public CharacterInfoControl(IResourceCache resourceCache)
{
AddChild(new HBoxContainer
{
@@ -76,17 +75,17 @@ namespace Content.Client.GameObjects.Components.Actor
AddChild(new Placeholder(resourceCache)
{
PlaceholderText = loc.GetString("Health & status effects")
PlaceholderText = Loc.GetString("Health & status effects")
});
AddChild(new Placeholder(resourceCache)
{
PlaceholderText = loc.GetString("Objectives")
PlaceholderText = Loc.GetString("Objectives")
});
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]
public class HumanInventoryInterfaceController : InventoryInterfaceController
{
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
@@ -40,7 +39,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{
base.Initialize();
_window = new HumanInventoryWindow(_loc, _resourceCache);
_window = new HumanInventoryWindow(_resourceCache);
_window.OnClose += () => GameHud.InventoryButtonDown = false;
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 HumanInventoryWindow(ILocalizationManager loc, IResourceCache resourceCache)
public HumanInventoryWindow(IResourceCache resourceCache)
{
Title = loc.GetString("Your Inventory");
Title = Loc.GetString("Your Inventory");
Resizable = false;
var buttonDict = new Dictionary<Slots, ItemSlotButton>();