StudioProxy.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections.Generic;
  2. using ET;
  3. using GFGGame;
  4. namespace ET
  5. {
  6. public class NoticeStudioPlayTimes : AMHandler<M2C_NoticeStudioPlayTimes>
  7. {
  8. protected override async ETTask Run(Session session, M2C_NoticeStudioPlayTimes message)
  9. {
  10. StudioDataManager.Instance.NoticeStudioPlayTimes(message);
  11. EventAgent.DispatchEvent(ConstMessage.NOTICE_STUDIO_PLAY_TIMES);
  12. await ETTask.CompletedTask;
  13. }
  14. }
  15. }
  16. namespace GFGGame
  17. {
  18. public class StudioProxy
  19. {
  20. //请求工作室副本数据
  21. public static async ETTask ReqStudioInfos()
  22. {
  23. M2C_GetStudioInfos response = null;
  24. response = (M2C_GetStudioInfos)await MessageHelper.SendToServer(new C2M_GetStudioInfos());
  25. if (response != null)
  26. {
  27. if (response.Error == ErrorCode.ERR_Success)
  28. {
  29. for (int i = 0; i < response.infos.Count; i++)
  30. {
  31. StudioData studioData = new StudioData { ChapterId = response.infos[i].ChapterId, BuyTimes = response.infos[i].BuyTimes, PlayTimes = response.infos[i].PlayTimes, TotalPlayTimes = response.infos[i].TotalPlayTimes };
  32. StudioDataManager.Instance.RspStudioInfos(studioData);
  33. }
  34. EventAgent.DispatchEvent(ConstMessage.GET_STUDIO_INFO);
  35. }
  36. }
  37. }
  38. //请求购买副本挑战次数
  39. public static async ETTask ReqBuyStudioPlayTimes(int chapterId, int buyType, int buyCount)
  40. {
  41. M2C_BuyStudioPlayTimes response = null;
  42. response = (M2C_BuyStudioPlayTimes)await MessageHelper.SendToServer(new C2M_BuyStudioPlayTimes() { ChapterId = chapterId, BuyType = buyType, BuyCount = buyCount });
  43. if (response != null)
  44. {
  45. if (response.Error == ErrorCode.ERR_Success)
  46. {
  47. StudioDataManager.Instance.RspBuyStudioPlayTimes(response.ChapterId, response.BuyTimes, response.TotalPlayTimes);
  48. EventAgent.DispatchEvent(ConstMessage.BUY_STUDIO_PLAY_TIMES);
  49. }
  50. }
  51. }
  52. }
  53. }