From: qrwas Date: Sat, 21 Jun 2025 22:20:34 +0000 (+0300) Subject: Fix styles for group button in loadout menu (#38488) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=0e58ed4f429da12a9a42c35ce6de893fcadec8f1;p=space-station-14.git Fix styles for group button in loadout menu (#38488) * Fix styles color for group button in loadout menu * Show selected item count in loadout group UI Updated the loadout group container to display the number of selected items in a group. Added a new localization string to support this feature in the UI. * Resolve required changes --- diff --git a/Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs b/Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs index 0e18bf1ab5..b06e7e41d1 100644 --- a/Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs +++ b/Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs @@ -144,8 +144,8 @@ public sealed partial class LoadoutGroupContainer : BoxContainer { subList.AddChild(proto); } - - UpdateToggleColor(toggle, subList); + var itemName = firstElement.Text ?? ""; + UpdateSubGroupSelectedInfo(firstElement, itemName, subList); } else { @@ -164,12 +164,14 @@ public sealed partial class LoadoutGroupContainer : BoxContainer }; toggle.Text = subContainer.Visible ? OpenedGroupMark : ClosedGroupMark; + toggle.Pressed = subContainer.Visible; toggle.OnPressed += _ => { var willOpen = !subContainer.Visible; subContainer.Visible = willOpen; toggle.Text = willOpen ? OpenedGroupMark : ClosedGroupMark; + toggle.Pressed = willOpen; _openedGroups[kvp.Key] = willOpen; }; @@ -178,15 +180,16 @@ public sealed partial class LoadoutGroupContainer : BoxContainer return toggle; } - private void UpdateToggleColor(Button toggle, BoxContainer subList) + private void UpdateSubGroupSelectedInfo(LoadoutContainer loadout, string itemName, BoxContainer subList) { - var anyActive = subList.Children + var countSubSelected = subList.Children .OfType() - .Any(c => c.Select.Pressed); + .Count(c => c.Select.Pressed); - toggle.Modulate = anyActive - ? Color.Green - : Color.White; + if (countSubSelected > 0) + { + loadout.Text = Loc.GetString("loadouts-count-items-in-group", ("item", itemName), ("count", countSubSelected)); + } } /// diff --git a/Resources/Locale/en-US/preferences/loadouts.ftl b/Resources/Locale/en-US/preferences/loadouts.ftl index f32c65eb24..2db7424fb1 100644 --- a/Resources/Locale/en-US/preferences/loadouts.ftl +++ b/Resources/Locale/en-US/preferences/loadouts.ftl @@ -9,4 +9,9 @@ loadouts-min-limit = Min count: {$count} loadouts-max-limit = Max count: {$count} loadouts-points-limit = Points: {$count} / {$max} +loadouts-count-items-in-group = {$item} and {$count} other {$count -> +[1] item +*[other] items +} + loadouts-points-restriction = Insufficient points