Browse Source

换装套装列表滚动位置

zhaoyang 2 years ago
parent
commit
6aaa32e1cb

+ 5 - 10
GameClient/Assets/Game/HotUpdate/Views/DressUp/ArenaDressUpFightView.cs

@@ -20,6 +20,7 @@ namespace GFGGame
         public List<int> _itemList;//记录打开界面时的穿戴数据(保存后会更新)
         private float listType1X = 0;
         private float partsListX = 0;
+        private float partsListScrollingPosY = 0;
         private DressUpListType currentListType;
         private int[] _currentList2;
         private GameObject _scenePrefab;
@@ -318,6 +319,7 @@ namespace GFGGame
             int id = (int)listItem.data;
             if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
+                partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
                 this.showListParts2(id);
                 this.hideListParts();
                 MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
@@ -557,17 +559,10 @@ namespace GFGGame
             {
                 _ui.m_partsList.m_list.height = maxHeight;
             }
-            if (selectItem)
+            if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
-                int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
-                if (itemId > 0)
-                {
-                    int index = _currentList3.IndexOf(itemId);
-                    if (index >= 0 && index < _ui.m_partsList.m_list.numItems)
-                    {
-                        _ui.m_partsList.m_list.ScrollToView(index);
-                    }
-                }
+                _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
+                partsListScrollingPosY = 0;
             }
             currentListType = DressUpListType.List3;
             GTween.To(_ui.target.width, partsListX, 0.5f)

+ 6 - 10
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -15,6 +15,7 @@ namespace GFGGame
         private int _levelID;
         private float listType1X = 0;
         private float partsListX = 0;
+        private float partsListScrollingPosY = 0;
         private DressUpListType currentListType;
         private int[] _currentList2;
         private GameObject _scenePrefab;
@@ -371,6 +372,7 @@ namespace GFGGame
             int id = (int)listItem.data;
             if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
+                partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
                 this.showListParts2(id);
                 this.hideListParts();
                 MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
@@ -691,17 +693,11 @@ namespace GFGGame
             {
                 _ui.m_partsList.m_list.height = maxHeight;
             }
-            if (selectItem)
+
+            if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
-                int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
-                if (itemId > 0)
-                {
-                    int index = _currentList3.IndexOf(itemId);
-                    if (index >= 0 && index < _ui.m_partsList.m_list.numItems)
-                    {
-                        _ui.m_partsList.m_list.ScrollToView(index);
-                    }
-                }
+                _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
+                partsListScrollingPosY = 0;
             }
             currentListType = DressUpListType.List3;
             GTween.To(_ui.target.width, partsListX, 0.5f)

+ 8 - 20
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpView.cs

@@ -18,6 +18,7 @@ namespace GFGGame
         private UI_DressUpUI _ui;
         private float listType1X = 0;
         private float partsListX = 0;
+        private float partsListScrollingPosY = 0;
         private DressUpListType currentListType;
         /// <summary>
         /// 子菜单列表
@@ -34,8 +35,7 @@ namespace GFGGame
         private UI_TypeItem listTypeItem_FreedomDress;
         private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
         private int currentIndex = 0;
-        // private int _stepIndex = -1;
-        // private List<DressUpData> _dressMemory = new List<DressUpData>();
+
         public override void Dispose()
         {
             if (_sceneObject != null)
@@ -294,6 +294,7 @@ namespace GFGGame
             if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
             {
                 isDress = false;
+                partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
 
                 if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0 && GuideDataManager.currentGuideId == GuideCfgArray.Instance.GetCfg(ConstGuideId.FREEDOM_DRESS).id)
                 {
@@ -571,26 +572,13 @@ namespace GFGGame
             {
                 _ui.m_partsList.m_list.height = maxHeight;
             }
-            if (selectItem)
+
+            if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
-                int itemId = 0;
-                if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
-                {
-                    itemId = _currentSuitId;
-                }
-                else
-                {
-                    itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
-                }
-                if (itemId > 0)
-                {
-                    int index = _currentList3.IndexOf(itemId);
-                    if (index >= 0 && index < _ui.m_partsList.m_list.numItems)
-                    {
-                        _ui.m_partsList.m_list.ScrollToView(index);
-                    }
-                }
+                _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
+                partsListScrollingPosY = 0;
             }
+
             currentListType = DressUpListType.List3;
             GTween.To(_ui.target.width, partsListX, 0.5f)
                 .SetTarget(_ui.m_partsList)