Skip to content

Commit

Permalink
Latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Apr 4, 2024
1 parent d084d9c commit 058652c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Content.Client/Preferences/UI/LoadoutGroupContainer.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Vertical">
<!-- Buffer space so we have 10 margin between controls but also 10 to the borders -->
<Label Text="{Loc 'loadout-restrictions'}" Margin="5 0 5 5"/>
<BoxContainer Name="RestrictionsContainer" Orientation="Vertical" HorizontalExpand="True" />
<PanelContainer StyleClasses="AngleRect" HorizontalExpand="True">
<BoxContainer Name="LoadoutsContainer" Orientation="Vertical"/>
</PanelContainer>
Expand Down
20 changes: 20 additions & 0 deletions Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ public LoadoutGroupContainer(RoleLoadout loadout, LoadoutGroupPrototype groupPro
/// </summary>
public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDependencyCollection collection)
{
RestrictionsContainer.DisposeAllChildren();

if (_groupProto.MinLimit > 0)
{
RestrictionsContainer.AddChild(new Label()
{
Text = Loc.GetString("loadouts-min-limit", ("count", _groupProto.MinLimit)),
Margin = new Thickness(5, 0, 5, 5),
});
}

if (_groupProto.MaxLimit > 0)
{
RestrictionsContainer.AddChild(new Label()
{
Text = Loc.GetString("loadouts-max-limit", ("count", _groupProto.MaxLimit)),
Margin = new Thickness(5, 0, 5, 5),
});
}

LoadoutsContainer.DisposeAllChildren();
// Didn't use options because this is more robust in future.
var protoMan = collection.Resolve<IPrototypeManager>();
Expand Down
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/preferences/loadouts.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Restrictions
loadout-restrictions = Restrictions
loadouts-min-limit = Min count: {$count}
loadouts-max-limit = Max count: {$count}

0 comments on commit 058652c

Please sign in to comment.