DailyWelfareSProxy.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System.Collections.Generic;
  2. using ET;
  3. namespace GFGGame
  4. {
  5. public static class DailyWelfareSProxy
  6. {
  7. //每日签到
  8. public static async ETTask<bool> ReqSign(int taskId)
  9. {
  10. S2C_Sign response = null;
  11. response = (S2C_Sign)await MessageHelper.SendToServer(new C2S_Sign());
  12. if (response != null)
  13. {
  14. if (response.Error == ErrorCode.ERR_Success)
  15. {
  16. // DailyWelfareManager.Instance.DailySignDatas.Add(DateTime.Now.Day);
  17. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  18. BonusController.TryShowBonusList(bonus);
  19. EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
  20. return true;
  21. }
  22. }
  23. return false;
  24. }
  25. //补签
  26. public static async ETTask<bool> ReqReSign(int day, int type)
  27. {
  28. S2C_ReSign response = null;
  29. response = (S2C_ReSign)await MessageHelper.SendToServer(new C2S_ReSign() { Day = day ,ConsumeType = type});
  30. if (response != null)
  31. {
  32. if (response.Error == ErrorCode.ERR_Success)
  33. {
  34. // DailyWelfareManager.Instance.DailySignDatas.Add(day);
  35. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  36. BonusController.TryShowBonusList(bonus);
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. //领取签到累计奖励
  43. public static async ETTask<bool> ReqGetSignReward(int day)
  44. {
  45. S2C_GetSignReward response = null;
  46. response = (S2C_GetSignReward)await MessageHelper.SendToServer(new C2S_GetSignReward() { Day = day });
  47. if (response != null)
  48. {
  49. if (response.Error == ErrorCode.ERR_Success)
  50. {
  51. // DailyWelfareManager.Instance.AccumulatedSignDatas.Add(day);
  52. List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
  53. BonusController.TryShowBonusList(bonus);
  54. EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. //领取/补领每日补给
  61. public static async ETTask<bool> ReqGetSupplyReward(int id)
  62. {
  63. S2C_GetSupplyReward response = null;
  64. response = (S2C_GetSupplyReward)await MessageHelper.SendToServer(new C2S_GetSupplyReward() { Id = id });
  65. if (response != null)
  66. {
  67. if (response.Error == ErrorCode.ERR_Success)
  68. {
  69. // DailyWelfareManager.Instance.SupplyRewardDatas.Add(id);
  70. DailySupplyCfg supplyCfg = DailySupplyCfgArray.Instance.GetCfg(id);
  71. BonusController.TryShowBonusList(supplyCfg.bonusArr);
  72. EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. }
  79. }