// 获取技能描述 public string GetSkillDesc(int skillID, int level) { SkillSettingsConfig skillCfg = SkillSettingsConfigLoader.GetConfig(skillID); int skillLevel = level; float value1 = 0; float value2 = 0; switch (skillLevel) { case 1: value1 = skillCfg.Level1Param1; value2 = skillCfg.Level1Param2; break; case 2: value1 = skillCfg.Level2Param1; value2 = skillCfg.Level2Param2; break; case 3: value1 = skillCfg.Level3Param1; value2 = skillCfg.Level3Param2; break; case 4: value1 = skillCfg.Level4Param1; value2 = skillCfg.Level4Param2; break; } return(string.Format(skillCfg.Description, value1, value2)); }
// 获取技能图标 public Sprite GetSkillIcon(int skillID) { SkillSettingsConfig cfg = SkillSettingsConfigLoader.GetConfig(skillID); if (cfg == null || string.IsNullOrEmpty(cfg.Icon)) { return(GetSprite("Texture/SkillIcon/UI_jinengtubiao_1")); } return(GetSprite("Texture/SkillIcon/" + cfg.Icon)); }
public void SetInfo(HeroInfo info, int skillID, int index) { _currentHeroInfo = info; _currentIndex = index; _skillIcon.sprite = ResourceManager.Instance.GetSkillIcon(skillID); SkillSettingsConfig cfg = SkillSettingsConfigLoader.GetConfig(skillID, false); if (cfg == null) { _flag.gameObject.SetActive(false); _textMoney.gameObject.SetActive(false); _btnUplev.gameObject.SetActive(false); _textLevel.gameObject.SetActive(false); _textUnlock.gameObject.SetActive(false); _skillIcon.gameObject.SetActive(false); _textName.gameObject.SetActive(false); _txtFullLevel.gameObject.SetActive(false); return; } _skillIcon.gameObject.SetActive(true); _textName.gameObject.SetActive(true); _textName.text = cfg.Name; bool lockSkill = false; if (index == 2 && info.Level < GameConfig.SKILL_UNLOCK2 || index == 3 && info.Level < GameConfig.SKILL_UNLOCK3 || index == 4 && info.Level < GameConfig.SKILL_UNLOCK4) { lockSkill = true; } if (!lockSkill) { SkillInfo skillInfo = info.GetSkillByID(skillID); int level = skillInfo != null ? skillInfo.Level : 1; // 已经解锁 _flag.gameObject.SetActive(true); _textMoney.gameObject.SetActive(true); _btnUplev.gameObject.SetActive(true); _textLevel.gameObject.SetActive(true); _textUnlock.gameObject.SetActive(false); int upgradeCost = SkillInfo.GetUpgradeCost(index, level); if (upgradeCost > 0) { // 未满级 _textMoney.text = upgradeCost.ToString(); _textMoney.gameObject.SetActive(true); _txtFullLevel.gameObject.SetActive(false); _flag.gameObject.SetActive(true); _btnUplev.gameObject.SetActive(true); } else { // 已满级 _textMoney.gameObject.SetActive(false); _txtFullLevel.gameObject.SetActive(true); _flag.gameObject.SetActive(false); _btnUplev.gameObject.SetActive(false); } _textLevel.text = "Lv." + level; } else { // 提升到固定品阶解锁 _flag.gameObject.SetActive(false); _textMoney.gameObject.SetActive(false); _btnUplev.gameObject.SetActive(false); _textLevel.gameObject.SetActive(false); _textUnlock.gameObject.SetActive(true); _txtFullLevel.gameObject.SetActive(false); if (index == 2) { _textUnlock.text = Str.Format("UI_HERO_SKILL_UPGRADE_TIP", GameConfig.SKILL_UNLOCK2); } else if (index == 3) { _textUnlock.text = Str.Format("UI_HERO_SKILL_UPGRADE_TIP", GameConfig.SKILL_UNLOCK3); } else if (index == 4) { _textUnlock.text = Str.Format("UI_HERO_SKILL_UPGRADE_TIP", GameConfig.SKILL_UNLOCK4); } } }
// 获取技能名称等级 public string GetFixedSkillName(int skillID, int level) { SkillSettingsConfig skillCfg = SkillSettingsConfigLoader.GetConfig(skillID); return(skillCfg.Name + " LV." + level); }