RechargeSProxy.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 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. }
  59. }
  60. }
  61. public static async ETTask ReqExchangeInfo(int giftId)
  62. {
  63. M2C_RequestShopExchangeInfo response = null;
  64. response = (M2C_RequestShopExchangeInfo)await MessageHelper.SendToServer(new C2M_RequestShopExchangeInfo() { });
  65. if (response != null)
  66. {
  67. if (response.Error == ErrorCode.ERR_Success)
  68. {
  69. for (int i = 0; i < response.ks.Count; i++)
  70. {
  71. RechargeDataManager.Instance.UpdateExchangeData(response.ks[i], response.vs[i]);
  72. }
  73. }
  74. }
  75. }
  76. public static async ETTask ReqExchangeShopItem(int exchangeId)
  77. {
  78. M2C_ExchangeShopItem response = null;
  79. response = (M2C_ExchangeShopItem)await MessageHelper.SendToServer(new C2M_ExchangeShopItem() { ExchangeId = exchangeId });
  80. if (response != null)
  81. {
  82. if (response.Error == ErrorCode.ERR_Success)
  83. {
  84. RechargeDataManager.Instance.UpdateExchangeData(response.ExchangeId, response.ExchangeTimes);
  85. }
  86. }
  87. }
  88. }
  89. }