Browse Source

开服活动剧情开启条件增加解锁物品判断

huangxiaoyue 1 year ago
parent
commit
79ea7d0879

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -227,6 +227,7 @@ namespace GFGGame
 
 
 
 
             ItemProxy.GetItemAttributeInfos().Coroutine();
             ItemProxy.GetItemAttributeInfos().Coroutine();
+            ItemProxy.ReqGetItemCollect().Coroutine();
             MainStorySProxy.GetStoryBonusInfos().Coroutine();
             MainStorySProxy.GetStoryBonusInfos().Coroutine();
             CardSProxy.GetCardInfos().Coroutine();
             CardSProxy.GetCardInfos().Coroutine();
             TaskSProxy.GetTaskInfos();
             TaskSProxy.GetTaskInfos();

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Data/ItemDataManager.cs

@@ -10,6 +10,7 @@ namespace GFGGame
     {
     {
         private static Dictionary<int, ItemData> _dataDic = new Dictionary<int, ItemData>();
         private static Dictionary<int, ItemData> _dataDic = new Dictionary<int, ItemData>();
         private static Dictionary<int, int> _itemExchangeDic = new Dictionary<int, int>();
         private static Dictionary<int, int> _itemExchangeDic = new Dictionary<int, int>();
+        public static Dictionary<int, int> ItemCollect = new Dictionary<int, int>();
 
 
         delegate object MemberGetDelegate(ItemCfg p);
         delegate object MemberGetDelegate(ItemCfg p);
 
 

+ 42 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ItemProxy.cs

@@ -1,6 +1,26 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using ET;
 using ET;
+using GFGGame;
+
+namespace ET
+{
+    public class S2C_ItemCollectHandler : AMHandler<S2C_ItemCollect>
+    {
+        protected override async ETTask Run(Session session, S2C_ItemCollect message)
+        {
+            for (int i = 0; i < message.ItemIds.Count; i++)
+            {
+                if (ItemDataManager.ItemCollect.ContainsKey(message.ItemIds[i]))
+                    ItemDataManager.ItemCollect[message.ItemIds[i]] = message.Counts[i];
+                else
+                    ItemDataManager.ItemCollect.Add(message.ItemIds[i], message.Counts[i]);
+            }
+            await ETTask.CompletedTask;
+        }
+    }
+}
+
 
 
 namespace GFGGame
 namespace GFGGame
 {
 {
@@ -160,5 +180,27 @@ namespace GFGGame
 
 
             return false;
             return false;
         }
         }
+
+        //获取物品收集量
+        public static async ETTask<bool> ReqGetItemCollect()
+        {
+            S2C_GetItemCollect response = null;
+            response = (S2C_GetItemCollect)await MessageHelper.SendToServer(new C2S_GetItemCollect(){});
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    for (int i = 0; i < response.ItemIds.Count; i++) {
+                        if (ItemDataManager.ItemCollect.ContainsKey(response.ItemIds[i]))
+                            ItemDataManager.ItemCollect[response.ItemIds[i]] = response.Counts[i];
+                        else
+                            ItemDataManager.ItemCollect.Add(response.ItemIds[i], response.Counts[i]);
+                    }
+                    //EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
+                    return true;
+                }
+            }
+            return false;
+        }
     }
     }
 }
 }