Ver Fonte

UI动画体验优化

guodong há 1 ano atrás
pai
commit
d263156d29

+ 2 - 2
GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

@@ -202,8 +202,8 @@ namespace GFGGame
             }
             if(locations.Count == 0)
             {
-                _steps = EDressUpSteps.Done;
-                Status = EOperationStatus.Succeed;
+                //文件已在本地,不需要下载
+                CheckPreDraw();
                 return;
             }
             locationsLoading = locations.ToArray();

+ 13 - 17
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/NewLimitChargeView.cs

@@ -1,4 +1,3 @@
-using UI.Store;
 using UI.CommonGame;
 using FairyGUI;
 using System.Collections.Generic;
@@ -13,7 +12,6 @@ namespace GFGGame
     {
         private UI_NewLimitChargeUI _ui;
         private List<ShopCfg> _shopCfgs;
-        private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
         private int _curSelectIndex = 0;
 
         private int _activityId = 0;
@@ -24,14 +22,6 @@ namespace GFGGame
 
         public override void Dispose()
         {
-            for (int i = 0; i < _dressUpObjUIs.Count; i++)
-            {
-                if (_dressUpObjUIs[i] != null)
-                {
-                    _dressUpObjUIs[i].Dispose();
-                    _dressUpObjUIs[i] = null;
-                }
-            }
             if (_ui != null)
             {
                 _ui.Dispose();
@@ -114,6 +104,13 @@ namespace GFGGame
         protected override void OnHide()
         {
             base.OnHide();
+            DressUpObjUI dressUpObjUI = _ui.m_showItem.m_holder.data as DressUpObjUI;
+            if(dressUpObjUI != null)
+            {
+                dressUpObjUI.Dispose();
+            }
+            _ui.m_showItem.m_holder.data = null;
+            previousIndex = 0;
             Timers.inst.Remove(UpdateTime);
         }
         protected override void RemoveEventListener()
@@ -159,16 +156,15 @@ namespace GFGGame
 
             if (_rechargeCfgs[index].suitId != previousIndex)
             {
+                DressUpObjUI dressUpObjUI;
                 if (item.m_holder.data == null)
                 {
-                    DressUpObjUI dressUpObjUI = new DressUpObjUI("SceneSuitFoster");
-                    item.m_holder.data = dressUpObjUI;
-                    _dressUpObjUIs.Add(dressUpObjUI);
+                    item.m_holder.data = new DressUpObjUI("SceneSuitFoster");
                 }
-                DressUpObjUI _dressUpObjUI = item.m_holder.data as DressUpObjUI;
-                _dressUpObjUI.ResetSceneObj(120, false, true, null, false);
-                    _dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
-                _dressUpObjUI.UpdateWrapper(item.m_holder);
+                dressUpObjUI = item.m_holder.data as DressUpObjUI;
+                dressUpObjUI.ResetSceneObj(120, false, true, null, false);
+                    dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
+                dressUpObjUI.UpdateWrapper(item.m_holder);
             }
             previousIndex = _rechargeCfgs[index].suitId;
 

+ 23 - 9
GameClient/Assets/Game/HotUpdate/Views/Store/StoreChargeAddUpView.cs

@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using ET;
 using System;
 using Hutool;
+using UnityEngine;
 
 namespace GFGGame
 {
@@ -16,6 +17,8 @@ namespace GFGGame
         private DressUpObjUI _dressUpObjUI;
         private List<DressUpObjUI> _dressUpObjUIs = new List<DressUpObjUI>();
         private int _curSelectIndex = 0;
+        //按钮锁定一段时间,防止点太快
+        private float _leftRightBtnLockEndTime = 0;
 
         public override void Dispose()
         {
@@ -103,10 +106,14 @@ namespace GFGGame
 
         private void RefreshList()
         {
-            _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length - 1;
+            //这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
+            _ui.m_list.numItems = VipCfgArray.Instance.dataArray.Length;
         }
         private void ListItemRenderer(int index, GObject obj)
         {
+            //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
+            index--;
+            if (index < 0) index = 0;
             VipCfg lastVipCfg = VipCfgArray.Instance.dataArray[index];
             VipCfg vipCfg = VipCfgArray.Instance.dataArray[index + 1];
             UI_ListVipItem item = UI_ListVipItem.Proxy(obj);
@@ -219,26 +226,35 @@ namespace GFGGame
 
         private void OnBtnLeftClick()
         {
-
+            //LogUtil.LogDev($"OnBtnLeftClick _curSelectIndex {_curSelectIndex}");
+            if (_leftRightBtnLockEndTime > Time.time) return;
             if (_curSelectIndex == 0) return;
             _curSelectIndex = _curSelectIndex - 1;
-            _ui.m_list.ScrollToView(_curSelectIndex, true);
-            UpdateRedDot();
+            //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
+            _curSelectIndex = Mathf.Min(_curSelectIndex, _ui.m_list.numItems - 3);
+            _ui.m_list.ScrollToView(_curSelectIndex, true, true);
+            _leftRightBtnLockEndTime = Time.time + 0.2f;
         }
         private void OnBtnRightClick()
         {
+            //LogUtil.LogDev($"OnBtnRightClick _curSelectIndex {_curSelectIndex}");
+            if (_leftRightBtnLockEndTime > Time.time) return;
             if (_curSelectIndex == _ui.m_list.numItems - 1) return;
             _curSelectIndex = _curSelectIndex + 1;
-            _ui.m_list.ScrollToView(_curSelectIndex, true);
-            UpdateRedDot();
+            _ui.m_list.ScrollToView(_curSelectIndex, true, true);
+            _leftRightBtnLockEndTime = Time.time + 0.2f;
 
         }
         private void UpdateSuitView()
         {
             _curSelectIndex = _ui.m_list.GetFirstChildInView();
+            //LogUtil.LogDev($"UpdateSuitView _curSelectIndex {_curSelectIndex}");
             _ui.m_list.selectedIndex = _curSelectIndex;
             _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
-            _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 1 ? true : false;
+
+            //索引修复,这个列表用了特殊的做法,左边屏幕外添加了一个无用的项
+            _ui.m_btnRight.visible = _curSelectIndex < _ui.m_list.numItems - 2 ? true : false;
+            UpdateRedDot();
         }
 
         private void UpdateRedDot()
@@ -255,12 +271,10 @@ namespace GFGGame
                 if (red && _curSelectIndex > i - 1)
                 {
                     leftRed = true;
-                    break;
                 }
                 if (red && _curSelectIndex + 1 < i)
                 {
                     rightRed = true;
-                    break;
                 }
             }
 

BIN
GameClient/Assets/ResIn/UI/Store/Store_fui.bytes