浏览代码

换装套装展示部件

zhaoyang 3 年之前
父节点
当前提交
d1a105ef29

+ 3 - 0
FGUIProject/assets/DressUp/DressUpUI.xml

@@ -32,6 +32,9 @@
     <component id="n17_k6he" name="partsList" src="k6he1v" fileName="components/PartsList.xml" xy="1081,80" size="222,1828" group="n30_8lqj">
       <relation target="" sidePair="right-right,top-top,bottomext-bottom"/>
     </component>
+    <component id="n32_afs6" name="partsList2" src="k6he1v" fileName="components/PartsList.xml" xy="1081,80" size="222,1828" group="n30_8lqj">
+      <relation target="" sidePair="right-right,top-top,bottomext-bottom"/>
+    </component>
     <component id="n27_j48o" name="btnAction" src="f4xv3o" fileName="components/Button6.xml" xy="27,735" size="116,106" group="n30_8lqj">
       <Button icon="ui://mbo439wbj48o3x"/>
     </component>

+ 4 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/DressUp/UI_DressUpUI.cs

@@ -18,6 +18,7 @@ namespace UI.DressUp
         public UI_comListType m_comListType1;
         public UI_comListType m_comListType2;
         public UI_PartsList m_partsList;
+        public UI_PartsList m_partsList2;
         public GButton m_btnAction;
         public GButton m_btnPhoto;
         public GButton m_btnLastStep;
@@ -84,6 +85,7 @@ namespace UI.DressUp
             m_comListType1 = (UI_comListType)UI_comListType.Create(comp.GetChild("comListType1"));
             m_comListType2 = (UI_comListType)UI_comListType.Create(comp.GetChild("comListType2"));
             m_partsList = (UI_PartsList)UI_PartsList.Create(comp.GetChild("partsList"));
+            m_partsList2 = (UI_PartsList)UI_PartsList.Create(comp.GetChild("partsList2"));
             m_btnAction = (GButton)comp.GetChild("btnAction");
             m_btnPhoto = (GButton)comp.GetChild("btnPhoto");
             m_btnLastStep = (GButton)comp.GetChild("btnLastStep");
@@ -109,6 +111,8 @@ namespace UI.DressUp
             m_comListType2 = null;
             m_partsList.Dispose();
             m_partsList = null;
+            m_partsList2.Dispose();
+            m_partsList2 = null;
             m_btnAction = null;
             m_btnPhoto = null;
             m_btnLastStep = null;

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpListType.cs

@@ -4,6 +4,7 @@ namespace GFGGame
     {
         List1,
         List2,
-        List3
+        List3,
+        List4
     }
 }

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

@@ -16,11 +16,16 @@ namespace GFGGame
         private float listType1X = 0;
         private float partsListX = 0;
         private DressUpListType currentListType;
+        /// <summary>
+        /// 子菜单列表
+        /// </summary>
         private int[] _currentList2;
         private GameObject _scenePrefab;
         private GameObject _sceneObject;
         private List<int> _currentList3;
+        private List<int> _currentList4;
         private int _currentMenuType;
+        private int _currentSuitId;
         private int _rarityIndex = SORT_BY_HIGH_RARITY;
 
         private UI_TypeItem listTypeItem_FreedomDress;
@@ -63,6 +68,7 @@ namespace GFGGame
             _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
             _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
             _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
+            _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
             _ui.m_touchPad.onClick.Add(OnTouchPad);
             _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
             _ui.m_btnSave.onClick.Add(OnClickBtnSave);
@@ -78,7 +84,7 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
             EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
             EventAgent.AddEventListener(ConstMessage.CLOSE_PHOTOGRAPHVIEW, UpdateScene);
-
+            _ui.m_partsList2.m_comboBoxRarity.visible = false;
         }
 
         protected override void OnShown()
@@ -172,6 +178,8 @@ namespace GFGGame
             int id = (int)listItem.data;
             if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
             {
+                this.showListParts2(id);
+                this.hideListParts();
                 EquipDataCache.cacher.PutOnSuitCfg(id, true, false);
                 UpdateBtnAction();
             }
@@ -181,11 +189,28 @@ namespace GFGGame
                 EquipDataCache.cacher.AddOrRemove(id, true);
             }
             UpdateListPartsSelected();
+            UpdateListSuitPartsSelected();
+
         }
