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

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/DecomposeDataManager.cs

@@ -7,7 +7,7 @@ namespace GFGGame
         Dictionary<int, List<int>> _decomposeData = new Dictionary<int, List<int>>();//所有数量大于1的换装部件数据
         List<int> _rewardList = new List<int>();
 
-        public const int MaxCount = 10;
+        public const int MaxCount = 999;
         public void Clear()
         {
             _decomposeData.Clear();

+ 8 - 4
GameClient/Assets/Game/HotUpdate/Data/ItemDataManager.cs

@@ -41,12 +41,16 @@ namespace GFGGame
             if (ItemUtilCS.IsDressUpItem(itemID) && itemID % GameConst.MAX_COUNT_EVERY_TYPE_ITEM > 0)
             {
                 DressUpMenuItemDataManager.Add(itemID);
+                if (!DressUpMenuItemDataManager.CheckIsSceneType(itemID))
+                {
+                    DecomposeDataManager.Instance.Add(itemID);
+                }
             }
 
-            if (itemCfg.itemType == ConstItemType.DRESS_UP && !DressUpMenuItemDataManager.CheckIsSceneType(itemID))
-            {
-                DecomposeDataManager.Instance.Add(itemID);
-            }
+            // if (itemCfg.itemType == ConstItemType.DRESS_UP && !DressUpMenuItemDataManager.CheckIsSceneType(itemID))
+            // {
+            //     DecomposeDataManager.Instance.Add(itemID);
+            // }
             PhotographDataManager.Instance.Add(itemID);
             EventAgent.DispatchEvent(ConstMessage.ITEM_CHANGED, itemID);
         }

+ 25 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ClothingDecomposeSProxy.cs

@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using ET;
+using GFGGame;
+
+
+namespace GFGGame
+{
+    public static class ClothingDecomposeSProxy
+    {
+        public static async ETTask<bool> ClothingDecompose(List<int> itemIds, List<int> itemNums)
+        {
+            M2C_ClothingDecompose response = null;
+            response = (M2C_ClothingDecompose)await MessageHelper.SendToServer(new C2M_ClothingDecompose() { itemIds = itemIds, itemNums = itemNums });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.bonusList));
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ClothingDecomposeSProxy.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d33bfa1e75db9e54dbcc08044bf75748
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 22 - 29
GameClient/Assets/Game/HotUpdate/Views/ClothingDecompose/ClothingDecomposeView.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using FairyGUI;
 using UI.ClothingDecompose;
 
@@ -10,8 +11,9 @@ namespace GFGGame
         private UI_ClothingDecomposeUI _ui;
         private ValueBarController _valueBarController;
 
-        private List<int> _datas = new List<int>();
+        private List<int> _clothingDatas = new List<int>();
         private Dictionary<int, int> _decomposeData = new Dictionary<int, int>();
+
         private int _decomposeCount = 0;//要分解物品的数量
         private int _curRarity = 0;
         public override void Dispose()
@@ -71,11 +73,11 @@ namespace GFGGame
         private void OnClickBtnRarity(int rarity)
         {
             _curRarity = rarity;
-            _datas = DecomposeDataManager.Instance.GetDecomposeDataByRarity(rarity);
-            _ui.m_list.visible = _datas != null && _datas.Count > 0;
-            _ui.m_txtNone.visible = _datas == null || _datas.Count == 0;
-            if (_datas == null) return;
-            _ui.m_list.numItems = _datas.Count;
+            _clothingDatas = DecomposeDataManager.Instance.GetDecomposeDataByRarity(rarity);
+            _ui.m_list.visible = _clothingDatas != null && _clothingDatas.Count > 0;
+            _ui.m_txtNone.visible = _clothingDatas == null || _clothingDatas.Count == 0;
+            if (_clothingDatas == null) return;
+            _ui.m_list.numItems = _clothingDatas.Count;
             _ui.m_btnSelect.selected = false;
             CancleAll();
             UpdateConsume();
@@ -84,7 +86,7 @@ namespace GFGGame
         private void ListItemRander(int index, GObject obj)
         {
             UI_ListItem item = UI_ListItem.Proxy(obj);
-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_datas[index]);
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_clothingDatas[index]);
             RarityIconController.UpdateRarityIcon(item.m_loaRarity, itemCfg.id, false);
             string ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType);
             item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg.res, ext);
