Просмотр исходного кода

套装部件列表返回套装列表自动选中套装

zhaoyang 3 лет назад
Родитель
Сommit
d50e138214

+ 20 - 0
GameClient/Assets/Game/HotUpdate/DressUp/DressUpObjDataCache.cs

@@ -606,5 +606,25 @@ namespace GFGGame
             float rangeY = UnityEngine.Random.Range(0, range);
             y = pos.y + signY * (rangeY);
         }
+
+        public int GetItemIdBuyType(int subType)
+        {
+            for (int i = 0; i < equipDatas.Count; i++)
+            {
+                if (equipDatas[i] != ConstItemID.DEFULT_LIAN_YI_QUN && equipDatas[i] != ConstItemID.DEFULT_NEI_DA && equipDatas[i] != ConstItemID.DEFULT_XIA_ZHUANG && equipDatas[i] != ConstItemID.DEFULT_FA_XING)
+                {
+                    if (subType == ItemUtilCS.GetItemSubType(equipDatas[i]))
+                    {
+                        return equipDatas[i];
+                    }
+
+                }
+            }
+            if (suitId > 0)
+            {
+                return suitId;
+            }
+            return 0;
+        }
     }
 }

+ 11 - 2
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -285,7 +285,7 @@ namespace GFGGame
             if (this.currentListType == DressUpListType.List4)
             {
                 this.hideListParts2();
-                this.showListParts(ConstDressUpItemType.TAO_ZHUANG);
+                this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
             }
             else if (this.currentListType == DressUpListType.List3)
             {
@@ -431,7 +431,7 @@ namespace GFGGame
                 });
         }
 
-        private void showListParts(int type)
+        private void showListParts(int type, bool selectItem = false)
         {
             _currentMenuType = type;
 
@@ -442,6 +442,15 @@ namespace GFGGame
             {
                 _ui.m_partsList.m_list.height = maxHeight;
             }
+            if (selectItem)
+            {
+                int itemId = EquipDataCache.cacher.GetItemIdBuyType(_currentMenuType);
+                if (itemId > 0)
+                {
+                    int index = _currentList3.IndexOf(itemId);
+                    _ui.m_partsList.m_list.ScrollToView(index);
+                }
+            }
             currentListType = DressUpListType.List3;
             GTween.To(_ui.target.width, partsListX, 0.5f)
                 .SetTarget(_ui.m_partsList)

+ 11 - 3
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpView.cs

@@ -219,7 +219,7 @@ namespace GFGGame
             if (this.currentListType == DressUpListType.List4)
             {
                 this.hideListParts2();
-                this.showListParts(ConstDressUpItemType.TAO_ZHUANG);
+                this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
             }
             else if (this.currentListType == DressUpListType.List3)
             {
@@ -346,7 +346,7 @@ namespace GFGGame
                 });
         }
 
-        private void showListParts(int type)
+        private void showListParts(int type, bool selectItem = false)
         {
             _currentMenuType = type;
             if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
@@ -368,6 +368,15 @@ namespace GFGGame
             {
                 _ui.m_partsList.m_list.height = maxHeight;
             }
+            if (selectItem)
+            {
+                int itemId = EquipDataCache.cacher.GetItemIdBuyType(_currentMenuType);
+                if (itemId > 0)
+                {
+                    int index = _currentList3.IndexOf(itemId);
+                    _ui.m_partsList.m_list.ScrollToView(index);
+                }
+            }
             currentListType = DressUpListType.List3;
             GTween.To(_ui.target.width, partsListX, 0.5f)
                 .SetTarget(_ui.m_partsList)
@@ -610,7 +619,6 @@ namespace GFGGame
 
             _ui.m_partsList.m_list.RemoveChildrenToPool();
             _ui.m_partsList.m_list.numItems = _currentList3.Count;
-
         }
 
         private void UpdateSuitPartsListSort()