mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:35:42 +00:00
Resize moving army popup backing (#8408)
This commit is contained in:
+20
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user