瀏覽代碼

饰品最多穿戴5件

zhaoyang 2 年之前
父節點
當前提交
09d5bdf5bc

+ 7 - 4
FGUIProject/assets/DressUp/DressUpFightUI.xml

@@ -23,21 +23,24 @@
     <component id="n2_qsvd" name="btnHome" src="qp4l60" fileName="components/ButtonHome.xml" pkg="eg2y0ldp" xy="35,200" group="n38_8lqj" visible="false">
       <relation target="n1_qsvd" sidePair="left-left,top-top"/>
     </component>
+    <image id="n50_f2bf" name="n50" src="f2bfey" fileName="images/dz_cdxzcdxz.png" xy="837,60" group="n51_f2bf"/>
+    <text id="n49_f2bf" name="txtDressLimit" xy="855,63" size="223,36" group="n51_f2bf" fontSize="26" color="#7a5e38" text="饰品穿戴限制:0/5"/>
+    <group id="n51_f2bf" name="n51" xy="837,60" size="243,44" group="n38_8lqj"/>
     <image id="n16_8xpg" name="n16" src="j48o3z" fileName="images/dz_hz_fsk_1.png" xy="24,230" group="n33_j48o"/>
     <loader id="n24_d4iw" name="scoreType" xy="23,232" size="50,50" group="n33_j48o" url="ui://eg2y0ldp842s6h" fill="scale"/>
     <text id="n14_vxw5" name="txtScore" xy="78,232" size="124,54" group="n33_j48o" fontSize="28" color="#b08649" align="center" vAlign="middle" autoSize="none" autoClearText="true" text="9999"/>
     <group id="n33_j48o" name="n33" xy="23,230" size="204,57" group="n38_8lqj"/>
     <component id="n29_pjip" name="compNeed" src="pjip31" fileName="components/Component1.xml" xy="0,305" group="n38_8lqj"/>
-    <component id="n31_f4xv" name="comListType1" src="f4xv3q" fileName="components/comListType.xml" xy="850,0" group="n38_8lqj">
+    <component id="n31_f4xv" name="comListType1" src="f4xv3q" fileName="components/comListType.xml" xy="850,40" size="230,1880" group="n38_8lqj">
       <relation target="" sidePair="height-height"/>
     </component>
-    <component id="n32_f4xv" name="comListType2" src="f4xv3q" fileName="components/comListType.xml" xy="850,0" group="n38_8lqj">
+    <component id="n32_f4xv" name="comListType2" src="f4xv3q" fileName="components/comListType.xml" xy="850,40" size="230,1880" group="n38_8lqj">
       <relation target="" sidePair="height-height"/>
     </component>
-    <component id="n10_qsvd" name="partsList" src="k6he1v" fileName="components/PartsList.xml" xy="1080,0" group="n38_8lqj">
+    <component id="n10_qsvd" name="partsList" src="k6he1v" fileName="components/PartsList.xml" xy="1080,40" size="230,1880" group="n38_8lqj">
       <relation target="" sidePair="right-right,top-top,bottomext-bottom"/>
     </component>
-    <component id="n40_afs6" name="partsList2" src="k6he1v" fileName="components/PartsList.xml" xy="1080,0" group="n38_8lqj">
+    <component id="n40_afs6" name="partsList2" src="k6he1v" fileName="components/PartsList.xml" xy="1080,40" size="230,1880" group="n38_8lqj">
       <relation target="" sidePair="right-right,top-top,bottomext-bottom"/>
     </component>
     <graph id="n20_8xpg" name="btnClose" xy="0,0" size="1080,1920" group="n38_8lqj" alpha="0" type="rect" fillColor="#ffff0000">

二進制
FGUIProject/assets/DressUp/images/dz_cdxzcdxz.png


+ 1 - 0
FGUIProject/assets/DressUp/package.xml

@@ -189,6 +189,7 @@
     <image id="ygapev" name="scw_danxiaozj.png" path="/images/"/>
     <image id="ygapew" name="scw_dengyingly.png" path="/images/"/>
     <image id="ygapex" name="hz_fenleitu_12.png" path="/imagesExport/" exported="true" atlas="1"/>
+    <image id="f2bfey" name="dz_cdxzcdxz.png" path="/images/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\DressUp" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 41 - 16
GameClient/Assets/Game/HotUpdate/Data/DressUpMenuItemDataManager.cs

@@ -21,6 +21,8 @@ namespace GFGGame
 
         private static List<int> _itemDatas = new List<int>();
 
+        private static Dictionary<int, List<int>> _itemDatasBySubTypeDic = new Dictionary<int, List<int>>();
+        public static Dictionary<int, List<int>> ItemDatasBySubTypeDic { get { return _itemDatasBySubTypeDic; } }
         private static Dictionary<int, List<int>> _newItemdata = new Dictionary<int, List<int>>();
         private static List<int> _newSuitData = new List<int>();
 
