123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- /// #pkgName FGUI包名
- /// #panelName UIPanel名字
- /// #UIName = $"{#pkgName}{#panelName}" UIKey名字
- /// 该脚本由模板创建
- /// created by cb 2024
- using FairyGUI;
- using FL.Data;
- using XGame.Database;
- using XGame.Framework.UI;
- namespace FL.FGUI
- {
- /// <summary>
- /// UI逻辑处理类
- /// </summary>
- /// <typeparam name=""></typeparam>
- public partial class PlayerTransferSucessPanelCtrl : UIController<PlayerTransferSucessPanelVM>
- {
- protected override void OnEnable(object intent)
- {
- AddUIListenres();
- ShowUI();
- }
- protected override void OnDisable()
- {
- RemoveUIListenres();
- VM.JobSpine.url = string.Empty;
- }
- #region UI事件
- private void AddUIListenres()
- {
- VM.BackBtn.onClick.Add(OnClickBackBtn);
- VM.ActiveSkillBtn.onClick.Add(OnClickActiveSkillBtn);
- VM.PassiveSkillBtn.onClick.Add(OnClickPassiveSkillBtn);
- }
- private void RemoveUIListenres()
- {
- VM.BackBtn.onClick.Remove(OnClickBackBtn);
- VM.ActiveSkillBtn.onClick.Remove(OnClickActiveSkillBtn);
- VM.PassiveSkillBtn.onClick.Remove(OnClickPassiveSkillBtn);
- }
- /// <summary>
- /// 点击主动技能
- /// </summary>
- /// <param name="context"></param>
- private void OnClickActiveSkillBtn(EventContext context)
- {
- OpenPlayerJobInformationPanel();
- }
- /// <summary>
- /// 点击被动技能
- /// </summary>
- /// <param name="context"></param>
- private void OnClickPassiveSkillBtn(EventContext context)
- {
- OpenPlayerJobInformationPanel();
- }
- private void OnClickBackBtn(EventContext context)
- {
- Context.ClosePanel();
- }
- #endregion
- private void ShowUI()
- {
- var jobInfo = careerTableRepo.Get(PlayerData.Instance.JobId);
- if (jobInfo == null) return;
- VM.JobName.text = jobInfo.Name;
- ShowSkill(jobInfo.Skill);
- ShowPassiveSkill(jobInfo.Passive_skill);
- LoadJobSpine("info_job_1001_1_SkeletonData");
- }
- /// <summary>
- /// 主动技能
- /// </summary>
- /// <param name="skillIds"></param>
- private void ShowSkill(int[] skillIds)
- {
- bool bShow = skillIds != null && skillIds.Length > 0;
- if (bShow) {
- VM.AdvanceSkillItem.Enable(null);
- }
- else
- {
- VM.AdvanceSkillItem.Disable();
- }
- if (bShow)
- VM.AdvanceSkillItem.Ctrl.ShowUI(skillIds[1]);
- }
- /// <summary>
- /// 被动技能
- /// </summary>
- /// <param name="skillIds"></param>
- private void ShowPassiveSkill(int[] skillIds)
- {
- bool bShow = skillIds != null && skillIds.Length > 0;
- if (bShow) {
- VM.AdvancePassiveSkillItem.Enable(null);
- } else
- {
- VM.AdvancePassiveSkillItem.Disable();
- }
-
- if (bShow)
- VM.AdvancePassiveSkillItem.Ctrl.ShowUI(skillIds[1]);
- }
- /// <summary>
- /// 加载主角的spine
- /// </summary>
- /// <param name="spineName"></param>
- private void LoadJobSpine(string spineName)
- {
- VM.JobSpine.LoadSpine(spineName, "stand", true);
- }
- /// <summary>
- /// 打开职业详情界面
- /// </summary>
- private void OpenPlayerJobInformationPanel()
- {
- Context.UI.OpenAsync(UIKeys.PlayerJobInformationPanel);
- }
- }
- }
|