From 8708ca3bc5e146170e7353a8f8d0658ea4e1010d Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 29 三月 2019 11:56:51 +0800
Subject: [PATCH] 3335 修改强化bug

---
 System/KnapSack/Logic/ItemOperateUtility.cs |    7 +++
 System/EquipGem/EquipStrengthWin.cs         |   57 +++++++++++++++++++++++++++-
 System/EquipGem/EquipStrengthModel.cs       |    3 +
 3 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/System/EquipGem/EquipStrengthModel.cs b/System/EquipGem/EquipStrengthModel.cs
index 7fda3fc..06ef7c5 100644
--- a/System/EquipGem/EquipStrengthModel.cs
+++ b/System/EquipGem/EquipStrengthModel.cs
@@ -92,6 +92,9 @@
             }
         }
     }
+
+    public Int2 jumpEquipPosition { get; set; }
+
     public override void Init()
     {
         var strengthenLevelLimit = FuncConfigConfig.Get("StrengthenLevelLimit").Numerical1;
diff --git a/System/EquipGem/EquipStrengthWin.cs b/System/EquipGem/EquipStrengthWin.cs
index 201ded4..80346fe 100644
--- a/System/EquipGem/EquipStrengthWin.cs
+++ b/System/EquipGem/EquipStrengthWin.cs
@@ -66,10 +66,12 @@
             strengthModel.SelectLevelRefresh += SelectLevelRefresh;
             strengthModel.EquipStrengthUpdate += EquipStrengthUpdate;
             strengthModel.EquipStrengthLvUpdate += EquipStrengthLvUpdate;
-            PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
+            PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshEvent;
+
+            m_Controller.JumpIndex(GetJumpIndex(strengthModel.SelectLevel, strengthModel.SelectEquipPlace));
         }
 
-       
+
         protected override void OnAfterOpen()
         {
         }
@@ -111,6 +113,48 @@
             }
         }
         #endregion
+
+        int GetJumpIndex(int selectLevel, int selectPlace)
+        {
+            var jumpIndex = 0;
+            var equipSets = equipModel.GetAllEquipSets();
+            foreach (var level in equipSets)
+            {
+                if (level > selectLevel)
+                {
+                    return jumpIndex;
+                }
+                var equipSet = equipModel.GetEquipSet(level);
+                if (equipSet == null)
+                {
+                    continue;
+                }
+                if (equipSet.unLocked)
+                {
+                    var slotCount = model.GetUnlockEquipSlotCount(level);
+                    if (slotCount > 0)
+                    {
+                        jumpIndex++;
+                        if (model.selectLevel == level)
+                        {
+                            var places = model.GetMosaicEquipPlaces();
+                            foreach (var place in places)
+                            {
+                                if (equipSet.IsSlotUnLocked(place))
+                                {
+                                    if (selectLevel == level && selectPlace == place)
+                                    {
+                                        return jumpIndex;
+                                    }
+                                    jumpIndex++;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            return 0;
+        }
 
         private void OnClickStrengBtn()
         {
@@ -310,6 +354,15 @@
         {
             strengthModel.SelectLevel = -1;
             strengthModel.SelectEquipPlace = -1;
+
+            if (!strengthModel.jumpEquipPosition.Equals(Int2.zero))
+            {
+                strengthModel.SelectLevel = strengthModel.jumpEquipPosition.x;
+                strengthModel.SelectEquipPlace = strengthModel.jumpEquipPosition.y;
+                strengthModel.jumpEquipPosition = Int2.zero;
+                return;
+            }
+
             var equipSets = equipModel.GetAllEquipSets();
             foreach (var level in equipSets)
             {
diff --git a/System/KnapSack/Logic/ItemOperateUtility.cs b/System/KnapSack/Logic/ItemOperateUtility.cs
index 02e4e15..6308d54 100644
--- a/System/KnapSack/Logic/ItemOperateUtility.cs
+++ b/System/KnapSack/Logic/ItemOperateUtility.cs
@@ -740,6 +740,13 @@
 
         public void GotoStrengthen(string guid)
         {
+            var item = packModel.GetItemByGuid(guid);
+            if (item == null)
+            {
+                return;
+            }
+            var equipStrengthModel = ModelCenter.Instance.GetModel<EquipStrengthModel>();
+            equipStrengthModel.jumpEquipPosition = new Int2(item.config.LV, item.config.EquipPlace);
             WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StrengthFunc1);
         }
 

--
Gitblit v1.8.0