ShopSProxy.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using ET;
  2. namespace GFGGame
  3. {
  4. public class ShopSProxy
  5. {
  6. // public static async ETTask<bool> ShopBuy(int shopType, int buyId, long buyCount)
  7. // {
  8. // M2C_ShopBuy response = null;
  9. // response = (M2C_ShopBuy)await MessageHelper.SendToServer(new C2M_ShopBuy() { ShopType = shopType, BuyId = buyId, BuyCount = (int)buyCount });
  10. // if (response != null)
  11. // {
  12. // if (response.Error == ErrorCode.ERR_Success)
  13. // {
  14. // // EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
  15. // return true;
  16. // }
  17. // }
  18. // return false;
  19. // }
  20. public static async ETTask<bool> ReqShopInfo()
  21. {
  22. S2C_RequestShopInfo response = null;
  23. response = (S2C_RequestShopInfo)await MessageHelper.SendToServer(new C2S_RequestShopInfo());
  24. if (response != null)
  25. {
  26. if (response.Error == ErrorCode.ERR_Success)
  27. {
  28. for (int i = 0; i < response.ks.Count; i++)
  29. {
  30. ShopDataManager.Instance.UpdateGiftData(response.ks[i], response.vs[i]);
  31. }
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. public static async ETTask<bool> ReqShopBuy(int buyId, long buyCount)
  38. {
  39. S2C_ShopBuy response = null;
  40. response = (S2C_ShopBuy)await MessageHelper.SendToServer(new C2S_ShopBuy() { BuyId = buyId, Times = (int)buyCount });
  41. if (response != null)
  42. {
  43. if (response.Error == ErrorCode.ERR_Success)
  44. {
  45. ShopDataManager.Instance.UpdateGiftData(response.BuyId, response.TotalTimes);
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. }
  52. }