|
@@ -7,7 +7,6 @@
|
|
|
using FairyGUI;
|
|
|
using FL.Data;
|
|
|
using FL.Data.Items;
|
|
|
-using System;
|
|
|
using System.Collections.Generic;
|
|
|
using XGame.Database;
|
|
|
using XGame.Framework.UI;
|
|
@@ -15,27 +14,12 @@ using XGame.Framework.UI;
|
|
|
namespace FL.FGUI
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// 职业(主|被)技能
|
|
|
- /// </summary>
|
|
|
- public struct JobSkillParam
|
|
|
- {
|
|
|
- public int unlockLv;
|
|
|
- public int skillId;
|
|
|
- public Action<int,int> onclickSkillIcon;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
/// UI逻辑处理类
|
|
|
/// </summary>
|
|
|
/// <typeparam name=""></typeparam>
|
|
|
public partial class PlayerMainPanelCtrl : UIController<PlayerMainPanelVM>
|
|
|
{
|
|
|
- private int _index;
|
|
|
- private int _skillId; // 当前主动技能id
|
|
|
- private careerTable _jobInfo; // 当前职业信息
|
|
|
private List<CommonItemBaseView> _equipItemList;
|
|
|
- private JobSkillParam[] _passiveSkillDataArray; // 被动技能数据列表
|
|
|
- private Dictionary<EAttributeType, string> _attributeDescMap;
|
|
|
|
|
|
protected override void OnEnable(object intent)
|
|
|
{
|
|
@@ -48,65 +32,41 @@ namespace FL.FGUI
|
|
|
{
|
|
|
RemoveUIListenres();
|
|
|
RemoveEventListener();
|
|
|
- ShowSkillInfoGroup(false);
|
|
|
if (_equipItemList != null)
|
|
|
{
|
|
|
_equipItemList.Clear();
|
|
|
_equipItemList = null;
|
|
|
}
|
|
|
|
|
|
- if (_attributeDescMap != null)
|
|
|
- {
|
|
|
- _attributeDescMap.Clear();
|
|
|
- _attributeDescMap = null;
|
|
|
- }
|
|
|
VM.PlayerSpine.url = string.Empty;
|
|
|
- _jobInfo = null;
|
|
|
- if (_passiveSkillDataArray != null) _passiveSkillDataArray = null;
|
|
|
}
|
|
|
#region UI事件
|
|
|
private void AddUIListenres()
|
|
|
{
|
|
|
- VM.AttrInfoBtn.onClick.Add(OnClickAttrInfoBtn);
|
|
|
- VM.SkillBtn.onClick.Add(OnClickSkillBtn);
|
|
|
- //VM.ChangeBtn.onClick.Add(OnClickChangeBtn);
|
|
|
VM.MountBtn.onClick.Add(OnClickMountBtn);
|
|
|
VM.ArtifactBtn.onClick.Add(OnClickArtifactBtn);
|
|
|
VM.ContractBtn.onClick.Add(OnClickContractBtn);
|
|
|
VM.JewelryBtn.onClick.Add(OnClickJewelryBtn);
|
|
|
VM.NotOpenBtn1.onClick.Add(OnClickNotOpenBtn1);
|
|
|
VM.NotOpenBtn2.onClick.Add(OnClickNotOpenBtn2);
|
|
|
- VM.TransferBtn.onClick.Add(OnClickTransferBtn);
|
|
|
- VM.WakeUpBtn.onClick.Add(OnClickWakeUpBtn);
|
|
|
- VM.JobBtn.onClick.Add(OnClickJobBtn);
|
|
|
- VM.HideSkillInfoGroupBtn.onClick.Add(OnClickHideSkillInfoGroupBtn);
|
|
|
+ VM.UpgradeLvBtn.onClick.Add(OnClickUpgradeLvBtn);
|
|
|
}
|
|
|
private void RemoveUIListenres()
|
|
|
{
|
|
|
- VM.AttrInfoBtn.onClick.Remove(OnClickAttrInfoBtn);
|
|
|
- VM.SkillBtn.onClick.Remove(OnClickSkillBtn);
|
|
|
- //VM.ChangeBtn.onClick.Remove(OnClickChangeBtn);
|
|
|
VM.MountBtn.onClick.Remove(OnClickMountBtn);
|
|
|
VM.ArtifactBtn.onClick.Remove(OnClickArtifactBtn);
|
|
|
VM.ContractBtn.onClick.Remove(OnClickContractBtn);
|
|
|
VM.JewelryBtn.onClick.Remove(OnClickJewelryBtn);
|
|
|
VM.NotOpenBtn1.onClick.Remove(OnClickNotOpenBtn1);
|
|
|
VM.NotOpenBtn2.onClick.Remove(OnClickNotOpenBtn2);
|
|
|
- VM.TransferBtn.onClick.Remove(OnClickTransferBtn);
|
|
|
- VM.WakeUpBtn.onClick.Remove(OnClickWakeUpBtn);
|
|
|
- VM.JobBtn.onClick.Remove(OnClickJobBtn);
|
|
|
- VM.HideSkillInfoGroupBtn.onClick.Add(OnClickHideSkillInfoGroupBtn);
|
|
|
+ VM.UpgradeLvBtn.onClick.Remove(OnClickUpgradeLvBtn);
|
|
|
}
|
|
|
|
|
|
- private void OnClickAttrInfoBtn(EventContext context)
|
|
|
+ private void OnClickUpgradeLvBtn(EventContext context)
|
|
|
{
|
|
|
- Context.UI.OpenAsync(UIKeys.PlayerDetailsAttribute);
|
|
|
- }
|
|
|
- private void OnClickSkillBtn(EventContext context)
|
|
|
- {
|
|
|
- if (_skillId > 0)
|
|
|
- OnClickSkillIcon(_skillId, -1);
|
|
|
+ Context.ShowTips("一键使用经验道具进行升级事件");
|
|
|
}
|
|
|
+
|
|
|
private void OnClickChangeBtn(EventContext context)
|
|
|
{
|
|
|
Context.ShowTips("更换契约技能");
|
|
@@ -136,54 +96,10 @@ namespace FL.FGUI
|
|
|
Context.ShowTips(StringDefine.notOpen);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 转职按钮
|
|
|
- /// </summary>
|
|
|
- /// <param name="context"></param>
|
|
|
- private void OnClickTransferBtn(EventContext context)
|
|
|
- {
|
|
|
- // 分条件满足和不满足的(相当于展示下阶职业的预览ui)显示
|
|
|
- // 当前是否最高级职业
|
|
|
- if (_jobInfo.Job_change?.Length > 0)
|
|
|
- {
|
|
|
- Context.UI.OpenAsync(UIKeys.PlayerTransferPanel, false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OnClickJobBtn(null);
|
|
|
- }
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 觉醒按钮
|
|
|
- /// </summary>
|
|
|
- /// <param name="context"></param>
|
|
|
- private void OnClickWakeUpBtn(EventContext context)
|
|
|
- {
|
|
|
- Context.UI.OpenAsync(UIKeys.PlayerAwakePanel);
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 职业(整个线路图)预览
|
|
|
- /// </summary>
|
|
|
- /// <param name="context"></param>
|
|
|
- private void OnClickJobBtn(EventContext context)
|
|
|
- {
|
|
|
- Context.ShowTips("职业(整个线路图)预览");
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 隐藏技能信息提示框
|
|
|
- /// </summary>
|
|
|
- /// <param name="context"></param>
|
|
|
- private void OnClickHideSkillInfoGroupBtn(EventContext context)
|
|
|
- {
|
|
|
- ShowSkillInfoGroup(false);
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
private void AddEventListener()
|
|
|
{
|
|
|
EventSingle.Instance.AddListener(EventDefine.OnChangeEquip, OnChangeEquip);
|
|
|
- EventSingle.Instance.AddListener(EventDefine.AttributeChange, OnChangeAttribute); // 角色属性变化
|
|
|
EventSingle.Instance.AddListener(EventDefine.PlayerExpAdd, AddPlayerExp);
|
|
|
EventSingle.Instance.AddListener(EventDefine.RefreshWearEquipUI, RefreshWearEquipUI);
|
|
|
EventSingle.Instance.AddListener(EventDefine.TransferSucess, TransferSucess);
|
|
@@ -192,7 +108,6 @@ namespace FL.FGUI
|
|
|
private void RemoveEventListener()
|
|
|
{
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.OnChangeEquip, OnChangeEquip);
|
|
|
- EventSingle.Instance.RemoveListener(EventDefine.AttributeChange, OnChangeAttribute); // 角色属性变化
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.PlayerExpAdd, AddPlayerExp);
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.RefreshWearEquipUI, RefreshWearEquipUI);
|
|
|
EventSingle.Instance.RemoveListener(EventDefine.TransferSucess, TransferSucess);
|
|
@@ -208,18 +123,9 @@ namespace FL.FGUI
|
|
|
VM.Weapon,VM.Helmet,VM.Clothes,VM.Hand,VM.Pants,VM.Boots
|
|
|
};
|
|
|
}
|
|
|
- if (_attributeDescMap == null)
|
|
|
- {
|
|
|
- _attributeDescMap = new Dictionary<EAttributeType, string>()
|
|
|
- {
|
|
|
- {EAttributeType.Atk, GetAttributeDesc(EAttributeType.Atk)},
|
|
|
- {EAttributeType.Hp, GetAttributeDesc(EAttributeType.Hp)},
|
|
|
- {EAttributeType.Def, GetAttributeDesc(EAttributeType.Def)},
|
|
|
- { EAttributeType.AtkSpeed, GetAttributeDesc(EAttributeType.AtkSpeed)}
|
|
|
- };
|
|
|
- }
|
|
|
- InitPassiveSkillDataList();
|
|
|
- ShowSkillInfoGroup(false);
|
|
|
+
|
|
|
+ VM.JokSkillNested.Ctrl.Init();
|
|
|
+
|
|
|
PlayerService.Instance.SendToEquipInto();
|
|
|
}
|
|
|
|
|
@@ -231,7 +137,7 @@ namespace FL.FGUI
|
|
|
//ShowContractSkills(201711);
|
|
|
LoadPlayerSpine("info_job_1001_1_SkeletonData");
|
|
|
|
|
|
- ShowJobUI();
|
|
|
+ VM.JokSkillNested.Ctrl.ShowJobUI();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -319,10 +225,7 @@ namespace FL.FGUI
|
|
|
VM.NameLabel.text = PlayerData.Instance.Name;
|
|
|
ShowPlayerLevel();
|
|
|
ShowExp(false);
|
|
|
- ShowAtrributeVal(VM.AtkLabel, EAttributeType.Atk);
|
|
|
- ShowAtrributeVal(VM.HpLabel, EAttributeType.Hp);
|
|
|
- ShowAtrributeVal(VM.DefLabel, EAttributeType.Def);
|
|
|
- ShowAtrributeVal(VM.AtkSpeedLabel, EAttributeType.AtkSpeed, true);
|
|
|
+ VM.JokSkillNested.Ctrl.ShowAttributeUI();
|
|
|
}
|
|
|
private void ShowPlayerLevel()
|
|
|
{
|
|
@@ -354,166 +257,8 @@ namespace FL.FGUI
|
|
|
ShowExp();
|
|
|
}
|
|
|
|
|
|
- private string GetAttributeDesc(EAttributeType attrType)
|
|
|
- {
|
|
|
- var attrInfo = AttrDescTableRepo.Get((int)attrType);
|
|
|
- return attrInfo?.ShowName ?? string.Empty;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 角色属性变化
|
|
|
- /// </summary>
|
|
|
- /// <param name="eventId"></param>
|
|
|
- /// <param name="args"></param>
|
|
|
- private void OnChangeAttribute(int eventId, object args)
|
|
|
- {
|
|
|
- EAttributeType attrType = (EAttributeType)args;
|
|
|
- if (attrType == EAttributeType.Atk)
|
|
|
- {
|
|
|
- ShowAtrributeVal(VM.AtkLabel, EAttributeType.Atk);
|
|
|
- }
|
|
|
- else if (attrType == EAttributeType.Hp)
|
|
|
- {
|
|
|
- ShowAtrributeVal(VM.HpLabel, EAttributeType.Hp);
|
|
|
- }
|
|
|
- else if (attrType == EAttributeType.Def)
|
|
|
- {
|
|
|
- ShowAtrributeVal(VM.DefLabel, EAttributeType.Def);
|
|
|
- }
|
|
|
- else if (attrType == EAttributeType.AtkSpeed)
|
|
|
- {
|
|
|
- ShowAtrributeVal(VM.AtkSpeedLabel, EAttributeType.AtkSpeed, true);
|
|
|
- }
|
|
|
- }
|
|
|
- private void ShowAtrributeVal(GTextField attrLabel, EAttributeType attrType, bool bAtkSpeed = false)
|
|
|
- {
|
|
|
- var attrVal = PlayerData.Instance.Attr.GetValue(attrType);
|
|
|
- attrLabel.text = $"{_attributeDescMap[attrType]}:{(bAtkSpeed ? TableUtils.ToRealDouble(attrVal).ToString("F1") : attrVal.ToString())}";
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
- #region 职业信息
|
|
|
- private void ShowJobUI()
|
|
|
- {
|
|
|
- _jobInfo = careerTableRepo.Get(PlayerData.Instance.JobId);
|
|
|
- if (_jobInfo == null) return;
|
|
|
-
|
|
|
- int playerLv = PlayerData.Instance.Level;
|
|
|
- VM.JobNameLabel.text = _jobInfo.Name;
|
|
|
- VM.TransfersCountLabel.text = _jobInfo.Change_times.ToString(); // 转职次数
|
|
|
- // 当前是否最高级职业
|
|
|
- bool bSuperlative = _jobInfo.Job_change.Length == 0;
|
|
|
- if (!bSuperlative)
|
|
|
- {
|
|
|
- var advanceInfo = careerTableRepo.Get(_jobInfo.Job_change[0]);
|
|
|
- if (advanceInfo == null)
|
|
|
- {
|
|
|
- bSuperlative = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- VM.UnlockLabel.text = string.Format(StringDefine.UnlockAdvanceJob, playerLv, advanceInfo.Unlock);
|
|
|
- }
|
|
|
- }
|
|
|
- VM.SuperlativeCtrl.selectedIndex = bSuperlative ? 1 : 0;
|
|
|
- ShowJobSkillUI(_jobInfo.Skill);
|
|
|
- ShowJobPassiveSkillUI(_jobInfo.Passive_skill);
|
|
|
- ShowWakeUpBtn(_jobInfo.Change_times > 4); // 若角色转职未达到五阶段,将隐藏觉醒按钮
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 是否显示觉醒按钮
|
|
|
- /// </summary>
|
|
|
- /// <param name="bShow"></param>
|
|
|
- private void ShowWakeUpBtn(bool bShow)
|
|
|
- {
|
|
|
- VM.WakeUpBtn.visible = bShow;
|
|
|
- }
|
|
|
-
|
|
|
- /// <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.JobSkillLabel.text = skillInfo.Name;
|
|
|
- VM.SkillBtn.icon = skillInfo.Icon;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _skillId = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void InitPassiveSkillDataList()
|
|
|
- {
|
|
|
- if (_passiveSkillDataArray == null || _passiveSkillDataArray.Length == 0)
|
|
|
- {
|
|
|
- _passiveSkillDataArray = new JobSkillParam[5];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 职业被动技能UI
|
|
|
- /// </summary>
|
|
|
- private void ShowJobPassiveSkillUI(int[] skillIds)
|
|
|
- {
|
|
|
- int index = 0;
|
|
|
- for (int i = 0; i < skillIds.Length; i += 2)
|
|
|
- {
|
|
|
- _passiveSkillDataArray[index] = new JobSkillParam()
|
|
|
- {
|
|
|
- unlockLv = skillIds[i],
|
|
|
- skillId = skillIds[i + 1],
|
|
|
- onclickSkillIcon = OnClickSkillIcon
|
|
|
- };
|
|
|
- index++;
|
|
|
- }
|
|
|
- VM.PassiveSkillList.BindDatas(_passiveSkillDataArray);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 点击技能图标
|
|
|
- /// </summary>
|
|
|
- /// <param name="skillId"></param>
|
|
|
- private void OnClickSkillIcon(int skillId, int index)
|
|
|
- {
|
|
|
- var skillInfo = SkillTableRepo.Get(skillId);
|
|
|
- if (skillInfo == null) return;
|
|
|
-
|
|
|
- VM.SkillInfoTipCtrl.selectedIndex = index == -1 ? 0 : (index+1);
|
|
|
- ShowSkillInfoGroup(true, skillInfo);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 显示技能弹窗信息UI
|
|
|
- /// </summary>
|
|
|
- /// <param name="Show"></param>
|
|
|
- /// <param name="bPassive"></param>
|
|
|
- private void ShowSkillInfoGroup(bool bShow, SkillTable skillInfo = null)
|
|
|
- {
|
|
|
- VM.SkillInfoGroup.visible = bShow;
|
|
|
- VM.HideSkillInfoGroupBtn.visible = bShow;
|
|
|
- if (bShow && skillInfo != null)
|
|
|
- {
|
|
|
- VM.SkillIcon.icon = skillInfo.Icon;
|
|
|
- VM.SkillNameLabel.text = skillInfo.Name;
|
|
|
- VM.SkillDescLabel.text = skillInfo.Desc;
|
|
|
- if (skillInfo.ModalityType == 1) // 主动技能
|
|
|
- {
|
|
|
- VM.SkillCdLabel.text = (skillInfo.RestTime * 0.001f).ToString("F1");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 转职成功
|
|
|
/// </summary>
|
|
@@ -522,7 +267,7 @@ namespace FL.FGUI
|
|
|
private void TransferSucess(int eventId, object args)
|
|
|
{
|
|
|
Context.UI.OpenAsync(UIKeys.PlayerTransferSucessPanel);
|
|
|
- ShowJobUI();
|
|
|
+ VM.JokSkillNested.Ctrl.ShowJobUI();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -532,10 +277,8 @@ namespace FL.FGUI
|
|
|
/// <param name="args"></param>
|
|
|
private void ResetJobSucess(int eventId, object args)
|
|
|
{
|
|
|
- Context.UI.OpenAsync(UIKeys.PlayerTransferPanel,true);
|
|
|
- ShowJobUI();
|
|
|
+ Context.UI.OpenAsync(UIKeys.PlayerTransferPanel, true);
|
|
|
+ VM.JokSkillNested.Ctrl.ShowJobUI();
|
|
|
}
|
|
|
-
|
|
|
- #endregion
|
|
|
}
|
|
|
}
|