From f8ebc6dabe6d4d5ed32fc4322f0aa8ae6214311d Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 17 五月 2019 21:05:51 +0800
Subject: [PATCH] Merge branch 'master' into ClientPreciousDungeon

---
 System/MainWin/HighSettingFadeInFadeOut.cs |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/System/MainWin/HighSettingFadeInFadeOut.cs b/System/MainWin/HighSettingFadeInFadeOut.cs
index 8223a16..ccd1e3d 100644
--- a/System/MainWin/HighSettingFadeInFadeOut.cs
+++ b/System/MainWin/HighSettingFadeInFadeOut.cs
@@ -29,6 +29,7 @@
         State state = State.Closed;
 
         float closeTimer = 0f;
+        int openedFunctionCount = 0;
 
         TreasureFindHostModel hostModel { get { return ModelCenter.Instance.GetModel<TreasureFindHostModel>(); } }
         LimitedTimePackageItemClassModel limitedTimePackageItemModel { get { return ModelCenter.Instance.GetModel<LimitedTimePackageItemClassModel>(); } }
@@ -38,6 +39,9 @@
         void Start()
         {
             m_Switch.SetListener(() => { Switch(state == State.Closed); });
+            openedFunctionCount = 0;
+            openedFunctionCount += CountOpenedFunction(m_GridGroup1);
+            openedFunctionCount += CountOpenedFunction(m_GridGroup2);
             SwitchImmedidately(false);
         }
 
@@ -80,7 +84,7 @@
             var index = 0;
             foreach (var grid in m_GridGroup1)
             {
-                if (!grid.alwayShow)
+                if (!grid.alwayShow && openedFunctionCount > 5)
                 {
                     grid.Switch(active, 0, 0f);
                 }
@@ -94,7 +98,7 @@
             index = 0;
             foreach (var grid in m_GridGroup2)
             {
-                if (!grid.alwayShow)
+                if (!grid.alwayShow && openedFunctionCount > 5)
                 {
                     var offset = (index / 6) + 1;
                     grid.Switch(active, offset * (m_GridSize.y + m_Space.y), offset * 0.1f);
@@ -118,7 +122,11 @@
         {
             foreach (var grid in m_GridGroup1)
             {
-                if (!grid.alwayShow)
+                if (grid.alwayShow || openedFunctionCount <= 5)
+                {
+                    grid.SwitchImmediately(true, 0);
+                }
+                else
                 {
                     grid.SwitchImmediately(active, 0);
                 }
@@ -127,7 +135,11 @@
             var index = 0;
             foreach (var grid in m_GridGroup2)
             {
-                if (!grid.alwayShow)
+                if (grid.alwayShow || openedFunctionCount <= 5)
+                {
+                    grid.SwitchImmediately(true, ((index / 6) + 1) * (m_GridSize.y + m_Space.y));
+                }
+                else
                 {
                     grid.SwitchImmediately(active, ((index / 6) + 1) * (m_GridSize.y + m_Space.y));
                 }
@@ -210,6 +222,10 @@
 
         private void RefreshGridsActiveState()
         {
+            openedFunctionCount = 0;
+            openedFunctionCount += CountOpenedFunction(m_GridGroup1);
+            openedFunctionCount += CountOpenedFunction(m_GridGroup2);
+
             ActiveGroup(m_GridGroup1);
             ActiveGroup(m_GridGroup2);
             LayoutGroup(m_GridGroup1, m_GroupContainer1);
@@ -220,6 +236,11 @@
 
         bool IsShowButton()
         {
+            if (openedFunctionCount <= 5)
+            {
+                return false;
+            }
+
             foreach (var grid in m_GridGroup1)
             {
                 if (!grid.alwayShow && grid.gameObject.activeSelf)
@@ -261,6 +282,18 @@
             m_ArrowClose.gameObject.SetActive(state == State.Closed);
         }
 
+        int CountOpenedFunction(MainWinTopGrid[] grids)
+        {
+            var count = 0;
+            foreach (var grid in grids)
+            {
+                var active = grid.IsOpen();
+                count += active ? 1 : 0;
+            }
+
+            return count;
+        }
+
         void ActiveGroup(MainWinTopGrid[] grids)
         {
             foreach (var grid in grids)
@@ -271,6 +304,11 @@
                     grid.gameObject.SetActive(true);
                 }
 
+                if (grid.gameObject.activeSelf && (grid.alwayShow || openedFunctionCount <= 5))
+                {
+                    grid.SwitchImmediately(true, 0);
+                }
+
                 if (!active && grid.gameObject.activeSelf)
                 {
                     grid.gameObject.SetActive(false);

--
Gitblit v1.8.0