From b40605ecf3ed374f208d985c4c141a4b01b1fdf1 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期三, 10 十月 2018 20:48:15 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Treasure/UI3DTreasureSelectStage.cs |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/System/Treasure/UI3DTreasureSelectStage.cs b/System/Treasure/UI3DTreasureSelectStage.cs
index 2ac024b..00ea3a4 100644
--- a/System/Treasure/UI3DTreasureSelectStage.cs
+++ b/System/Treasure/UI3DTreasureSelectStage.cs
@@ -219,6 +219,7 @@
         private Dictionary<TreasureCategory, List<TreasureComponent>> m_Treasures = new Dictionary<TreasureCategory, List<TreasureComponent>>();
         private Dictionary<TreasureCategory, bool> m_PreloadDict = new Dictionary<TreasureCategory, bool>();
 
+        Coroutine preloadCoroutine = null;
         private void InitTreasure()
         {
             Load(TreasureCategory.Human);
@@ -417,6 +418,12 @@
             HideAllTreasure();
             InitScene();
 
+            if (preloadCoroutine != null)
+            {
+                StopCoroutine(preloadCoroutine);
+                preloadCoroutine = null;
+            }
+
             if (!m_PreloadDict.ContainsKey(currentCategory) && !_closer)
             {
                 Preloading = true;
@@ -424,15 +431,16 @@
                 current_angle = 0;
                 before_angle = 0;
                 before_drag_angle = current_angle;
-                StartCoroutine(Co_PreLoad(currentCategory, () =>
-                {
-                    if (!m_PreloadDict.ContainsKey(currentCategory))
-                    {
-                        m_PreloadDict.Add(currentCategory, true);
-                    }
-                    GoTreasureFromHeader(_index);
-                    Preloading = false;
-                }));
+                preloadCoroutine = StartCoroutine(Co_PreLoad(currentCategory, () =>
+                  {
+                      if (!m_PreloadDict.ContainsKey(currentCategory))
+                      {
+                          m_PreloadDict.Add(currentCategory, true);
+                      }
+                      GoTreasureFromHeader(_index);
+                      Preloading = false;
+                      preloadCoroutine = null;
+                  }));
             }
             else
             {
@@ -596,6 +604,10 @@
         public void Goto(int _index, bool _force = false)
         {
             var _list = m_Treasures[currentCategory];
+            if (_index < 0 || _index >= _list.Count)
+            {
+                _index = 0;
+            }
             jumpTreasure = _list[_index].treasureId;
             if (!_force && _index == presentSelectIndex)
             {

--
Gitblit v1.8.0