Move access levels to prototypes.
Also adds captain & ID computer access levels. Fixes ID computer not saving access changes correctly.
This commit is contained in:
@@ -3,6 +3,7 @@ using Robust.Client.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.GameObjects.Components.Access.SharedIdCardConsoleComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Access
|
||||
@@ -11,6 +12,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore 649
|
||||
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -22,7 +24,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _localizationManager);
|
||||
_window = new IdCardConsoleWindow(this, _localizationManager, _prototypeManager);
|
||||
_window.Title = Owner.Owner.Name;
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
|
||||
@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.GameObjects.Components.Access.SharedIdCardConsoleComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Access
|
||||
@@ -40,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
|
||||
protected override Vector2? CustomSize => (650, 270);
|
||||
|
||||
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, ILocalizationManager loc)
|
||||
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, ILocalizationManager loc, IPrototypeManager prototypeManager)
|
||||
{
|
||||
_loc = loc;
|
||||
_owner = owner;
|
||||
@@ -126,20 +127,21 @@ namespace Content.Client.GameObjects.Components.Access
|
||||
{
|
||||
var grid = new GridContainer
|
||||
{
|
||||
Columns = 4,
|
||||
Columns = 5,
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
|
||||
};
|
||||
vBox.AddChild(grid);
|
||||
|
||||
foreach (var accessName in SharedAccess.AllAccess)
|
||||
foreach (var accessLevel in prototypeManager.EnumeratePrototypes<AccessLevelPrototype>())
|
||||
{
|
||||
var newButton = new Button
|
||||
{
|
||||
Text = accessName,
|
||||
Text = accessLevel.Name,
|
||||
ToggleMode = true,
|
||||
};
|
||||
grid.AddChild(newButton);
|
||||
_accessButtons.Add(accessName, newButton);
|
||||
_accessButtons.Add(accessLevel.ID, newButton);
|
||||
newButton.OnPressed += _ => SubmitData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user