summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs')
-rw-r--r--Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs b/Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs
new file mode 100644
index 0000000..6171da0
--- /dev/null
+++ b/Thronefall_1_57/Thronefall/Thronefall/NightPreviewElement.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using System.Linq;
+using TMPro;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class NightPreviewElement : MonoBehaviour
+{
+ public TFUIEnemy enemyTFUIPrefab;
+
+ public TextMeshProUGUI number;
+
+ public List<TFUIEnemy> enemyTFUIs = new List<TFUIEnemy>();
+
+ public void SetData(WaveInfo info)
+ {
+ foreach (TFUIEnemy enemyTFUI in enemyTFUIs)
+ {
+ enemyTFUI.gameObject.SetActive(value: false);
+ }
+ int num = info.enemies.Count - enemyTFUIs.Count;
+ for (int i = 0; i < num; i++)
+ {
+ enemyTFUIs.Add(Object.Instantiate(enemyTFUIPrefab, base.transform));
+ }
+ info.enemies = info.enemies.OrderBy((WaveEnemyInfo o) => o.enemyCount).ToList();
+ for (int j = 0; j < info.enemies.Count; j++)
+ {
+ enemyTFUIs[j].gameObject.SetActive(value: true);
+ enemyTFUIs[j].SetDataSimple(info.enemies[j]);
+ }
+ number.text = info.waveNumber + ".";
+ Canvas.ForceUpdateCanvases();
+ GetComponent<HorizontalLayoutGroup>().SetLayoutHorizontal();
+ }
+
+ private void OnEnable()
+ {
+ Canvas.ForceUpdateCanvases();
+ GetComponent<HorizontalLayoutGroup>().SetLayoutHorizontal();
+ }
+}