From cb37ba57145f6b3e99e32f8bac3b1c69c7c09800 Mon Sep 17 00:00:00 2001 From: ThereDrD0 <88589686+ThereDrD0@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:29:26 +0300 Subject: [PATCH] =?UTF-8?q?QoL=20=D0=B4=D0=BB=D1=8F=20=D0=A5=D0=BE=D0=9F?= =?UTF-8?q?=D0=B0=20(#369)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add: nice job icons ui for HoP console * Ebanniy rot * add: Changing id visuals with HoP console * cleanup * add: remove drop down list and replace it with icon-buttons * add: colored and sorted by department buttons * add: columns * tweak: nicer colors * cleanup --- .../Access/UI/AccessLevelControl.xaml.cs | 56 +++++++++ .../UI/IdCardConsoleBoundUserInterface.cs | 6 +- .../Access/UI/IdCardConsoleWindow.xaml | 9 +- .../Access/UI/IdCardConsoleWindow.xaml.cs | 118 ++++++++++-------- Content.Client/Stylesheets/StyleNano.cs | 97 ++++++++++++++ .../Access/Systems/IdCardConsoleSystem.cs | 7 +- Content.Server/Access/Systems/IdCardSystem.cs | 14 +++ .../Components/IdCardConsoleComponent.cs | 82 ++++-------- .../_White/NiceIdCards/IdCardsVisuals.cs | 9 ++ .../components/id-card-console-component.ftl | 1 - .../components/id-card-console-component.ftl | 1 - .../Objects/Misc/identification_cards.yml | 54 ++++++++ 12 files changed, 332 insertions(+), 122 deletions(-) create mode 100644 Content.Shared/_White/NiceIdCards/IdCardsVisuals.cs diff --git a/Content.Client/Access/UI/AccessLevelControl.xaml.cs b/Content.Client/Access/UI/AccessLevelControl.xaml.cs index 34db80b7af..3ce1c7d1f2 100644 --- a/Content.Client/Access/UI/AccessLevelControl.xaml.cs +++ b/Content.Client/Access/UI/AccessLevelControl.xaml.cs @@ -13,6 +13,7 @@ namespace Content.Client.Access.UI; public sealed partial class AccessLevelControl : GridContainer { public readonly Dictionary, Button> ButtonsList = new(); + public readonly List, Button>> ButtonGroups = new (); public AccessLevelControl() { @@ -39,6 +40,61 @@ public sealed partial class AccessLevelControl : GridContainer } } + public void PopulateForConsole(List>> accessLevels, IPrototypeManager prototypeManager) + { + var departmentColors = new List // Colors from StyleNano.cs + { + "ButtonColorCommandDepartment", + "ButtonColorSecurityDepartment", + "ButtonColorMedicalDepartment", + "ButtonColorEngineeringDepartment", + "ButtonColorResearchingDepartment", + "ButtonColorCargoDepartment", + "ButtonColorServiceDepartment" + }; + var currentColorIndex = 0; + + foreach (var department in accessLevels) + { + Dictionary, Button> buttons = new(); + foreach (var access in department) + { + if (!prototypeManager.TryIndex(access, out var accessLevel)) + { + Logger.Error($"Unable to find accesslevel for {access}"); + continue; + } + + var newButton = new Button + { + Text = accessLevel.GetAccessLevelName(), + ToggleMode = true, + }; + + newButton.AddStyleClass(departmentColors[currentColorIndex]); + buttons.Add(accessLevel.ID, newButton); + } + + ButtonGroups.Add(buttons); + currentColorIndex++; + } + } + + public void UpdateStateConsole( + List> pressedList, + List>? enabledList = null) + { + foreach (var department in ButtonGroups) + { + foreach (var (accessName, button) in department) + { + button.Pressed = pressedList.Contains(accessName); + button.Disabled = !(enabledList?.Contains(accessName) ?? true); + } + } + + } + public void UpdateState( List> pressedList, List>? enabledList = null) diff --git a/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs b/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs index 5bf31f631d..e5b194946f 100644 --- a/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs +++ b/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs @@ -23,15 +23,15 @@ namespace Content.Client.Access.UI protected override void Open() { base.Open(); - List> accessLevels; + List>> accessLevels; if (EntMan.TryGetComponent(Owner, out var idCard)) { - accessLevels = idCard.AccessLevels; + accessLevels = idCard.AccessLevelsConsole; } else { - accessLevels = new List>(); + accessLevels = new List>>(); _idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!"); } diff --git a/Content.Client/Access/UI/IdCardConsoleWindow.xaml b/Content.Client/Access/UI/IdCardConsoleWindow.xaml index 04dcd44806..32363256db 100644 --- a/Content.Client/Access/UI/IdCardConsoleWindow.xaml +++ b/Content.Client/Access/UI/IdCardConsoleWindow.xaml @@ -26,16 +26,13 @@