mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-14 23:14:45 +01:00
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:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user