ActivityTeaSProxy.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. if(!ActivityTeaDataManager.Instance.CheckOpen())
  20. {
  21. return false;
  22. }
  23. var response = (S2C_GetNpcVisits) await MessageHelper.SendToServer(new C2S_GetNpcVisits { ActivityId = id });
  24. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  25. ActivityTeaDataManager.Instance.NpcInfoList = response.NpcVisits;
  26. return true;
  27. }
  28. public static async ETTask<bool> ReqUnLockNPCVisit(int id,int npcid)
  29. {
  30. var response = (S2C_UnlockNpcVisit)await MessageHelper.SendToServer(new C2S_UnlockNpcVisit { ActivityId = id , NpcId = npcid});
  31. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  32. return true;
  33. }
  34. public static async ETTask<bool> ReqGetNPCVisitReward(int id, int npcid)
  35. {
  36. var response = (S2C_GetNpcVisitRewrd)await MessageHelper.SendToServer(new C2S_GetNpcVisitRewrd { ActivityId = id, NpcId = npcid });
  37. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  38. // 奖励弹窗
  39. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  40. return true;
  41. }
  42. //获取合成列表
  43. public static async ETTask<bool> ReqGetItemSyntheticInfos(int activityId)
  44. {
  45. S2C_GetItemSyntheticInfos response = null;
  46. response = (S2C_GetItemSyntheticInfos)await MessageHelper.SendToServer(new C2S_GetItemSyntheticInfos() { ActivityId = activityId });
  47. if (response != null)
  48. {
  49. if (response.Error == ErrorCode.ERR_Success)
  50. {
  51. ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. //部件合成
  58. public static async ETTask<bool> ReqItemSynthetic(int activityId ,int itemId)
  59. {
  60. S2C_ItemSynthetic response = null;
  61. response = (S2C_ItemSynthetic)await MessageHelper.SendToServer(new C2S_ItemSynthetic() { ActivityId = activityId,ItemId = itemId });
  62. if (response != null)
  63. {
  64. if (response.Error == ErrorCode.ERR_Success)
  65. {
  66. //ActivityTeaDataManager.Instance.ItemSynthetics = response.ItemSynthetics;
  67. BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(response.BonusList));
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. }
  74. }