Skip to content

Commit

Permalink
Add label telling which infantry's properties the user is editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Sep 28, 2024
1 parent 4ec20fc commit 258f694
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
47 changes: 30 additions & 17 deletions src/TSMapEditor/Config/UI/Windows/InfantryOptionsWindow.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
[InfantryOptionsWindow]
$Width=350
$CCHeader=lblHeader:XNALabel
$CC00=trbStrength:XNATrackbar
$CC01=lblStrength:XNALabel
$CC02=lblStrengthValue:XNALabel
$CC03=ddMission:XNADropDown
$CC04=lblMission:XNALabel
$CC05=ddVeterancy:XNADropDown
$CC06=lblVeterancy:XNALabel
$CC07=tbGroup:EditorNumberTextBox
$CC08=lblGroup:XNALabel
$CC09=chkOnBridge:XNACheckBox
$CC10=chkAutocreateNoRecruitable:XNACheckBox
$CC11=chkAutocreateYesRecruitable:XNACheckBox
$CC12=attachedTagSelector:EditorPopUpSelector
$CC13=lblAttachedTag:XNALabel
$CC14=btnOpenAttachedTrigger:EditorButton
$CC15=btnOK:EditorButton
$CC00=lblSelectedInfantry:XNALabel
$CC01=lblSelectedInfantryValue:XNALabel
$CC02=trbStrength:XNATrackbar
$CC03=lblStrength:XNALabel
$CC04=lblStrengthValue:XNALabel
$CC05=ddMission:XNADropDown
$CC06=lblMission:XNALabel
$CC07=ddVeterancy:XNADropDown
$CC08=lblVeterancy:XNALabel
$CC09=tbGroup:EditorNumberTextBox
$CC10=lblGroup:XNALabel
$CC11=chkOnBridge:XNACheckBox
$CC12=chkAutocreateNoRecruitable:XNACheckBox
$CC13=chkAutocreateYesRecruitable:XNACheckBox
$CC14=attachedTagSelector:EditorPopUpSelector
$CC15=lblAttachedTag:XNALabel
$CC16=btnOpenAttachedTrigger:EditorButton
$CC17=btnOK:EditorButton
$Height=getBottom(btnOK) + EMPTY_SPACE_BOTTOM
HasCloseButton=true

Expand All @@ -27,11 +29,22 @@ Text=Infantry Options
$X=horizontalCenterOnParent()
$Y=EMPTY_SPACE_TOP

[lblSelectedInfantry]
$X=EMPTY_SPACE_SIDES
$Y=getBottom(lblHeader) + EMPTY_SPACE_TOP
Text=Selected Infantry:

[lblSelectedInfantryValue]
$X=EMPTY_SPACE_SIDES
$Y=getBottom(lblSelectedInfantry) + VERTICAL_SPACING
FontIndex=1
Text=Dynamically filled

[trbStrength]
$X=getWidth(InfantryOptionsWindow) / 2
$Width=getWidth(InfantryOptionsWindow) - getX(trbStrength) - EMPTY_SPACE_SIDES - 20
$Height=BUTTON_HEIGHT
$Y=getBottom(lblHeader) + EMPTY_SPACE_TOP
$Y=getBottom(lblSelectedInfantryValue) + EMPTY_SPACE_TOP
$MaxValue=OBJECT_HEALTH_MAX
MinValue=1
BackgroundTexture=trackbarBackground.png
Expand Down
3 changes: 3 additions & 0 deletions src/TSMapEditor/UI/Windows/InfantryOptionsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public InfantryOptionsWindow(WindowManager windowManager, Map map) : base(window

private readonly Map map;

private XNALabel lblSelectedInfantryValue;
private XNATrackbar trbStrength;
private XNALabel lblStrengthValue;
private XNADropDown ddMission;
Expand All @@ -37,6 +38,7 @@ public override void Initialize()
Name = nameof(InfantryOptionsWindow);
base.Initialize();

lblSelectedInfantryValue = FindChild<XNALabel>(nameof(lblSelectedInfantryValue));
trbStrength = FindChild<XNATrackbar>(nameof(trbStrength));
lblStrengthValue = FindChild<XNALabel>(nameof(lblStrengthValue));
ddMission = FindChild<XNADropDown>(nameof(ddMission));
Expand Down Expand Up @@ -101,6 +103,7 @@ public void Open(Infantry infantry)

private void RefreshValues()
{
lblSelectedInfantryValue.Text = infantry.ObjectType.GetEditorDisplayName() + ", subcell: " + infantry.SubCell;
trbStrength.Value = infantry.HP;
ddMission.SelectedIndex = ddMission.Items.FindIndex(item => item.Text == infantry.Mission);
int veterancyIndex = ddVeterancy.Items.FindIndex(i => (int)i.Tag == infantry.Veterancy);
Expand Down

0 comments on commit 258f694

Please sign in to comment.