From 258f69466ceb71b8c65869568b5fb8b0c891d09c Mon Sep 17 00:00:00 2001 From: Rampastring Date: Sat, 28 Sep 2024 16:04:05 +0300 Subject: [PATCH] Add label telling which infantry's properties the user is editing --- .../UI/Windows/InfantryOptionsWindow.ini | 47 ++++++++++++------- .../UI/Windows/InfantryOptionsWindow.cs | 3 ++ 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/TSMapEditor/Config/UI/Windows/InfantryOptionsWindow.ini b/src/TSMapEditor/Config/UI/Windows/InfantryOptionsWindow.ini index e33b659a3..6152ec869 100644 --- a/src/TSMapEditor/Config/UI/Windows/InfantryOptionsWindow.ini +++ b/src/TSMapEditor/Config/UI/Windows/InfantryOptionsWindow.ini @@ -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 @@ -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 diff --git a/src/TSMapEditor/UI/Windows/InfantryOptionsWindow.cs b/src/TSMapEditor/UI/Windows/InfantryOptionsWindow.cs index f6d239819..0bd08eca0 100644 --- a/src/TSMapEditor/UI/Windows/InfantryOptionsWindow.cs +++ b/src/TSMapEditor/UI/Windows/InfantryOptionsWindow.cs @@ -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; @@ -37,6 +38,7 @@ public override void Initialize() Name = nameof(InfantryOptionsWindow); base.Initialize(); + lblSelectedInfantryValue = FindChild(nameof(lblSelectedInfantryValue)); trbStrength = FindChild(nameof(trbStrength)); lblStrengthValue = FindChild(nameof(lblStrengthValue)); ddMission = FindChild(nameof(ddMission)); @@ -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);