From 99ec4075b3cf616d4047c830175be62221ef7104 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期六, 22 九月 2018 00:05:30 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Dungeon/TrialExchangeWin.cs |   71 ++++++++++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/System/Dungeon/TrialExchangeWin.cs b/System/Dungeon/TrialExchangeWin.cs
index 8dc8e8d..96b6686 100644
--- a/System/Dungeon/TrialExchangeWin.cs
+++ b/System/Dungeon/TrialExchangeWin.cs
@@ -82,6 +82,7 @@
             model.SelectEquipClassEvent += SelectEquipClassEvent;
             packModel.RefreshItemCountAct += RefreshItemCountAct;
             Display();
+            JumpToRedpoint();
         }
 
         protected override void OnAfterOpen()
@@ -170,10 +171,18 @@
 
         private void RefreshItemCountAct(PackType packtype, int arg2, int itemId)
         {
-            if (packtype == PackType.rptItem && model.trialTokens.Contains(itemId))
+            var config = Config.Instance.Get<ItemConfig>(itemId);
+            if (config == null)
             {
-                m_Controller.m_Scorller.RefreshActiveCellViews();
-                DisplayTokens();
+                return;
+            }
+            if (packtype == PackType.rptItem)
+            {
+                if (model.trialTokens.Contains(itemId) || config.EquipPlace > 0)
+                {
+                    m_Controller.m_Scorller.RefreshActiveCellViews();
+                    DisplayTokens();
+                }
             }
             else if (packtype == PackType.rptEquip)
             {
@@ -215,6 +224,62 @@
             DisplayTokens();
             bool _up = m_SelectClassBehaviour.gameObject.activeSelf;
             m_SelectClassUp.transform.localEulerAngles = Vector3.zero.SetZ(_up ? 0 : 180);
+            JumpToRedpoint();
+        }
+
+        private void JumpToRedpoint()
+        {
+            if (model.selectEquipClass == 1)
+            {
+                var trialClasses = model.GetTotalClass();
+                var index = 0;
+                for (int i = 0; i < trialClasses.Count; i++)
+                {
+                    var line = 0;
+                    index += 1;
+                    if (JumpToRedpoint(trialClasses[i], out line))
+                    {
+                        m_Controller.JumpIndex(index + line);
+                        return;
+                    }
+                    else
+                    {
+                        List<TrialExchangeConfig> list;
+                        if (model.TryGetTrialExchanges(trialClasses[i], out list))
+                        {
+                            index += Mathf.CeilToInt((float)list.Count / 3);
+                        }
+                    }
+                }
+            }
+            else
+            {
+                var line = 0;
+                JumpToRedpoint(model.selectEquipClass, out line);
+                m_Controller.JumpIndex(line);
+            }
+        }
+
+        private bool JumpToRedpoint(int _class, out int line)
+        {
+            var itemId = 0;
+            line = 0;
+            if (model.IsAnySatisfyExchangeBetterEquip(_class, out itemId))
+            {
+                List<TrialExchangeConfig> list;
+                if (model.TryGetTrialExchanges(_class, out list))
+                {
+                    for (int i = 0; i < list.Count; i++)
+                    {
+                        if (list[i].id == itemId)
+                        {
+                            line = i / 3;
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
         }
     }
 

--
Gitblit v1.8.0