DailyWelfareSProxy.cs 3.2 KB

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