Forráskód Böngészése

换装上一步下一步

zhaoyang 2 éve
szülő
commit
0857a12ea8

+ 2 - 2
FGUIProject/assets/DressUp/DressUpUI.xml

@@ -64,10 +64,10 @@
       <gearDisplay controller="c2" pages="0"/>
       <Button icon="ui://mbo439wbq08xm"/>
     </component>
-    <component id="n20_f4xv" name="btnLastStep" src="f4xv3o" fileName="components/Button6.xml" xy="56,1464" group="n34_wono" visible="false">
+    <component id="n20_f4xv" name="btnLastStep" src="f4xv3o" fileName="components/Button6.xml" xy="56,1326" group="n34_wono" visible="false">
       <Button icon="ui://mbo439wbq08x6"/>
     </component>
-    <component id="n21_f4xv" name="btnNextStep" src="f4xv3o" fileName="components/Button6.xml" xy="56,1578" group="n34_wono" visible="false">
+    <component id="n21_f4xv" name="btnNextStep" src="f4xv3o" fileName="components/Button6.xml" xy="56,1468" group="n34_wono" visible="false">
       <Button icon="ui://mbo439wbq08xl"/>
     </component>
     <component id="n29_8lqj" name="btnHide" src="f4xv3o" fileName="components/Button6.xml" xy="56,1326" group="n34_wono">

+ 43 - 117
GameClient/Assets/Game/HotUpdate/DressUp/MyDressUpHelper.cs

@@ -18,6 +18,10 @@ namespace GFGGame
                 return _dressUpObj;
             }
         }
+        private static int _stepIndex = -1;
+        public static int stepIndex { get { return _stepIndex; } }
+        private static List<DressUpData> _dressMemory = new List<DressUpData>();
+        public const int MAX_MEMORY_STEP = 20;//最大记录步数
 
         public static CustomSuitData GetCurSuitDataClone(int index)
         {
@@ -64,7 +68,7 @@ namespace GFGGame
                 {
                     isShangYi = true;
                 }
-                if(itemCfg.subType == ConstDressUpItemType.NEI_DA && itemCfg.id != ConstItemID.DEFULT_NEI_DA)
+                if (itemCfg.subType == ConstDressUpItemType.NEI_DA && itemCfg.id != ConstItemID.DEFULT_NEI_DA)
                 {
                     isShangYi = true;
                 }
@@ -111,113 +115,6 @@ namespace GFGGame
             return count;
         }
 
