public void InitAbilities() { List <int> skillList = GetSkillList(); foreach (int skillID in skillList) { skillItem skillItem = skillTable.Instance.GetTableItem(skillID); //string skillConfig = skillItem.config; Ability ability = AbilityReader.CreateAbility(skillID, this); string skillName = ability.GetCastAnimation(); var castType = m_stringToCastTypeMap[skillName]; m_abilityMap[castType] = ability; abilities.Add(ability); } }
public static Ability CreateAbility(int id, BattleUnit caster) { skillItem skillItem = skillTable.Instance.GetTableItem(id); if (skillItem == null) { BattleLog.LogError("skill 表没有找到指定id:", id.ToString()); return(null); } string path = skillItem.config; int priority = skillItem.priority; AbilityData abilityData = CreateAbility(path); Ability ability = new Ability(id, priority, caster, abilityData); return(ability); }
public void Init(AbilityCastType castType, Ability ability, Action <AbilityCastType> downAction , Action <AbilityCastType, Vector2> dragAction, Action <AbilityCastType> upAction) { m_joystick.name = "JoystickSkillItem" + castType.ToString(); m_downAction = downAction; m_dragAction = dragAction; m_upAction = upAction; m_ability = ability; m_skillID = ability.ID; m_abilityCastType = castType; skillItem skillItem = skillTable.Instance.GetTableItem(m_skillID); string iconName = skillItem.icon; iconName = "skill/" + iconName;//todo 导出动态图片映射表 ImageEx ImgIcon = (ImageEx)UI["ImgIcon"]; ImgIcon.SetSprite(iconName); m_txtCD = (TextMeshProUGUI)UI["TxtCD"]; m_imgCDMask = (Image)UI["ImgCDMask"]; SetCDState(); }