DailyWelfareSProxy.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using GFGGame;
  5. namespace GFGGame
  6. {
  7. public static class DailyWelfareSProxy
  8. {
  9. public static async ETTask<bool> ReqDailyTaskInfos()
  10. {
  11. M2C_GetDailyTaskInfos response = null;
  12. response = (M2C_GetDailyTaskInfos)await MessageHelper.SendToServer(new C2M_GetDailyTaskInfos());
  13. if (response != null)
  14. {
  15. if (response.Error == ErrorCode.ERR_Success)
  16. {
  17. for (int i = 0; i < response.TaskList.Count; i++)
  18. {
  19. TaskInfo taskInfo = new TaskInfo();
  20. taskInfo.id = response.TaskList[i].Id;
  21. taskInfo.state = response.TaskList[i].Status;
  22. taskInfo.progress = response.TaskList[i].Progress;
  23. DailyTaskDataManager.Instance.UpdateTaskInfo(taskInfo.id, taskInfo);
  24. }
  25. for (int i = 0; i < response.kLivenessBox.Count; i++)
  26. {
  27. DailyTaskDataManager.Instance.UpdateLivenessBoxInfo(response.kLivenessBox[i], response.vLivenessBox[i]);
  28. }
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. //每日签到
  35. public static async ETTask<bool> ReqSign(int taskId)
  36. {
  37. S2C_Sign response = null;
  38. response = (S2C_Sign)await MessageHelper.SendToServer(new C2S_Sign());
  39. if (response != null)
  40. {
  41. if (response.Error == ErrorCode.ERR_Success)
  42. {
  43. // DailyWelfareManager.Instance.DailySignDatas.Add(DateTime.Now.Day);
  44. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  45. BonusController.TryShowBonusList(bonus);
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. //补签
  52. public static async ETTask<bool> ReqReSign(int day)
  53. {
  54. S2C_ReSign response = null;
  55. response = (S2C_ReSign)await MessageHelper.SendToServer(new C2S_ReSign() { Day = day });
  56. if (response != null)
  57. {
  58. if (response.Error == ErrorCode.ERR_Success)
  59. {
  60. // DailyWelfareManager.Instance.DailySignDatas.Add(day);
  61. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  62. BonusController.TryShowBonusList(bonus);
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. //领取签到累计奖励
  69. public static async ETTask<bool> ReqGetSignReward(int day)
  70. {
  71. S2C_GetSignReward response = null;
  72. response = (S2C_GetSignReward)await MessageHelper.SendToServer(new C2S_GetSignReward() { Day = day });
  73. if (response != null)
  74. {
  75. if (response.Error == ErrorCode.ERR_Success)
  76. {
  77. // DailyWelfareManager.Instance.AccumulatedSignDatas.Add(day);
  78. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  79. BonusController.TryShowBonusList(bonus);
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. //领取/补领每日补给
  86. public static async ETTask<bool> ReqGetSupplyReward(int id)
  87. {
  88. S2C_GetSupplyReward response = null;
  89. response = (S2C_GetSupplyReward)await MessageHelper.SendToServer(new C2S_GetSupplyReward() { Id = id });
  90. if (response != null)
  91. {
  92. if (response.Error == ErrorCode.ERR_Success)
  93. {
  94. // DailyWelfareManager.Instance.SupplyRewardDatas.Add(id);
  95. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  96. BonusController.TryShowBonusList(bonus);
  97. return true;
  98. }
  99. }
  100. return false;
  101. }
  102. }
  103. }