-        // public static void PutOnRecommendItems()
-        // {
-        //     List<int> recommendList = DressUpMenuItemDataManager.GetRecommendItemList();
-        //     StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
-        //     StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
-        //     int liangyiqunIndex = -1;
-        //     int shangyiIndex = -1;
-        //     int xiazhuangIndex = -1;
-        //     int neidaIndex = -1;
-        //     for (int i = 0; i < recommendList.Count; i++)
-        //     {
-        //         int subType = ItemUtilCS.GetItemSubType(recommendList[i]);
-        //         if (subType == ConstDressUpItemType.LIAN_YI_QUN)
-        //         {
-        //             liangyiqunIndex = i;
-        //             continue;
-        //         }
-        //         if (subType == ConstDressUpItemType.SHANG_YI)
-        //         {
-        //             shangyiIndex = i;
-        //             continue;
-        //         }
-        //         if (subType == ConstDressUpItemType.XIA_ZHUANG)
-        //         {
-        //             xiazhuangIndex = i;
-        //             continue;
-        //         }
-        //         if (subType == ConstDressUpItemType.NEI_DA)
-        //         {
-        //             neidaIndex = i;
-        //             continue;
-
-        //         }
-        //     }
-
-        //     if (liangyiqunIndex >= 0 && (shangyiIndex >= 0 || xiazhuangIndex >= 0))
-        //     {
-        //         if (shangyiIndex < 0 && xiazhuangIndex >= 0) recommendList.RemoveAt(xiazhuangIndex);//上衣下装只有一件,则保留连衣裙
-        //         if (xiazhuangIndex < 0 && shangyiIndex >= 0) recommendList.RemoveAt(shangyiIndex);
-
-        //         if (shangyiIndex >= 0 && xiazhuangIndex >= 0)//同时拥有上衣、下装、连衣裙
-        //         {
-        //             int lianyiqunScore = ItemDataManager.GetItemAdditionScore(recommendList[liangyiqunIndex], InstanceZonesDataManager.currentScoreType);
-        //             int shangyiScore = ItemDataManager.GetItemAdditionScore(recommendList[shangyiIndex], InstanceZonesDataManager.currentScoreType);
-        //             int xiazhuangScore = ItemDataManager.GetItemAdditionScore(recommendList[xiazhuangIndex], InstanceZonesDataManager.currentScoreType);
-        //             int neidaScore = neidaIndex >= 0 ? ItemDataManager.GetItemAdditionScore(recommendList[neidaIndex], InstanceZonesDataManager.currentScoreType) : 0;
-        //             int subType = ItemUtilCS.GetItemSubType(fightCfg.needItemId);
-        //             if (fightCfg.needItemId > 0 && recommendList.IndexOf(fightCfg.needItemId) >= 0 && (subType == ConstDressUpItemType.SHANG_YI || subType == ConstDressUpItemType.XIA_ZHUANG || subType == ConstDressUpItemType.NEI_DA || subType == ConstDressUpItemType.LIAN_YI_QUN))//推荐列表里有必需品且,必需品类型为上衣或下装或连衣裙,有先穿戴必须品,其次穿戴高分服装
-        //             {
-        //                 if (subType == ConstDressUpItemType.LIAN_YI_QUN)
-        //                 {
-        //                     shangyiIndex = CheckIndex(ConstDressUpItemType.SHANG_YI, recommendList);
-        //                     if (shangyiIndex >= 0) recommendList.RemoveAt(shangyiIndex);
-        //                     xiazhuangIndex = CheckIndex(ConstDressUpItemType.XIA_ZHUANG, recommendList);
-        //                     if (xiazhuangIndex >= 0) recommendList.RemoveAt(xiazhuangIndex);
-        //                     neidaIndex = CheckIndex(ConstDressUpItemType.NEI_DA, recommendList);
-        //                     if (neidaIndex >= 0) recommendList.RemoveAt(neidaIndex);
-        //                 }
-        //                 else if (subType == ConstDressUpItemType.SHANG_YI || subType == ConstDressUpItemType.XIA_ZHUANG || subType == ConstDressUpItemType.NEI_DA)
-        //                 {
-        //                     liangyiqunIndex = CheckIndex(ConstDressUpItemType.LIAN_YI_QUN, recommendList);
-        //                     if (liangyiqunIndex >= 0) recommendList.RemoveAt(liangyiqunIndex);
-        //                 }
-        //             }
-        //             else
-        //             {
-        //                 if (lianyiqunScore > shangyiScore + xiazhuangScore + neidaScore)
-        //                 {
-        //                     shangyiIndex = CheckIndex(ConstDressUpItemType.SHANG_YI, recommendList);
-        //                     if (shangyiIndex >= 0) recommendList.RemoveAt(shangyiIndex);
-        //                     xiazhuangIndex = CheckIndex(ConstDressUpItemType.XIA_ZHUANG, recommendList);
-        //                     if (xiazhuangIndex >= 0) recommendList.RemoveAt(xiazhuangIndex);
-        //                     neidaIndex = CheckIndex(ConstDressUpItemType.NEI_DA, recommendList);
-        //                     if (neidaIndex >= 0) recommendList.RemoveAt(neidaIndex);
-        //                 }
-        //                 else
-        //                 {
-        //                     liangyiqunIndex = CheckIndex(ConstDressUpItemType.LIAN_YI_QUN, recommendList);
-        //                     if (liangyiqunIndex >= 0) recommendList.RemoveAt(liangyiqunIndex);
-        //                 }
-        //             }
-        //         }
-        //     }
-        //     //推荐搭配自动穿必穿品
-        //     if (fightCfg.needItemId > 0 && DressUpMenuItemDataManager.CheckHasItem(fightCfg.needItemId) && recommendList.IndexOf(fightCfg.needItemId) < 0)
-        //     {
-        //         int subType = ItemUtilCS.GetItemSubType(fightCfg.needItemId);
-        //         for (int i = 0; i < recommendList.Count; i++)
-        //         {
-        //             int recommendSubType = ItemUtilCS.GetItemSubType(recommendList[i]);
-        //             if (recommendSubType == subType)
-        //             {
-        //                 recommendList.RemoveAt(i);
-        //                 break;
-        //             }
-        //         }
-        //         recommendList.Add(fightCfg.needItemId);
-        //     }
-        //     else if (fightCfg.needSuitId > 0 && DressUpMenuSuitDataManager.CheckHaveSuit(fightCfg.needSuitId))
-        //     {
-        //         recommendList.Clear();
-        //         SuitCfg cfg = SuitCfgArray.Instance.GetCfg(fightCfg.needSuitId);
-        //         recommendList.AddRange(cfg.partsArr);
-        //     }
-        //     dressUpObj.PutOnItemList(recommendList);
-        // }
-
         public static void PutOnRecommendItems2()
         {
             Dictionary<int, List<int>> itemsDic = GetRecommendItems();
@@ -421,19 +318,48 @@ namespace GFGGame
             items.AddRange(ornamentItems);
             return items;
         }