+        private void OnClickSuitPartsListItem(EventContext context)
+        {
+            GObject listItem = (GObject)context.data as GObject;
+            int id = (int)listItem.data;
 
+            EquipDataCache.cacher.TryCancelSuit(id);
+            EquipDataCache.cacher.AddOrRemove(id, true);
+
+            UpdateListSuitPartsSelected();
+            UpdateBtnAction();
+        }
         private void OnTouchPad()
         {
-            if (this.currentListType == DressUpListType.List3)
+            if (this.currentListType == DressUpListType.List4)
+            {
+                this.hideListParts2();
+                this.showListParts(ConstDressUpItemType.TAO_ZHUANG);
+            }
+            else if (this.currentListType == DressUpListType.List3)
             {
                 if (_currentList2 != null)
                 {
@@ -239,6 +264,7 @@ namespace GFGGame
         {
             _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
             _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
+            _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
             listType1X = _ui.m_comListType1.target.x;
             partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width - DressUpView.RIGHT_BLANK;
             //一级菜单
@@ -339,6 +365,8 @@ namespace GFGGame
                     _ui.m_partsList.target.x = t.value.x;
                 });
             UpdateBtnAction();
+            UpdateListPartsSelected();
+
         }
 
         private void hideListParts()
@@ -353,6 +381,46 @@ namespace GFGGame
                 });
         }
 
+
+
+        private void showListParts2(int suitId)
+        {
+            _currentSuitId = suitId;
+
+            _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
+            if (_rarityIndex >= SORT_BY_GET_TIME)
+            {
+                _rarityIndex = SORT_BY_HIGH_RARITY;
+            }
+            this.UpdateSuitPartsListSort();
+            _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
+            float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
+            if (_ui.m_partsList2.m_list.height > maxHeight)
+            {
+                _ui.m_partsList2.m_list.height = maxHeight;
+            }
+            currentListType = DressUpListType.List4;
+            GTween.To(_ui.target.width, partsListX, 0.5f)
+                .SetTarget(_ui.m_partsList2)
+                .OnUpdate((GTweener t) =>
+                {
+                    _ui.m_partsList2.target.x = t.value.x;
+                });
+            UpdateBtnAction();
+        }
+
+        private void hideListParts2()
+        {
+            _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
+            UpdateBtnAction();
+            GTween.To(partsListX, _ui.target.width, 0.5f)
+                .SetTarget(_ui.m_partsList2)
+                .OnUpdate((GTweener t) =>
+                {
+                    _ui.m_partsList2.target.x = t.value.x;
+                });
+        }
+        /********************************************************************************************************************************************/
         private void ListType1Item(int index, GObject item)
         {
             UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
@@ -416,6 +484,37 @@ namespace GFGGame
 
         }
 
+        private void ListParts2Item(int index, GObject item)
+        {
+            UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
+            int id = (int)_currentList3[index];
+            string iconRes = "";
+            string partName = "";
+            string ext = "png";
+
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
+            iconRes = itemCfg.res;
+            partName = itemCfg.name;
+            listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
+            RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
+            ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType);
+
+            listItem.m_ScoreType.visible = true;
+            int mainScore;
+            int mainValuel;
+            ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
+            listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + mainScore);
+
+
+            listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
+            listItem.m_txtTitle.text = partName;
+            listItem.target.data = id;
+            listItem.m_txtScore.visible = false;
+            //listItem.m_ScoreType.visible = true;
+            listItem.m_imgNeed.visible = false;
+
+
+        }
         private void UpdateListPartsSelected()
         {
             int count = _ui.m_partsList.m_list.numChildren;
@@ -436,6 +535,21 @@ namespace GFGGame
                 }
             }
         }
+        private void UpdateListSuitPartsSelected()
+        {
+            int count = _ui.m_partsList2.m_list.numChildren;
+            for (int i = 0; i < count; i++)
+            {
+                UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
+                int id = (int)listItem.target.data;
+
+                bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
+                bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == EquipDataCache.cacher.suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
+                bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
+                listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
+
+            }
+        }
 
         private void UpdatePartsListSort()
         {
@@ -488,10 +602,41 @@ namespace GFGGame
 
         }
 
+        private void UpdateSuitPartsListSort()
+        {
+            if (_currentMenuType == 0) return;
+
+            _currentList4 = new List<int>(SuitCfgManager.Instance.GetSuitItems(_currentSuitId));
+            if (_rarityIndex == SORT_BY_HIGH_RARITY)
+            {
+                _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList4);
+            }
+            else if (_rarityIndex == SORT_BY_LOW_RARITY)
+            {
+                _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList4);
+            }
+            else
+            {
+                _currentList3.Reverse();
+            }
+
+            if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
+            {
+                _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4, false);
+            }
+            else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
+            {
+                _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4, false);
+            }
+
+            _ui.m_partsList2.m_list.RemoveChildrenToPool();
+            _ui.m_partsList2.m_list.numItems = _currentList4.Count;
+
+        }
 
         private void UpdateBtnAction()
         {
-            _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG);
+            _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
             if (_ui.m_btnAction.visible)
             {
                 _ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitPicRes;

二进制
GameClient/Assets/ResIn/UI/DressUp/DressUp_fui.bytes