Change thief backpack ui name and description with Component fields (#41583)

* Add new name and description fields to the thiefbackpack component and ui

* Change fields to locids, remove Title from menu.xaml, add comments to  thiefbackpackui.cs
This commit is contained in:
imatsoup
2025-11-27 16:28:18 +00:00
committed by GitHub
parent a1e6c35c82
commit 62fbac7a13
5 changed files with 22 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'thief-backpack-window-title'}"
MinSize="700 700">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<!-- First Informational panel -->
@@ -25,7 +24,6 @@
</BoxContainer>
</ScrollContainer>
</PanelContainer>
<!-- Third approve button panel -->
<PanelContainer Margin="10">
<Button Name="ApproveButton"

View File

@@ -46,7 +46,8 @@ public sealed partial class ThiefBackpackMenu : FancyWindow
selectedNumber++;
}
Description.Text = Loc.GetString("thief-backpack-window-description", ("maxCount", state.MaxSelectedSets));
Title = Loc.GetString(state.ToolName);
Description.Text = Loc.GetString(state.ToolDesc, ("maxCount", state.MaxSelectedSets));
SelectedSets.Text = Loc.GetString("thief-backpack-window-selected", ("selectedCount", selectedNumber), ("maxCount", state.MaxSelectedSets));
ApproveButton.Disabled = selectedNumber != state.MaxSelectedSets;
}

View File

@@ -30,6 +30,18 @@ public sealed partial class ThiefUndeterminedBackpackComponent : Component
[DataField]
public int MaxSelectedSets = 2;
/// <summary>
/// Title field for undetermined equipment ui.
/// </summary>
[DataField]
public LocId ToolName = "thief-backpack-window-title";
/// <summary>
/// Description field for undetermined equipment ui.
/// </summary>
[DataField]
public LocId ToolDesc = "thief-backpack-window-description";
/// <summary>
/// What entity all the spawned items will appear inside of
/// If null, will instead drop on the ground.

View File

@@ -96,6 +96,6 @@ public sealed class ThiefUndeterminedBackpackSystem : EntitySystem
data.Add(i, info);
}
_ui.SetUiState(uid, ThiefBackpackUIKey.Key, new ThiefBackpackBoundUserInterfaceState(data, component.MaxSelectedSets));
_ui.SetUiState(uid, ThiefBackpackUIKey.Key, new ThiefBackpackBoundUserInterfaceState(data, component.MaxSelectedSets, component.ToolName, component.ToolDesc));
}
}

View File

@@ -8,11 +8,17 @@ public sealed class ThiefBackpackBoundUserInterfaceState : BoundUserInterfaceSta
{
public readonly Dictionary<int, ThiefBackpackSetInfo> Sets;
public int MaxSelectedSets;
// Name UI field set by ThiefUndeterminedBackpackComponent
public LocId ToolName;
// Description UI field set by ThiefUndeterminedBackpackComponent
public LocId ToolDesc;
public ThiefBackpackBoundUserInterfaceState(Dictionary<int, ThiefBackpackSetInfo> sets, int max)
public ThiefBackpackBoundUserInterfaceState(Dictionary<int, ThiefBackpackSetInfo> sets, int max, LocId toolName, LocId toolDesc)
{
Sets = sets;
MaxSelectedSets = max;
ToolName = toolName;
ToolDesc = toolDesc;
}
}