diff options
author | chai <chaifix@163.com> | 2022-04-25 09:58:56 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-04-25 09:58:56 +0800 |
commit | 71ae3d755a03a706d93291ca57c6de8e6f0d5926 (patch) | |
tree | ea8e38b0fe6bd860fae5458b4a4ed12b3984920f /SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs | |
parent | 0eff98708ab049559d7891f1aa24e365000caae1 (diff) |
* rename equip to weapon
Diffstat (limited to 'SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs')
-rw-r--r-- | SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs b/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs new file mode 100644 index 0000000..f061a3b --- /dev/null +++ b/SurvivalTest/Assets/Scripts/UI/Panel/PanelWeaponBar/UIWeaponWidget.cs @@ -0,0 +1,39 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public struct UIWeaponWidgetParam +{ + public WeaponBase weapon; +} + +public class UIWeaponWidget : UIGridItemBase +{ + public Image Image_Icon; + public Image Image_CD; + + public WeaponBase weapon { get { return m_Weapon; } } + private WeaponBase m_Weapon; + + public override void Set(object param) + { + UIWeaponWidgetParam info = (UIWeaponWidgetParam)param; + m_Weapon = info.weapon; + + Image_Icon.sprite = ResourceManager.Instance.Load<Sprite>(info.weapon.iconPath); + + Image_CD.gameObject.SetActive(weapon.autoMode == WeaponBase.AutoMode.Interval); + } + + private void Update() + { + if(weapon.autoMode == WeaponBase.AutoMode.Interval) + { + float countDown = TinyCountDown.Instance.Get(weapon.GetHashCode().ToString()); + float t = countDown / weapon.interval; + Image_CD.fillAmount = t; + } + } + +}
\ No newline at end of file |