@@ -92,7 +94,7 @@ namespace GFGGame
             item.m_imgSelect.visible = false;
             int itemHasCount = DecomposeDataManager.Instance.ItemCanDecomposeCount(itemCfg.id);
             item.m_txtHasCount.text = itemHasCount.ToString();
-            int itemCount = _decomposeData.ContainsKey(_datas[index]) ? _decomposeData[_datas[index]] : 0;
+            int itemCount = _decomposeData.ContainsKey(_clothingDatas[index]) ? _decomposeData[_clothingDatas[index]] : 0;
             item.m_txtCount.text = itemCount.ToString();
             item.m_imgSelect.visible = itemCount > 0;
             item.m_btnMinus.visible = itemCount > 0;
@@ -175,9 +177,9 @@ namespace GFGGame
         {
             int lastCount = DecomposeDataManager.MaxCount - _decomposeCount;
 
-            for (int i = 0; i < _datas.Count; i++)
+            for (int i = 0; i < _clothingDatas.Count; i++)
             {
-                int itemId = _datas[i];
+                int itemId = _clothingDatas[i];
                 int itemHasCount = DecomposeDataManager.Instance.ItemCanDecomposeCount(itemId);
                 int itemLastCount = _decomposeData.ContainsKey(itemId) ? itemHasCount - _decomposeData[itemId] : itemHasCount;
 
@@ -188,12 +190,12 @@ namespace GFGGame
                 _decomposeCount += count;
                 if (lastCount == 0) break;
             }
-            _ui.m_list.numItems = _datas.Count;
+            _ui.m_list.numItems = _clothingDatas.Count;
         }
         private void CancleAll()
         {
             _decomposeData.Clear();
-            _ui.m_list.numItems = _datas.Count;
+            _ui.m_list.numItems = _clothingDatas.Count;
             _decomposeCount = 0;
 
         }
@@ -204,8 +206,8 @@ namespace GFGGame
             DecomposeCfg cfg = DecomposeCfgArray.Instance.GetCfg(_curRarity);
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.consumeId);
             _ui.m_listReward.numItems = _decomposeCount > 0 ? cfg.itemsArr.Length : 0;
-            _ui.m_txtConsume.text = string.Format("消耗{0}X{1}", itemCfg.name, (_decomposeCount * cfg.consumeCount));
             _ui.m_txtShow.text = string.Format("*  分解{0}件{1}可获得  *", StringUtil.GetColorText(_decomposeCount.ToString(), "#DA826E"), ConstDressRarity.DressRarityList()[_curRarity]);
+            _ui.m_txtConsume.text = string.Format("消耗{0}X{1}", itemCfg.name, (_decomposeCount * cfg.consumeCount));
         }
         private void ListRewardItemRander(int index, GObject obj)
         {
@@ -234,7 +236,7 @@ namespace GFGGame
                 DecomposeItem();
             }
         }
-        private void DecomposeItem()
+        private async void DecomposeItem()
         {
             DecomposeCfg cfg = DecomposeCfgArray.Instance.GetCfg(_curRarity);
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.consumeId);
@@ -245,23 +247,14 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足", itemCfg.name));
                 return;
             }
-            ItemDataManager.Remove(cfg.consumeId, consumeCount);
-            foreach (int key in _decomposeData.Keys)
-            {
-                ItemDataManager.Remove(key, _decomposeData[key]);
-            }
-            List<ItemData> listReward = new List<ItemData>();
-            for (int i = 0; i < cfg.itemsArr.Length; i++)
+
+            List<int> itemIds = _decomposeData.Keys.ToList<int>();
+            List<int> itemNums = _decomposeData.Values.ToList<int>();
+            bool result = await ClothingDecomposeSProxy.ClothingDecompose(itemIds, itemNums);
+            if (result)
             {
-                ItemData itemData = new ItemData();
-                itemData.id = cfg.itemsArr[i][0];
-                itemData.num = cfg.itemsArr[i][1] * _decomposeCount;
-                listReward.Add(itemData);
-                ItemDataManager.Add(itemData.id, itemData.num);
+                OnClickBtnRarity(_curRarity);
             }
-
-            BonusController.TryShowBonusList(listReward);
-            OnClickBtnRarity(_curRarity);
         }
         private void OnClickBtnRule()
         {