瀏覽代碼

Merge branch 'master' of http://10.108.64.190:3000/gfg/client

zhaoyang 2 年之前
父節點
當前提交
9a719c092f

+ 21 - 0
GameClient/Assets/Game/HotUpdate/Controller/BonusController.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using ET;
 
 namespace GFGGame
 {
@@ -10,6 +11,7 @@ namespace GFGGame
             if (bonusInfos != null && bonusInfos.Length > 0)
             {
                 List<ItemData> bonusList = ItemUtil.CreateItemDataList(bonusInfos);
+                CheckUpdateAutoUseItem(bonusList);
                 ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
@@ -17,8 +19,27 @@ namespace GFGGame
         {
             if (bonusList != null && bonusList.Count > 0)
             {
+                CheckUpdateAutoUseItem(bonusList);
                 ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
+
+        private static void CheckUpdateAutoUseItem(List<ItemData> bonusList)
+        {
+            List<ItemData> itemDatasFromAutoUsedItem = new List<ItemData>();
+            int count = bonusList.Count;
+            for (var i = count - 1; i >= 0; i--)
+            {
+                var t = bonusList[i];
+                var itemCfg = ItemCfgArray.Instance.GetCfg(t.id);
+                if (itemCfg.itemType == ConstItemType.USEABLE &&
+                    (itemCfg.subType == ConstItemSubType.USEABLE_AUTO))
+                {
+                    itemDatasFromAutoUsedItem.AddRange(ItemUtil.CreateItemDataList(itemCfg.itemsArr, t.num));
+                    bonusList.RemoveAt(i);
+                }
+            }
+            bonusList.AddRange(itemDatasFromAutoUsedItem);
+        }
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Platform/QDManager.cs

@@ -63,7 +63,7 @@
             }
         }
 
-        public static void Pay(int buyID, int count)
+        public static void Pay(int buyID, int count, string orderID, long Price)
         {
             switch (LauncherConfig.ChannelId)
             {

+ 40 - 17
GameClient/Assets/Game/HotUpdate/ServerProxy/ShopSProxy.cs

@@ -1,5 +1,18 @@
 using System.Collections.Generic;
 using ET;
+using GFGGame;
+
+namespace ET
+{
+    public class S2C_SyncRechargeItemGetHandler : AMHandler<S2C_SyncRechargeItemGet>
+    {
+        protected override async ETTask Run(Session session, S2C_SyncRechargeItemGet message)
+        {
+            var dTime = TimeHelper.ServerNow() - message.OrderTime;
+            ShopSProxy.OnBuySuccess(message.BuyId, message.Times, message.TotalTimes, dTime <= 5000);
+        }
+    }
+}
 
 namespace GFGGame
 {
@@ -30,35 +43,45 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-                    ShopDataManager.Instance.UpdateGoodsData(response.BuyId, response.TotalTimes);
                     ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(response.BuyId);
                     ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
-                    if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL && shopCfg.costType == CostType.RMB)
+                    if (shopCfg.costType == CostType.RMB)
                     {
-                        PromptController.Instance.ShowFloatTextPrompt("虚拟充值成功");
-                    }
-
-                    List<ItemData> itemDatas;
-                    if (itemCfg.itemType == ConstItemType.USEABLE &&
-                        (itemCfg.subType == ConstItemSubType.USEABLE_AUTO))
-                    {
-                        itemDatas = ItemUtil.CreateItemDataList(itemCfg.itemsArr, response.Times * shopCfg.itemNum);
+                        QDManager.Pay(response.BuyId, response.Times, response.OrderId, response.Price);
+                        return false;
                     }
                     else
                     {
-                        itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
+                        OnBuySuccess(response.BuyId, response.Times, response.TotalTimes, true);
+                        return true;
                     }
-
-                    EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, shopCfg);
-                    BonusController.TryShowBonusList(itemDatas);
-                    EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
-                    EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
-                    return true;
                 }
             }
             return false;
         }
 
+        public static void OnBuySuccess(int buyId, int times, int totalTimes, bool showItems)
+        {
+            ShopDataManager.Instance.UpdateGoodsData(buyId, totalTimes);
+            ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(buyId);
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
+
+            EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, shopCfg);
+            if(showItems)
+            {
+                //判断倍数
+                var multiple = 1;
+                if (totalTimes <= shopCfg.doubleTimes)
+                {
+                    multiple = 2;
+                }
+                List<ItemData> itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, times * shopCfg.itemNum* multiple);
+                BonusController.TryShowBonusList(itemDatas);
+            }
+            EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
+            EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
+        }
+
         /**********************************************会员中心**********************************************/
         //领取VIP等级礼包
         public static async ETTask<bool> ReqGetVipGiftBag(int vipLv)

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Utils/ItemUtil.cs

@@ -109,7 +109,7 @@ namespace GFGGame
             }
             return itemList;
         }
-        public static List<ItemData> CreateItemDataList(int[][] bonus, int num)
+        public static List<ItemData> CreateItemDataList(int[][] bonus, long num)
         {
             List<ItemData> itemList = new List<ItemData>();
             foreach (int[] item in bonus)