ActivityTeaSProxy.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using Assets.Game.HotUpdate.Data;
  4. using ET;
  5. namespace GFGGame
  6. {
  7. public class ActivityNPCRewardProtoHandler : AMHandler<S2C_PushNpcVisits>
  8. {
  9. protected override async ETTask Run(Session session, S2C_PushNpcVisits message)
  10. {
  11. MiniGameDateManager.Instance.NpcInfoList = message.NpcVisits;
  12. await ETTask.CompletedTask;
  13. }
  14. }
  15. public class ActivityTeaSProxy
  16. {
  17. public static async ETTask<bool> ReqGetNPCVisitInfo(int id)
  18. {
  19. var response = (S2C_GetNpcVisits) await MessageHelper.SendToServer(new C2S_GetNpcVisits { ActivityId = id });
  20. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  21. MiniGameDateManager.Instance.NpcInfoList = response.NpcVisits;
  22. return true;
  23. }
  24. public static async ETTask<bool> ReqUnLockNPCVisit(int id,int npcid)
  25. {
  26. var response = (S2C_UnlockNpcVisit)await MessageHelper.SendToServer(new C2S_UnlockNpcVisit { ActivityId = id , NpcId = npcid});
  27. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  28. MiniGameDateManager.Instance.NpcInfoList = response.NpcVisits;
  29. return true;
  30. }
  31. public static async ETTask<bool> ReqGetNPCVisitReward(int id, int npcid)
  32. {
  33. var response = (S2C_GetNpcVisitRewrd)await MessageHelper.SendToServer(new C2S_GetNpcVisitRewrd { ActivityId = id, NpcId = npcid });
  34. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  35. // 奖励弹窗
  36. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  37. MiniGameDateManager.Instance.NpcInfoList = response.NpcVisits;
  38. return true;
  39. }
  40. //获取合成列表
  41. public static async ETTask<bool> ReqGetItemSyntheticInfos(int activityId)
  42. {
  43. S2C_GetItemSyntheticInfos response = null;
  44. response = (S2C_GetItemSyntheticInfos)await MessageHelper.SendToServer(new C2S_GetItemSyntheticInfos() { ActivityId = activityId });
  45. if (response != null)
  46. {
  47. if (response.Error == ErrorCode.ERR_Success)
  48. {
  49. ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. //部件合成
  56. public static async ETTask<bool> ReqItemSynthetic(int activityId ,int itemId)
  57. {
  58. S2C_ItemSynthetic response = null;
  59. response = (S2C_ItemSynthetic)await MessageHelper.SendToServer(new C2S_ItemSynthetic() { ActivityId = activityId,ItemId = itemId });
  60. if (response != null)
  61. {
  62. if (response.Error == ErrorCode.ERR_Success)
  63. {
  64. //ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  65. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. }
  72. }