瀏覽代碼

Merge remote-tracking branch 'remotes/origin/guodong' into zhaoyang

zhaoyang 3 年之前
父節點
當前提交
dcfca04bb5

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit 3711e5ec85f493b3346258ea092b06f49bf507b9
+Subproject commit 610d9b26362dc4aa47a3f5eaf8dd39e918f9c696

+ 23 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ClothingSyntheticSProxy.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ET;
+
+namespace GFGGame
+{
+    public class ClothingSyntheticSProxy
+    {
+        public static async ETTask ClothtingSynthetic(int itemId)
+        {
+            var response = (M2C_ClothingSynthetic)await MessageHelper.SendToServer(new C2M_ClothingSynthetic() { ItemId = itemId });
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    GetSuitItemController.TryShow(itemId);
+                }
+            }
+        }
+    }
+}

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

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

+ 11 - 11
GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

@@ -146,14 +146,20 @@ namespace GFGGame
                 PromptController.Instance.ShowFloatTextPrompt("不能制作已经拥有的物品!");
                 return;
             }
-            //合成
-            ItemCfg clothingSyntheticCfg = ItemCfgArray.Instance.GetCfg(_selectedItemId);
-            _materiarsOfSelectedItem = ItemUtil.CreateItemDataList(clothingSyntheticCfg.syntheticMateriarsArr);
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_selectedItemId);
+            //合成消耗判断
+            if(ItemDataManager.GetItemNum(itemCfg.syntheticCostID) < itemCfg.syntheticCostNum)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("消耗不足!", MessageType.WARNING);
+                return;
+            }
+
+            //合成材料判断
+            _materiarsOfSelectedItem = ItemUtil.CreateItemDataList(itemCfg.syntheticMateriarsArr);
             int count = _materiarsOfSelectedItem.Count;
             for (int i = 0; i < count; i++)
             {
                 ItemData itemData = _materiarsOfSelectedItem[i];
-                ItemCfg materiasItemCfg = ItemCfgArray.Instance.GetCfg(itemData.id);
                 int num = ItemDataManager.GetItemNum(itemData.id);
                 int numSynthetic = Mathf.Max(num - 1, 0);
                 if (numSynthetic < itemData.num)
@@ -163,13 +169,7 @@ namespace GFGGame
                 }
             }
 
-            for (int i = 0; i < count; i++)
-            {
-                ItemData itemData = _materiarsOfSelectedItem[i];
-                ItemDataManager.Remove(itemData.id, itemData.num);
-            }
-            ItemDataManager.Add(_selectedItemId, 1);
-            GetSuitItemController.TryShow(_selectedItemId);
+            ClothingSyntheticSProxy.ClothtingSynthetic(_selectedItemId).Coroutine();
 
         }