RechargeSProxy.cs 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using ET;
  2. namespace GFGGame
  3. {
  4. public class RechargeSProxy
  5. {
  6. public static async ETTask ReqRecharge(int rechargeId)
  7. {
  8. M2C_Recharge response = null;
  9. response = (M2C_Recharge)await MessageHelper.SendToServer(new C2M_Recharge() { RechargeId = rechargeId });
  10. if (response != null)
  11. {
  12. if (response.Error == ErrorCode.ERR_Success)
  13. {
  14. RechargeDataManager.Instance.UpdateRechargeData(response.RechargeId, response.RechargedTimes);
  15. PromptController.Instance.ShowFloatTextPrompt("虚拟充值成功", MessageType.SUCCESS);
  16. }
  17. }
  18. }
  19. public static async ETTask ReqRechargeInfo()
  20. {
  21. M2C_GetRechargeInfo response = null;
  22. response = (M2C_GetRechargeInfo)await MessageHelper.SendToServer(new C2M_GetRechargeInfo() { });
  23. if (response != null)
  24. {
  25. if (response.Error == ErrorCode.ERR_Success)
  26. {
  27. for (int i = 0; i < response.ks.Count; i++)
  28. {
  29. RechargeDataManager.Instance.UpdateRechargeData(response.ks[i], response.vs[i]);
  30. }
  31. }
  32. }
  33. }
  34. public static async ETTask ReqRequestGiftBagInfo()
  35. {
  36. M2C_RequestGiftBagInfo response = null;
  37. response = (M2C_RequestGiftBagInfo)await MessageHelper.SendToServer(new C2M_RequestGiftBagInfo() { });
  38. if (response != null)
  39. {
  40. if (response.Error == ErrorCode.ERR_Success)
  41. {
  42. for (int i = 0; i < response.ks.Count; i++)
  43. {
  44. RechargeDataManager.Instance.UpdateGiftData(response.ks[i], response.vs[i]);
  45. }
  46. }
  47. }
  48. }
  49. public static async ETTask<bool> ReqBuyGiftBag(int giftId)
  50. {
  51. M2C_BuyGiftBag response = null;
  52. response = (M2C_BuyGiftBag)await MessageHelper.SendToServer(new C2M_BuyGiftBag() { GiftBagId = giftId });
  53. if (response != null)
  54. {
  55. if (response.Error == ErrorCode.ERR_Success)
  56. {
  57. RechargeDataManager.Instance.UpdateGiftData(response.GiftBagId, response.BuyTimes);
  58. BonusController.TryShowBonusList(GiftBagCfgArray.Instance.GetCfg(response.GiftBagId).itemsArr);
  59. EventAgent.DispatchEvent(ConstMessage.BUY_GIFT_SUCCESS);
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. public static async ETTask ReqExchangeInfo()
  66. {
  67. M2C_RequestShopExchangeInfo response = null;
  68. response = (M2C_RequestShopExchangeInfo)await MessageHelper.SendToServer(new C2M_RequestShopExchangeInfo() { });
  69. if (response != null)
  70. {
  71. if (response.Error == ErrorCode.ERR_Success)
  72. {
  73. for (int i = 0; i < response.ks.Count; i++)
  74. {
  75. RechargeDataManager.Instance.UpdateExchangeData(response.ks[i], response.vs[i]);
  76. }
  77. }
  78. }
  79. }
  80. public static async ETTask ReqExchangeShopItem(int exchangeId)
  81. {
  82. M2C_ExchangeShopItem response = null;
  83. response = (M2C_ExchangeShopItem)await MessageHelper.SendToServer(new C2M_ExchangeShopItem() { ExchangeId = exchangeId });
  84. if (response != null)
  85. {
  86. if (response.Error == ErrorCode.ERR_Success)
  87. {
  88. RechargeDataManager.Instance.UpdateExchangeData(response.ExchangeId, response.ExchangeTimes);
  89. }
  90. }
  91. }
  92. }
  93. }