/// <summary> /// 替换头像控件绑定 /// </summary> /// <param name="oldHero"></param> /// <param name="newHero"></param> public void ReplaceHeadShot(HeroFightUnit oldHero, HeroFightUnit newHero) { HeadShotWidget headShot = HeadShotMapper[oldHero]; HeadShotMapper.Remove(oldHero); HeadShotMapper.Add(newHero, headShot); headShot.HeadshotIcon.spriteName = Util.GetConfigString(newHero.heroData.icon); headShot.SetShuxing((HurtType)newHero.heroData.element); HeroAttack attack = newHero.GetComponent <HeroAttack>(); headShot.onClick = attack.UI_UseActiveSkill; headShot.onDrag = attack.UI_UseUniqueSkill; }
/// <summary> /// 绑定英雄头像控件 /// </summary> /// <param name="unit"></param> /// <param name="i"></param> public void RegesterHeadShot(HeroFightUnit unit, int i) { string key = i + HeadShotWidget.nameExtension; HeadShotWidget headShot = (HeadShotWidget)widgetsMap[key]; HeadShotMapper.Add(unit, headShot); headShot.HeadshotIcon.spriteName = Util.GetConfigString(unit.heroData.icon); headShot.SetShuxing((HurtType)unit.heroData.element); HeroAttack attack = unit.GetComponent <HeroAttack>(); headShot.onClick = attack.UI_UseActiveSkill; headShot.onDrag = attack.UI_UseUniqueSkill; headShot.gameObject.SetActive(true); }