using Common.Utility.CombatEvent; using Fort23.Core; using GameLogic.Combat.Hero.Turntable; using GameLogic.Combat.Skill; using GameLogic.Player; using UnityEngine; namespace Fort23.Mono { [UIBinding(prefab = "gf_widget")] public partial class gf_widget : UIComponent { public SkillSlots SkillSlots; public SkillBasic SkillBasic; public float jd; public int useCount; public WuXingType HuangDaoWuXingType; public CombatHeroEntity combatHeroEntity; private void Init() { } public override void AddEvent() { CombatEventManager.Instance.AddEventListener(CombatEventType.SkillSlotsAlter, SkillSlotsAlter); CombatEventManager.Instance.AddEventListener(CombatEventType.HuangDaoAlterSlots, HuangDaoAlterSlots); } public override void DelEvent() { CombatEventManager.Instance.RemoveEventListener(CombatEventType.SkillSlotsAlter, SkillSlotsAlter); CombatEventManager.Instance.RemoveEventListener(CombatEventType.HuangDaoAlterSlots, HuangDaoAlterSlots); } private void HuangDaoAlterSlots(IEventData iEventData) { HuangDaoAlterSlotsEventData huangDaoAlterSlotsEventData = iEventData as HuangDaoAlterSlotsEventData; if (huangDaoAlterSlotsEventData.CombatHeroEntity != combatHeroEntity||SkillSlots==null) { return; } if (huangDaoAlterSlotsEventData.index != SkillSlots.index) { return; } HuangDaoWuXingType= huangDaoAlterSlotsEventData.WuXingType; switch ((int)HuangDaoWuXingType) { case 1: quan.color = new Color(1f, 0.98f, 0.09f); break; case 2: quan.color = new Color(0.19f, 0.51f, 1f); break; case 4: quan.color = new Color(0.17f, 1f, 0.35f); break; case 8: quan.color = new Color(1f, 0.19f, 0.04f); break; case 16: quan.color = new Color(1f, 0.65f, 0.17f); break; } } public void SkillSlotsAlter(IEventData eventData) { SkillSlotsAlterEventData skillSlotsAlterEventData = (SkillSlotsAlterEventData)eventData; if (skillSlotsAlterEventData.SkillSlots == SkillSlots) { SkillBasic = SkillSlots.SkillBasic; if (SkillBasic != null && HuangDaoWuXingType != WuXingType.Null)//有黄道,播放黄道家成表现 { if (PlayerGf_widget != null) { PlayerGf_widget.Play("huangdao",false); } } SetUIInfo(); } } public override void AddButtonEvent() { } private void SetUIInfo() { if (SkillBasic == null) { useSkillIcon.transform.parent.gameObject.SetActive(false); quan.color = new Color(1, 1, 1, 0.2f); // if (PlayerGf_widget != null) // { // PlayerGf_widget.Play("likai",false); // } return; } if (PlayerGf_widget != null) { PlayerGf_widget.Play("enter",false); } useSkillIcon.transform.parent.gameObject.SetActive(true); useSkillIcon.icon_name = SkillBasic.SelfSkillConfig.icon; cd.fillAmount = 0; if (SkillBasic.SelfSkillConfig.SkillType == 2) { quan.color = new Color(0.81f, 0.21f, 1f); return; } // useCount= SkillBasic.UseCount; switch (SkillBasic.SelfSkillConfig.attribute) { case 1: quan.color = new Color(1f, 0.98f, 0.09f); break; case 2: quan.color = new Color(0.19f, 0.51f, 1f); break; case 4: quan.color = new Color(0.17f, 1f, 0.35f); break; case 8: quan.color = new Color(1f, 0.19f, 0.04f); break; case 16: quan.color = new Color(1f, 0.65f, 0.17f); break; } } public void Update() { if (SkillSlots == null|| SkillBasic == null) { return; } SkillBasic skillBasic = SkillBasic; if (skillBasic.SelfSkillConfig.SkillType != 1) { return; } float bl = 1 - SkillSlots.GetFinishBl(); cd.fillAmount = bl; } public void InitSkillWidget(SkillBasic SkillBasic,CombatHeroEntity combatHeroEntity) { this.combatHeroEntity = combatHeroEntity; this.SkillBasic = SkillBasic; this.SkillSlots = null; SetUIInfo(); } public void InitWidget(SkillSlots skillSlots,CombatHeroEntity combatHeroEntity) { this.combatHeroEntity = combatHeroEntity; this.SkillSlots = skillSlots; SkillBasic = skillSlots.SkillBasic; SetUIInfo(); } } }