/// #pkgName FGUI包名 /// #panelName UIPanel名字 /// #UIName = $"{#pkgName}{#panelName}" UIKey名字 /// 该脚本由模板创建 /// created by cb 2024 using FairyGUI; using FL.Data; using UnityEngine; using XGame.Database; using XGame.Framework.UI; namespace FL.FGUI { /// /// UI逻辑处理类 /// /// public partial class PlayerTransferListItemCtrl : UIController { private int _skillId; // 主动技能id private int _passiveSkillId; // 被动技能id protected override void OnEnable(object intent) { AddUIListenres(); } protected override void OnDisable() { RemoveUIListenres(); VM.JobSpine.url = string.Empty; } #region UI事件 private void AddUIListenres() { VM.SkillBtn.onClick.Add(OnClickSkillBtn); VM.PassiveSkillBtn.onClick.Add(OnClickPassiveSkillBtn); } private void RemoveUIListenres() { VM.SkillBtn.onClick.Remove(OnClickSkillBtn); VM.PassiveSkillBtn.onClick.Remove(OnClickPassiveSkillBtn); } private void OnClickSkillBtn(EventContext context) { } private void OnClickPassiveSkillBtn(EventContext context) { } #endregion public void OnRefresh(int index, int jobId) { var jobInfo = careerTableRepo.Get(jobId); if (jobInfo == null) return; //VM.Tr.localScale.Set(1,1,1); VM.Scale = Vector3.one; VM.JobNameLabel.text = jobInfo.Name; VM.PositioningLabel.text = jobInfo.Job_pos; ShowJobSkillUI(jobInfo.Skill); ShowJobPassiveSkillUI(jobInfo.Passive_skill); LoadJobSpine("info_job_1001_1_SkeletonData"); } /// /// 职业主动技能UI(解锁等级|技能id|技能等级) /// private void ShowJobSkillUI(int[] skillIds) { if (skillIds.Length > 1) { _skillId = skillIds[1]; var skillInfo = SkillTableRepo.Get(skillIds[1]); if (skillInfo != null) { VM.SkillBtn.icon = skillInfo.Icon; } } else { _skillId = 0; } } /// /// 职业被动技能UI /// private void ShowJobPassiveSkillUI(int[] skillIds) { if (skillIds.Length > 1) { _passiveSkillId = skillIds[1]; var skillInfo = SkillTableRepo.Get(skillIds[1]); if (skillInfo != null) { VM.PassiveSkillBtn.icon = skillInfo.Icon; } } else { _passiveSkillId = 0; } } /// /// 加载职业的spine /// /// private void LoadJobSpine(string spineName) { VM.JobSpine.LoadSpine(spineName, "stand", true); } } }