From a51aad2ddcf0cb2ffc8e77cac145f6f5d70ffc6b Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 04 四月 2019 11:47:52 +0800
Subject: [PATCH] 3335 灵宠坐骑技能整合
---
System/Mount/MountPanelAssignment.cs | 118 ++++++++++++++++++++++++++++++++++------------------------
1 files changed, 69 insertions(+), 49 deletions(-)
diff --git a/System/Mount/MountPanelAssignment.cs b/System/Mount/MountPanelAssignment.cs
index 1835599..9a62fb4 100644
--- a/System/Mount/MountPanelAssignment.cs
+++ b/System/Mount/MountPanelAssignment.cs
@@ -28,6 +28,7 @@
[SerializeField] UIEffect m_Uieffect3;//缁忛獙鏉$壒鏁�
[SerializeField] Transform GroupSkill;
+ [SerializeField] FunctionUnlockFlyObjectTarget[] flyObjectTargets;
[SerializeField] GameObject m_YiJieSuo;//瑙i攣闈㈡澘
[SerializeField] GameObject m_BottomOperate;//鍏充簬缁忛獙鏉�
@@ -89,7 +90,6 @@
MountModel.Event_MountHA301U += OnMountHA301Update;
allPetSkillCtrl.OnRefreshCell += RefreshAllMountSkillCell;
- FlySkillIconWin.FlySkillID += FlySkillID;
CreateAllMountSkill();
}
private void OnDisable()
@@ -97,7 +97,6 @@
mount_ID = 0;
MountModel.Event_MountHA301U -= OnMountHA301Update;
allPetSkillCtrl.OnRefreshCell -= RefreshAllMountSkillCell;
- FlySkillIconWin.FlySkillID -= FlySkillID;
m_MountRawImg.gameObject.SetActive(false);
}
@@ -127,22 +126,6 @@
var animator = UI3DModelExhibition.Instance.NpcModelHorse.GetComponent<Animator>();
animator.Play(GAStaticDefine.State_Dance);
}
- }
-
- private void FlySkillID(int skillID)
- {
- int Index = 0;
- Index = GetAllMountSkill.FindIndex((x) =>
- {
- return x.SkillID == skillID;
- });
- if (Index == -1)
- {
- Index = 0;
- }
- int line = Index / 3;
- allPetSkillCtrl.JumpIndex(line);
- allPetSkillCtrl.JumpIndex(-50, 0, EnhancedScroller.TweenType.immediate);
}
private void OnMountHA301Update(int _HorseID)
@@ -479,6 +462,13 @@
{
mountSkill.SetModel(MountSkills[i].SkillID, MountSkills[i].HorseLV, false, HorseID, SkillType.MountSkill);
}
+ if (i < flyObjectTargets.Length)
+ {
+ var flyObjectTarget = flyObjectTargets[i];
+ flyObjectTarget.IdList = new int[] { MountSkills[i].SkillID };
+ flyObjectTarget.Z_UnLockType = FunctionUnlockType.Skill;
+ FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { MountSkills[i].SkillID }, flyObjectTarget);
+ }
}
else
{
@@ -487,51 +477,84 @@
}
}
- List<HorseSkillClass> GetAllMountSkill = new List<HorseSkillClass>();
+ List<int> displayTotalSkills = new List<int>();
private void CreateAllMountSkill()//鎵�鏈夊潗楠戞妧鑳�
{
- GetAllMountSkill.Clear();
- foreach (int key in mountModel.GetMountSkillAndItem.Keys)
+ displayTotalSkills.Clear();
+ var skills = mountModel.GetMountSkillAndItem.Keys;
+ foreach (var id in skills)
{
- GetAllMountSkill.Add(mountModel.GetMountSkillAndItem[key]);
+ var config = SkillConfig.Get(id);
+ var skillId = 0;
+ var effect = SkillConfig.GetSkillEffectValue(config);
+ if (mountModel.TryGetIntegrationSkill(effect, out skillId))
+ {
+ if (!displayTotalSkills.Contains(skillId))
+ {
+ displayTotalSkills.Add(skillId);
+ }
+ continue;
+ }
+ displayTotalSkills.Add(id);
}
+
ToAddSorting();
+
allPetSkillCtrl.Refresh();
- int line = GetAllMountSkill.Count / 3;
- int remain = GetAllMountSkill.Count % 3;
- if (remain > 0)
- {
- line += 1;
- }
+ int line = Mathf.CeilToInt((float)displayTotalSkills.Count / 3);
for (int i = 0; i < line; i++)
{
allPetSkillCtrl.AddCell(ScrollerDataType.Header, i);
}
+
allPetSkillCtrl.Restart();
}
+
void ToAddSorting()
{
- GetAllMountSkill.Sort(Compare);
+ displayTotalSkills.Sort(Compare);
}
- int Compare(HorseSkillClass x, HorseSkillClass y)
+ int Compare(int lhs, int rhs)
{
- bool havex = IsDeblocking(x.SkillID);
- bool havey = IsDeblocking(y.SkillID);
- if (havex.CompareTo(havey) != 0)
+ var lhs_unlock = mountModel.IsSkillUnlock(lhs);
+ var rhs_unlock = mountModel.IsSkillUnlock(rhs);
+ if (lhs_unlock != rhs_unlock)
{
- return -havex.CompareTo(havey);
- }
- if (x.HorseID.CompareTo(y.HorseID) != 0)
- {
- return x.HorseID.CompareTo(y.HorseID);
+ return -lhs_unlock.CompareTo(rhs_unlock);
}
- if (x.HorseLV.CompareTo(y.HorseLV) != 0)
+ var lhs_config = SkillConfig.Get(lhs);
+ var rhs_config = SkillConfig.Get(rhs);
+ var lhs_Id = 0;
+ var rhs_Id = 0;
+ var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
+ var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
+ var lhs_integration = mountModel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
+ var rhs_integration = mountModel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
+
+ if (lhs_integration != rhs_integration)
{
- return x.HorseLV.CompareTo(y.HorseLV);
+ return -lhs_integration.CompareTo(rhs_integration);
}
- return 1;
+ if (lhs_integration && rhs_integration)
+ {
+ return lhs_config.Effect1.CompareTo(rhs_config.Effect1);
+ }
+
+ var lhs_horseInfo = mountModel.GetMountSkillAndItem[lhs];
+ var rhs_horseInfo = mountModel.GetMountSkillAndItem[rhs];
+
+ if (lhs_horseInfo.HorseID != rhs_horseInfo.HorseID)
+ {
+ return lhs_horseInfo.HorseID.CompareTo(rhs_horseInfo.HorseID);
+ }
+
+ if (lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV) != 0)
+ {
+ return lhs_horseInfo.HorseLV.CompareTo(rhs_horseInfo.HorseLV);
+ }
+ return 0;
}
private bool IsDeblocking(int SkillID)//鏄惁瑙i攣
@@ -554,22 +577,19 @@
return false;
}
}
+
private void RefreshAllMountSkillCell(ScrollerDataType type, CellView cell)
{
int length = cell.transform.childCount;
for (int i = 0; i < length; i++)
{
- int cellCnt = cell.index * 3 + (i + 1);
+ int index = cell.index * 3 + i;
SkillButtonPet skillButton = cell.transform.GetChild(i).GetComponent<SkillButtonPet>();
- FunctionUnlockFlyObjectTarget functionUnlockFlyObjectTarget = cell.transform.GetChild(i).GetComponent<FunctionUnlockFlyObjectTarget>();
- if (cellCnt <= GetAllMountSkill.Count)
+ if (index < displayTotalSkills.Count)
{
skillButton.gameObject.SetActive(true);
- HorseSkillClass horseSkillClass = GetAllMountSkill[cellCnt - 1];
- skillButton.SetModel(horseSkillClass.SkillID, horseSkillClass.HorseLV, IsDeblocking(horseSkillClass.SkillID), horseSkillClass.HorseID, SkillType.MountSkill, true);
- functionUnlockFlyObjectTarget.IdList = new int[] { horseSkillClass.SkillID };
- functionUnlockFlyObjectTarget.Z_UnLockType = FunctionUnlockType.Skill;
- FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { horseSkillClass.SkillID }, functionUnlockFlyObjectTarget);
+ var skillId = displayTotalSkills[index];
+ skillButton.SetModel(skillId, 0, mountModel.IsSkillUnlock(skillId), 0, SkillType.MountSkill, true);
}
else
{
--
Gitblit v1.8.0