|
@@ -0,0 +1,166 @@
|
|
|
+/// #pkgName FGUI包名
|
|
|
+/// #panelName UIPanel名字
|
|
|
+/// #UIName = $"{#pkgName}{#panelName}" UIKey名字
|
|
|
+/// 该脚本由模板创建
|
|
|
+/// created by cb 2024
|
|
|
+
|
|
|
+using FairyGUI;
|
|
|
+using FL.Data;
|
|
|
+using System.Collections.Generic;
|
|
|
+using XGame.Database;
|
|
|
+using XGame.Framework.UI;
|
|
|
+
|
|
|
+namespace FL.FGUI
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// UI逻辑处理类
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name=""></typeparam>
|
|
|
+ public partial class PlayerJobInfoSkillNestedCtrl : UIController<PlayerJobInfoSkillNestedVM>
|
|
|
+ {
|
|
|
+ private bool _bHideSkillInfo; // 是否需要隐藏技能信息气泡
|
|
|
+ private List<JobSkillParam> _passiveSkillDataArray;
|
|
|
+
|
|
|
+ protected override void OnEnable(object intent)
|
|
|
+ {
|
|
|
+ AddUIListenres();
|
|
|
+ }
|
|
|
+ protected override void OnDisable()
|
|
|
+ {
|
|
|
+ RemoveUIListenres();
|
|
|
+ _passiveSkillDataArray?.Clear();
|
|
|
+ _passiveSkillDataArray = null;
|
|
|
+ }
|
|
|
+ #region UI事件
|
|
|
+ private void AddUIListenres()
|
|
|
+ {
|
|
|
+ VM.BackBtn.onClick.Add(OnClickBackBtn);
|
|
|
+ VM.PanelEvent.Add(OnCllickPanel);
|
|
|
+ VM.PassiveSkillList.ItemClickEvent += OnClickPassiveSkillItem;
|
|
|
+
|
|
|
+ }
|
|
|
+ private void RemoveUIListenres()
|
|
|
+ {
|
|
|
+ VM.BackBtn.onClick.Remove(OnClickBackBtn);
|
|
|
+ VM.PanelEvent.Remove(OnCllickPanel);
|
|
|
+ VM.PassiveSkillList.ItemClickEvent -= OnClickPassiveSkillItem;
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 隐藏技能信息气泡框
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="context"></param>
|
|
|
+ private void OnCllickPanel(EventContext context)
|
|
|
+ {
|
|
|
+ if (_bHideSkillInfo)
|
|
|
+ {
|
|
|
+ ShowSkillInfoGroup(false);
|
|
|
+ }
|
|
|
+ _bHideSkillInfo = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBackBtn(EventContext context)
|
|
|
+ {
|
|
|
+ Context.ClosePanel();
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ public void ShowUI()
|
|
|
+ {
|
|
|
+ _bHideSkillInfo = true;
|
|
|
+ ShowSkillInfoGroup(false);
|
|
|
+ var jobInfo = careerTableRepo.Get(PlayerData.Instance.JobId);
|
|
|
+ if (jobInfo == null) return;
|
|
|
+
|
|
|
+ VM.JobNameLabel.text = jobInfo.Name;
|
|
|
+ VM.JobTypeLabel.text = jobInfo.Job_pos;
|
|
|
+ VM.JobDescLabel.text = jobInfo.Desc;
|
|
|
+ ShowSkill(jobInfo.Skill);
|
|
|
+ ShowJobPassiveSkillUI(jobInfo.Passive_skill);
|
|
|
+ LoadJobSpine("info_job_1001_1_SkeletonData");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 主动技能
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="skillIds"></param>
|
|
|
+
|
|
|
+ private void ShowSkill(int[] skillIds)
|
|
|
+ {
|
|
|
+ var skillInfo = SkillTableRepo.Get(skillIds[1]);
|
|
|
+ if (skillInfo == null) return;
|
|
|
+ VM.SkillNameLabel.text = skillInfo.Name;
|
|
|
+ VM.SkillDescLabel.text = skillInfo.Desc;
|
|
|
+ VM.ActiveSkillIcon.icon = skillInfo.Icon;
|
|
|
+ VM.SkillCdLabel.text = (skillInfo.RestTime * 0.001f).ToString("F1");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 职业被动技能UI
|
|
|
+ /// </summary>
|
|
|
+ private void ShowJobPassiveSkillUI(int[] skillIds)
|
|
|
+ {
|
|
|
+ int index = 0;
|
|
|
+ if (_passiveSkillDataArray == null) _passiveSkillDataArray = new List<JobSkillParam>();
|
|
|
+ for (int i = 0; i < skillIds.Length; i += 2)
|
|
|
+ {
|
|
|
+ _passiveSkillDataArray.Add(new JobSkillParam()
|
|
|
+ {
|
|
|
+ unlockLv = skillIds[i],
|
|
|
+ skillId = skillIds[i + 1],
|
|
|
+ });
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ VM.PassiveSkillList.BindDatas(_passiveSkillDataArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 点击的被动技能项
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="index"></param>
|
|
|
+ private void OnClickPassiveSkillItem(int index)
|
|
|
+ {
|
|
|
+ _bHideSkillInfo = false;
|
|
|
+ ShowSkillInfoGroup(true, index, SkillTableRepo.Get(_passiveSkillDataArray[index].skillId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 显示技能弹窗信息UI
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="Show"></param>
|
|
|
+ /// <param name="bPassive"></param>
|
|
|
+ private void ShowSkillInfoGroup(bool bShow, int index = 0, SkillTable skillInfo = null)
|
|
|
+ {
|
|
|
+ //Log.Debug($"ShowSkillInfoGroup bShow:{bShow} info:{skillInfo != null} Frame:{Time.frameCount}");
|
|
|
+ if (bShow && skillInfo != null)
|
|
|
+ {
|
|
|
+ var skillParam = new SkillInfoParam()
|
|
|
+ {
|
|
|
+ bShowRightBubble = index > 1,
|
|
|
+ skillInfo = skillInfo
|
|
|
+ };
|
|
|
+ if (VM.SkillInfoNested.Active)
|
|
|
+ VM.SkillInfoNested.Ctrl.ShowSkillInfo(skillParam);
|
|
|
+ else
|
|
|
+ VM.SkillInfoNested.Enable(skillParam);
|
|
|
+
|
|
|
+ VM.PosCtrl.selectedIndex = index;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ VM.SkillInfoNested.Disable();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 加载主角的spine
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="spineName"></param>
|
|
|
+ private void LoadJobSpine(string spineName)
|
|
|
+ {
|
|
|
+ VM.JobSpine.LoadSpine(spineName, "stand", true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|