Skip to content

Commit 9e18ef8

Browse files
authored
Merge pull request #24 from hmlendea/units
New unit icons
2 parents 8df0dce + 4811d81 commit 9e18ef8

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed
1.75 MB
Loading
1.71 MB
Loading
1.73 MB
Loading
1.91 MB
Loading
1.72 MB
Loading

Gui/GuiElements/GuiRecruitmentPanel.cs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class GuiRecruitmentPanel : GuiPanel
2424

2525
GuiImage unitBackground;
2626
GuiImage unitImage;
27+
GuiImage unitImageFrame;
2728
GuiImage paper;
2829
GuiText unitText;
2930
GuiText troopsText;
@@ -77,18 +78,24 @@ protected override void DoLoadContent()
7778
ContentFile = "ScreenManager/FillImage",
7879
TextureLayout = TextureLayout.Tile,
7980
TintColour = Colour.Black,
80-
Size = new Size2D(100, 100),
81+
Size = new Size2D(100, 136),
8182
Location = new Point2D((Size.Width - 100) / 2, 64)
8283
};
8384
unitImage = new GuiImage
8485
{
8586
Id = $"{Id}_{nameof(unitImage)}",
8687
ContentFile = $"World/Assets/{world.AssetsPack}/units/{units[currentUnitIndex].Id}",
87-
SourceRectangle = new Rectangle2D(0, 0, 64, 64),
88-
Size = new Size2D(64, 64),
88+
Size = new Size2D(100, 100),
8989
Location = new Point2D(
90-
unitBackground.Location.X + (unitBackground.Size.Width - 64) / 2,
91-
unitBackground.Location.Y + (unitBackground.Size.Height - 64) / 2)
90+
unitBackground.Location.X + (unitBackground.Size.Width - 100) / 2,
91+
unitBackground.Location.Y + (unitBackground.Size.Height - 100) / 2)
92+
};
93+
unitImageFrame = new GuiImage
94+
{
95+
Id = $"{Id}_{nameof(unitImageFrame)}",
96+
ContentFile = "Interface/ProvincePanel/holding-frame",
97+
Size = unitImage.Size,
98+
Location = unitImage.Location
9299
};
93100
paper = new GuiImage
94101
{
@@ -104,9 +111,19 @@ protected override void DoLoadContent()
104111
{
105112
Id = $"{Id}_{nameof(unitText)}",
106113
ForegroundColour = Colour.Gold,
107-
Size = new Size2D(unitBackground.Size.Width, 18),
114+
Size = new Size2D(unitBackground.Size.Width, (unitBackground.Size.Height - unitImage.Size.Height) / 2),
108115
Location = unitBackground.Location
109116
};
117+
troopsText = new GuiText
118+
{
119+
Id = $"{Id}_{nameof(troopsText)}",
120+
HorizontalAlignment = Alignment.Middle,
121+
ForegroundColour = Colour.Gold,
122+
Size = new Size2D(unitBackground.Size.Width, (unitBackground.Size.Height - unitImage.Size.Height) / 2),
123+
Location = new Point2D(
124+
unitBackground.ClientRectangle.Left,
125+
unitBackground.ClientRectangle.Bottom - 18)
126+
};
110127

111128
healthIcon = new GuiImage
112129
{
@@ -185,15 +202,6 @@ protected override void DoLoadContent()
185202
maintenanceIcon.Size.Height),
186203
Location = maintenanceIcon.Location - new Point2D(maintenanceIcon.Size.Width * 2 + GameDefines.GuiSpacing, 0)
187204
};
188-
troopsText = new GuiText
189-
{
190-
Id = $"{Id}_{nameof(troopsText)}",
191-
ForegroundColour = Colour.Gold,
192-
Size = new Size2D(unitBackground.Size.Height, 18),
193-
Location = new Point2D(
194-
unitBackground.ClientRectangle.Left,
195-
unitBackground.ClientRectangle.Bottom - 18)
196-
};
197205

198206
previousUnitButton = new GuiButton
199207
{
@@ -243,7 +251,7 @@ protected override void DoLoadContent()
243251
Size.Height - 42 - GameDefines.GuiSpacing)
244252
};
245253

246-
RegisterChildren(unitBackground, unitImage, paper);
254+
RegisterChildren(unitBackground, unitImage, unitImageFrame, paper);
247255
RegisterChildren(unitText, troopsText);
248256
RegisterChildren(healthIcon, powerIcon, priceIcon, maintenanceIcon);
249257
RegisterChildren(healthText, powerText, priceText, maintenanceText);

0 commit comments

Comments
 (0)