wangguan
2020-10-22 74daf5509be4fc140fd1bdb6d4df5f1c1002e368
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;
        }
@@ -61,7 +74,9 @@
            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();
        }
    }
}