From 63133cf5403a9d7fbe3811d20c3d24f26a752449 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Thu, 22 Oct 2020 16:06:35 +0800
Subject: [PATCH] 无尽模式,添加法阵展示和结算界面滑动列表

---
 Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs b/Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs
index dbcfccf..419b220 100644
--- a/Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs
+++ b/Assets/Scripts/TowerDefense/UI/EndlessSettlement.cs
@@ -1,4 +1,5 @@
 using UnityEngine;
+using UnityEngine.UI;
 using TowerDefense.UI.HUD;
 using DG.Tweening;
 using TowerDefense.Towers.Placement;
@@ -28,10 +29,22 @@
         /// </summary>
         protected EndlessLevelManager levelManager;
 
-        // Start is called before the first frame update
-        private void Start()
+        /// <summary>
+        /// 最终波次文本
+        /// </summary>
+        public Text FinalWaveText;
+
+        /// <summary>
+        /// 道具列表UI
+        /// </summary>
+        public GameObject PropListUI;
+
+        public GameObject SettlementUI;
+
+        public void Init()
         {
             LazyLoad();
+            levelManager.LevelCompleted -= Victory;
             levelManager.LevelCompleted += Victory;
         }
 
@@ -60,8 +73,10 @@
 
             if (EndlessGameUI.instance.state == EndlessGameUI.State.Building)
                 EndlessGameUI.instance.CancelGhostPlacement();
-            
-            gameObject.SetActive(true);
+
+            RefreshFinalWave();
+            RefreshPropList();
+            SettlementUI.SetActive(true);
         }
 
         /// <summary>
@@ -102,5 +117,24 @@
             if (levelManager == null && EndlessLevelManager.instanceExists)
                 levelManager = EndlessLevelManager.instance;
         }
+
+        /// <summary>
+        /// 刷新最终波次信息
+        /// </summary>
+        /// <param name="level">关卡等级</param>
+        /// <param name="wave">波次</param>
+        private void RefreshFinalWave()
+        {
+            int level = EndlessLevelManager.instance.CurrentLevel;
+            int wave = EndlessLevelManager.instance.WaveManager.CurrentWaveIndex;
+
+            FinalWaveText.text = $"最终波次:第{level}关,第{wave}波";
+        }
+
+        private void RefreshPropList()
+        {
+            EndlessSettlementPropList list = PropListUI.GetComponent<EndlessSettlementPropList>();
+            list.RefreshList();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1