//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Wednesday, January 31, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using TableConfig; //灵宠的技能 namespace Snxxz.UI { public class SkillButtonPet : CellView { [SerializeField] Button skillBtn; [SerializeField] Image skillIcon; [SerializeField] GameObject lockObj; [SerializeField] Text lockLvText; public void SetModel(int skillId, int skillUnlock, bool isUnlock, int petId, SkillType skillType, bool isAll = false) { SkillConfig skillConfig = Config.Instance.Get(skillId); if (skillConfig == null) return; skillIcon.SetSprite(skillConfig.IconName); if (isUnlock) { lockObj.SetActive(false); lockLvText.gameObject.SetActive(false); } else { lockObj.SetActive(true); if (!isAll) { lockLvText.gameObject.SetActive(true); lockLvText.text = skillUnlock +Language.Get("Z1041"); } else { lockLvText.gameObject.SetActive(false); } } skillBtn.RemoveAllListeners(); skillBtn.AddListener(() => { string[] str = new string[3]; str[0] = string.Empty; str[1] = string.Empty; //if (!isAll) //{ switch (skillType) { case SkillType.PetSkill: PetInfoConfig petInfo = Config.Instance.Get(petId); if (petInfo != null) { str[2] = Language.Get("pet_SkillTipLv", petInfo.Name, skillUnlock); } break; case SkillType.MountSkill: HorseConfig horseInfo = Config.Instance.Get(petId); if (horseInfo != null) { str[2] = Language.Get("pet_SkillTipLv", horseInfo.Name, skillUnlock); } break; } //} //else //{ // str[2] = string.Empty; //} int fightPower = 0; if (skillConfig.FightPower > 0) { fightPower = skillConfig.FightPower; } SkillDetails.ShowSkillDetails(skillId, SkillDetails.SkillSourceType.PetSkill, fightPower, str); }); } } public enum SkillType { PetSkill, MountSkill, } }