Browse Source

主界面列表动画

zhaoyang 2 years ago
parent
commit
2ac47229cc
1 changed files with 4 additions and 3 deletions
  1. 4 3
      GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

+ 4 - 3
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -308,12 +308,13 @@ namespace GFGGame
             {
                 if (_ui.m_list.GetChildAt(i).visible == true) count++;
             }
-            float height = count * (97 + 20);
+            int oneItemHeight = 97 + _ui.m_list.lineGap;
+            float height = count * oneItemHeight;
             if (_ui.m_btnChange.target.selected == true)
             {
                 _ui.m_btnChange.m_c1.selectedIndex = 1;
 
-                GTween.To(0, height, 0.4f).SetTarget(_ui.m_list)
+                GTween.To(_ui.m_list.height, height, 0.4f).SetTarget(_ui.m_list)
                 .OnUpdate((GTweener t) =>
                 {
                     _ui.m_list.height = t.value.x;
@@ -325,7 +326,7 @@ namespace GFGGame
             {
                 _ui.m_btnChange.m_c1.selectedIndex = 0;
 
-                GTween.To(height, 0, 0.4f).SetTarget(_ui.m_list)
+                GTween.To(_ui.m_list.height, oneItemHeight, 0.4f).SetTarget(_ui.m_list)
                 .OnUpdate((GTweener t) =>
                 {
                     _ui.m_list.height = t.value.x;