123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- /// #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
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PlayerTransferListItemCtrl : UIController<PlayerTransferListItemVM>
- {
- 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");
- }
- /// <summary>
- /// 职业主动技能UI(解锁等级|技能id|技能等级)
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 职业被动技能UI
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 加载职业的spine
- /// </summary>
- /// <param name="spineName"></param>
- private void LoadJobSpine(string spineName)
- {
- VM.JobSpine.LoadSpine(spineName, "stand", true);
- }
- }
- }
|