@@ -28,6 +30,7 @@ namespace GFGGame
         {
             _itemDatas.Clear();
             _newItemdata.Clear();
+            _itemDatasBySubTypeDic.Clear();
         }
         public static void Clear()
         {
@@ -50,6 +53,16 @@ namespace GFGGame
                 if (!_itemDatas.Contains(value))
                 {
                     _itemDatas.Add(value);
+
+                    int subType = ItemUtilCS.GetItemSubType(value);
+                    subType = subType >= (int)ConstDressUpItemType.TE_SHU ? (int)ConstDressUpItemType.TE_SHU : subType;
+
+                    if (!_itemDatasBySubTypeDic.ContainsKey(subType))
+                    {
+                        _itemDatasBySubTypeDic.Add(subType, new List<int>());
+                    }
+                    _itemDatasBySubTypeDic[subType].Add(value);
+
                     if (GameGlobal.DataInited)
                     {
                         AddNewDressItem(value);
@@ -73,24 +86,36 @@ namespace GFGGame
             {
                 _itemDatas.Remove(value);
             }
+
+            int subType = ItemUtilCS.GetItemSubType(value);
+            subType = subType >= (int)ConstDressUpItemType.TE_SHU ? (int)ConstDressUpItemType.TE_SHU : subType;
+            if (_itemDatasBySubTypeDic.ContainsKey(subType) && _itemDatasBySubTypeDic[subType].IndexOf(value) >= 0)
+            {
+                _itemDatasBySubTypeDic[subType].Remove(value);
+            }
+
         }
 
         public static List<int> getItemDatasByType(int type)
         {
             List<int> arrayList = new List<int>();
-            for (int i = 0; i < _itemDatas.Count; i++)
+            if (_itemDatasBySubTypeDic.ContainsKey(type))
             {
-                int itemID = (int)_itemDatas[i];
-                int subType = ItemUtilCS.GetItemSubType(itemID);
-                if (type == (int)ConstDressUpItemType.TE_SHU && subType > type)
-                {
-                    arrayList.Add(itemID);
-                }
-                else if (subType == type)
-                {
-                    arrayList.Add(itemID);
-                }
+                arrayList.AddRange(_itemDatasBySubTypeDic[type]);
             }
+            // for (int i = 0; i < _itemDatas.Count; i++)
+            // {
+            //     int itemID = (int)_itemDatas[i];
+            //     int subType = ItemUtilCS.GetItemSubType(itemID);
+            //     if (type == (int)ConstDressUpItemType.TE_SHU && subType > type)
+            //     {
+            //         arrayList.Add(itemID);
+            //     }
+            //     else if (subType == type)
+            //     {
+            //         arrayList.Add(itemID);
+            //     }
+            // }
             return arrayList;
         }
 
@@ -285,11 +310,11 @@ namespace GFGGame
             return recommendList;
         }
 
-        public static int GetRecommendCount()
-        {
-            List<int> recommendTypeList = GetRecommendItemList(false);
-            return recommendTypeList.Count;
-        }
+        // public static int GetRecommendCount()
+        // {
+        //     List<int> recommendTypeList = GetRecommendItemList(false);
+        //     return recommendTypeList.Count;
+        // }
 
         // public static int GetItemScore(int itemId)
         // {

+ 81 - 1
GameClient/Assets/Game/HotUpdate/DressUp/MyDressUpHelper.cs

@@ -9,7 +9,7 @@ namespace GFGGame
         {
             get
             {
-                if(_dressUpObj == null)
+                if (_dressUpObj == null)
                 {
                     _dressUpObj = new DressUpObj();
                 }
@@ -77,6 +77,17 @@ namespace GFGGame
             dressUpObj.PutOnDressUpData(suitSavedData.dressUpData);
         }
 
+        //返回当前饰品穿戴数量
+        public static int GetCurrentOrnamentCount()
+        {
+            int count = 0;
+            for (int i = 0; i < dressUpObj.itemList.Count; i++)
+            {
+                if (DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(dressUpObj.itemList[i])) count++;
+            }
+            return count;
+        }
+
         public static void PutOnRecommendItems()
         {
             List<int> recommendList = DressUpMenuItemDataManager.GetRecommendItemList();
@@ -184,6 +195,75 @@ namespace GFGGame
             dressUpObj.PutOnItemList(recommendList);
         }
 
+        public static void PutOnRecommendItems2()
+        {
+            GetRecommendItems(out Dictionary<int, List<int>> needListBySubType, out Dictionary<int, List<int>> recommendListBySubType);
+
+
+        }
+
+        //获取每个类型里分数最高的服装部件Dictionary
+        private static void GetRecommendItems(out Dictionary<int, List<int>> needListBySubType, out Dictionary<int, List<int>> recommendListBySubType)
+        {
+            StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
+            StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
+
+            needListBySubType = new Dictionary<int, List<int>>();
+            recommendListBySubType = new Dictionary<int, List<int>>();
+
+            Dictionary<int, List<int>> itemDatasDic = DressUpMenuItemDataManager.ItemDatasBySubTypeDic;
+
+            foreach (int subType in itemDatasDic.Keys)
+            {
+                if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneTypeBySubType(subType)) continue;
+                if (!needListBySubType.ContainsKey(subType))
+                {
+                    needListBySubType.Add(subType, new List<int>());
+                }
+                List<int> itemDatas = new List<int>(itemDatasDic[subType]);
+                DressUpMenuItemDataManager.SortItemListByHighScore(itemDatas);
+
+                if (fightCfg.needSuitId > 0)
+                {
+                    int[] suitParts = SuitCfgArray.Instance.GetCfg(fightCfg.needSuitId).partsArr;
+                    for (int i = 0; i < suitParts.Length; i++)
+                    {
+                        if (itemDatas.IndexOf(suitParts[i]) >= 0)//当前类型里是否包含此部件,
+                        {
+                            needListBySubType[subType].Add(suitParts[i]);
+                        }
+                    }
+                }
+                if (fightCfg.needItemId > 0)
+                {
+                    if (itemDatas.IndexOf(fightCfg.needItemId) >= 0 && needListBySubType[subType].IndexOf(fightCfg.needItemId) < 0)
+                    {
+                        needListBySubType[subType].Add(fightCfg.needItemId);
+                    }
+                }
+                DressUpMenuItemDataManager.SortItemListByHighScore(needListBySubType[subType]);
+                int maxCount = subType == (int)ConstDressUpItemType.TE_SHU ? 3 : 1;//特殊部件最多穿3个,其他部件只能穿一个;
+                needListBySubType[subType] = needListBySubType[subType].GetRange(0, maxCount);//多余3个取前三
+
+
+                int index = 0;
+                while (recommendListBySubType[subType].Count < maxCount && itemDatasDic[subType].Count > index)//不足3个从列表里补足
+                {
+                    int partId = itemDatasDic[subType][index];
+                    if (needListBySubType[subType].IndexOf(partId) < 0)//必需品列表里还没有此部件才会被添加进去
+                    {
+                        if (!recommendListBySubType.ContainsKey(subType))
+                        {
+                            recommendListBySubType.Add(subType, new List<int>());
+                        }
+                        recommendListBySubType[subType].Add(partId);
+                    }
+                    index++;
+                }
+                DressUpMenuItemDataManager.SortItemListByHighScore(recommendListBySubType[subType]);
+            }
+        }
+
         private static int CheckIndex(int _subType, List<int> recommendList)
         {
             for (int i = 0; i < recommendList.Count; i++)

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/DressUp/UI_DressUpFightUI.cs

@@ -13,6 +13,7 @@ namespace UI.DressUp
         public GComboBox m_comboBox;
         public GButton m_btnBack;
         public GButton m_btnHome;
+        public GTextField m_txtDressLimit;
         public GLoader m_scoreType;
         public GTextField m_txtScore;
         public UI_Component1 m_compNeed;
@@ -88,6 +89,7 @@ namespace UI.DressUp
             m_comboBox = (GComboBox)comp.GetChild("comboBox");
             m_btnBack = (GButton)comp.GetChild("btnBack");
             m_btnHome = (GButton)comp.GetChild("btnHome");
+            m_txtDressLimit = (GTextField)comp.GetChild("txtDressLimit");
             m_scoreType = (GLoader)comp.GetChild("scoreType");
             m_txtScore = (GTextField)comp.GetChild("txtScore");
             m_compNeed = (UI_Component1)UI_Component1.Create(comp.GetChild("compNeed"));
@@ -119,6 +121,7 @@ namespace UI.DressUp
             m_comboBox = null;
             m_btnBack = null;
             m_btnHome = null;
+            m_txtDressLimit = null;
             m_scoreType = null;
             m_txtScore = null;
             m_compNeed.Dispose();

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -125,6 +125,7 @@ namespace GFGGame
             _ui.m_loaGuide.visible = true;
             InstanceZonesDataManager.usedRecommend = false;
             // _ui.m_comboBox.title = "我的套装";
+            _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
             _ui.m_txtRecommendCount.SetVar("v1", "" + GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount)).FlushVars();
             _ui.m_txtRecommendCount.SetVar("v2", GlobalCfgArray.globalCfg.recommendCount.ToString()).FlushVars();
 

二進制
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes


二進制
GameClient/Assets/ResIn/UI/DressUp/DressUp_atlas0!a.png


二進制
GameClient/Assets/ResIn/UI/DressUp/DressUp_atlas0.png


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