Resize moving army popup backing (#8408)

This commit is contained in:
2026-07-10 10:44:13 -07:00
committed by GitHub
parent d1160855d4
commit ecd0d3605b
@@ -3,6 +3,7 @@ using System.Linq;
using common;
using Net.Eagle0.Eagle.Views;
using UnityEngine;
using UnityEngine.UI;
using FactionId = System.Int32;
using ProvinceId = System.Int32;
@@ -56,6 +57,7 @@ namespace eagle {
row.BattalionSize.gameObject.SetActive(false);
}
}
ResizeMovingArmyPopup(movingArmy.UnitDetails.Count);
movingArmyPopupPanel.SetActive(true);
}
@@ -65,9 +67,27 @@ namespace eagle {
row.SetSummaryText(MovingArmySummaryText(movingArmy));
row.BattalionImage.gameObject.SetActive(false);
row.BattalionSize.gameObject.SetActive(false);
ResizeMovingArmyPopup(1);
movingArmyPopupPanel.SetActive(true);
}
private void ResizeMovingArmyPopup(int rowCount) {
var rowHeight =
movingArmyPopupTable.rowPrefab.GetComponent<LayoutElement>().preferredHeight;
var contentLayout =
movingArmyPopupTable.contentViewTransform.GetComponent<LayoutGroup>();
var popupLayout = movingArmyPopupPanel.GetComponent<LayoutGroup>();
var contentHeight = rowCount * rowHeight + contentLayout.padding.vertical;
((RectTransform)movingArmyPopupTable.contentViewTransform)
.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contentHeight);
var popupHeight = contentHeight + popupLayout.padding.vertical;
movingArmyPopupPanel.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(
RectTransform.Axis.Vertical,
popupHeight);
}
private static string MovingArmySummaryText(IncomingArmyView movingArmy) {
if (movingArmy.HeroCount == 0 && movingArmy.TroopCount == 0) {
var supplies = new List<string>();