From 43b531f76be6e12c775a1135f6895e8fdc389a59 Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Tue, 27 Oct 2020 17:39:23 +0800 Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle into master --- Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs b/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs index f8a25c7..5b4f9cb 100644 --- a/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs +++ b/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs @@ -24,14 +24,38 @@ } /// <summary> + /// 获取进度条进度. + /// </summary> + /// <returns></returns> + public int GetCtlProgress() + { + return currentProgress; + } + + /// <summary> + /// 设置进度. + /// </summary> + /// <param name="pro"></param> + public void SetCtlProcess(int pro) + { + if (pro == 10) + pro = 0; + energyScaleMask.rectTransform.DOKill(); + this.SetEnergyProgress(pro,false); + } + + /// <summary> /// 显示并更新能量条进度. /// </summary> /// <param name="pro"></param> - public void SetEnergyProgress(int pro) + public void SetEnergyProgress(int pro,bool ani = true) { if (pro == currentProgress) return; - energyScaleMask.rectTransform.DOScaleY( pro / 10.0f, 0.3f ); + if( ani ) + energyScaleMask.rectTransform.DOScaleY( pro / 10.0f, 0.3f ); + else + energyScaleMask.rectTransform.DOScaleY(pro / 10.0f, 0.0f); currentProgress = pro; } -- Gitblit v1.9.1