ActivityTeaSProxy.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ActivityTeaDataManager.Instance.NpcInfoList = message.NpcVisits;
  12. await ETTask.CompletedTask;
  13. }
  14. }
  15. public class ActivityTeaSProxy
  16. {
  17. public static async ETTask<bool> ReqGetNPCVisitInfo(int id = 5004)
  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. ActivityTeaDataManager.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. return true;
  29. }
  30. public static async ETTask<bool> ReqGetNPCVisitReward(int id, int npcid)
  31. {
  32. var response = (S2C_GetNpcVisitRewrd)await MessageHelper.SendToServer(new C2S_GetNpcVisitRewrd { ActivityId = id, NpcId = npcid });
  33. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  34. // 奖励弹窗
  35. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  36. return true;
  37. }
  38. //获取合成列表
  39. public static async ETTask<bool> ReqGetItemSyntheticInfos(int activityId)
  40. {
  41. S2C_GetItemSyntheticInfos response = null;
  42. response = (S2C_GetItemSyntheticInfos)await MessageHelper.SendToServer(new C2S_GetItemSyntheticInfos() { ActivityId = activityId });
  43. if (response != null)
  44. {
  45. if (response.Error == ErrorCode.ERR_Success)
  46. {
  47. ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. //部件合成
  54. public static async ETTask<bool> ReqItemSynthetic(int activityId ,int itemId)
  55. {
  56. S2C_ItemSynthetic response = null;
  57. response = (S2C_ItemSynthetic)await MessageHelper.SendToServer(new C2S_ItemSynthetic() { ActivityId = activityId,ItemId = itemId });
  58. if (response != null)
  59. {
  60. if (response.Error == ErrorCode.ERR_Success)
  61. {
  62. //ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  63. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. }
  70. }