-        private static int CheckIndex(int _subType, List<int> recommendList)
+
+
+        public static bool OnClickBtnLastStep()
         {
-            for (int i = 0; i < recommendList.Count; i++)
-            {
-                int itemSubType = ItemUtilCS.GetItemSubType(recommendList[i]);
-                if (itemSubType == _subType)
-                {
-                    return i;
+            if (_stepIndex - 1 < 0) return false;
+            _stepIndex--;
+            MyDressUpHelper.dressUpObj.PutOnDressUpData(_dressMemory[_stepIndex]);
+            // _ui.m_comboBox.selectedIndex = _dressMemory[_stepIndex].pos;
+            // UpdateStepBtn();
+            return true;
+        }
+        public static bool OnClickBtnNextStep()
+        {
+            if (_stepIndex + 1 >= MAX_MEMORY_STEP) return false;
+            _stepIndex++;
+            MyDressUpHelper.dressUpObj.PutOnDressUpData(_dressMemory[_stepIndex]);
+            // _ui.m_comboBox.selectedIndex = _dressMemory[_stepIndex].pos;
+            // UpdateStepBtn();
+            return true;
+        }
 
-                }
+        public static void AddMemoryDressup()
+        {
+            _stepIndex++;
+            if (_stepIndex == MAX_MEMORY_STEP)
+            {
+                _stepIndex = MAX_MEMORY_STEP - 1;
+                _dressMemory.RemoveAt(0);
+            }
+            if (_dressMemory.Count > _stepIndex)
+            {
+                _dressMemory.RemoveRange(_stepIndex, _dressMemory.Count - _stepIndex);
             }
-            return -1;
+            _dressMemory.Add(MyDressUpHelper.dressUpObj.DressUpDataClone());
+            // UpdateStepBtn();
         }
 
+        public static void ResetMemory()
+        {
+            DressUpMenuItemDataManager.Clear();
+            _stepIndex = -1;
+            _dressMemory.Clear();
+        }
     }
 }

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

@@ -34,8 +34,8 @@ namespace GFGGame
         private UI_TypeItem listTypeItem_FreedomDress;
         private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
         private int currentIndex = 0;
-        private int _stepIndex = -1;
-        private List<CustomSuitData> _dressMemory = new List<CustomSuitData>();
+        // private int _stepIndex = -1;
+        // private List<DressUpData> _dressMemory = new List<DressUpData>();
         public override void Dispose()
         {
             if (_sceneObject != null)
@@ -206,23 +206,16 @@ namespace GFGGame
         private void Reset()
         {
             DressUpMenuItemDataManager.Clear();
-            _stepIndex = -1;
-            _dressMemory.Clear();
+            MyDressUpHelper.ResetMemory();
         }
         private void OnClickBtnLastStep()
         {
-            if (_stepIndex - 1 < 0) return;
-            _stepIndex--;
-            MyDressUpHelper.dressUpObj.PutOnDressUpData(_dressMemory[_stepIndex].dressUpData);
-            _ui.m_comboBox.selectedIndex = _dressMemory[_stepIndex].pos;
+            if (!MyDressUpHelper.OnClickBtnLastStep()) return;
             UpdateStepBtn();
         }
         private void OnClickBtnNextStep()
         {
-            if (_stepIndex + 1 >= MAX_MEMORY_STEP) return;
-            _stepIndex++;
-            MyDressUpHelper.dressUpObj.PutOnDressUpData(_dressMemory[_stepIndex].dressUpData);
-            _ui.m_comboBox.selectedIndex = _dressMemory[_stepIndex].pos;
+            if (!MyDressUpHelper.OnClickBtnNextStep()) return;
             UpdateStepBtn();
 
         }
@@ -336,7 +329,7 @@ namespace GFGGame
                     MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
                 }
             }
-
+            AddMemoryDressup();
             UpdateListPartsSelected(id);
             UpdateListSuitPartsSelected();
             // AddMemoryDressup();
@@ -391,29 +384,17 @@ namespace GFGGame
             {
                 MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(id);
             }
-
+            AddMemoryDressup();
             UpdateListSuitPartsSelected();
         }
         private void AddMemoryDressup()
         {
-            _stepIndex++;
-            if (_stepIndex == MAX_MEMORY_STEP)
-            {
-                _stepIndex = MAX_MEMORY_STEP - 1;
-                _dressMemory.RemoveAt(0);
-            }
-            if (_dressMemory.Count > _stepIndex)
-            {
-                _dressMemory.RemoveRange(_stepIndex, _dressMemory.Count - _stepIndex);
-            }
-            CustomSuitData suitSavedData = MyDressUpHelper.GetCurSuitDataClone(_ui.m_comboBox.selectedIndex);
-            _dressMemory.Add(suitSavedData);
-            UpdateStepBtn();
+
         }
         private void UpdateStepBtn()
         {
-            _ui.m_btnLastStep.enabled = _stepIndex > 0;
-            _ui.m_btnNextStep.enabled = _stepIndex < _dressMemory.Count - 1;
+            _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
+            _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.MAX_MEMORY_STEP - 1;
         }
 
         private void OnLongPress(EventContext context)
@@ -468,6 +449,7 @@ namespace GFGGame
             UpdateBtnAction();
             _ui.m_partsList.m_list.numItems = _currentList3.Count;
             _ui.m_partsList2.m_list.numItems = _currentList4.Count;
+            AddMemoryDressup();
         }
 
         private void OnClickBtnSave()

BIN
GameClient/Assets/ResIn/UI/DressUp/DressUp_fui.bytes