StudioSProxy.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.ChapterId, message.PlayTimes);
  11. EventAgent.DispatchEvent(ConstMessage.NOTICE_STUDIO_PLAY_TIMES);
  12. await ETTask.CompletedTask;
  13. }
  14. }
  15. public class NoticeFilingScoreBonusChanged : AMHandler<S2C_FilingScoreBonusChanged>
  16. {
  17. protected override async ETTask Run(Session session, S2C_FilingScoreBonusChanged message)
  18. {
  19. StudioDataManager.Instance.NoticeFilingScoreBonusChanged(message.ChapterId, message.ChapterScore, message.BonusStatusList);
  20. EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);
  21. await ETTask.CompletedTask;
  22. }
  23. }
  24. }
  25. namespace GFGGame
  26. {
  27. public class StudioSProxy
  28. {
  29. //请求工作室副本数据
  30. public static async ETTask ReqStudioInfos()
  31. {
  32. M2C_GetStudioInfos response = null;
  33. response = (M2C_GetStudioInfos)await MessageHelper.SendToServer(new C2M_GetStudioInfos());
  34. if (response != null)
  35. {
  36. if (response.Error == ErrorCode.ERR_Success)
  37. {
  38. for (int i = 0; i < response.infos.Count; i++)
  39. {
  40. StudioData studioData = new StudioData { ChapterId = response.infos[i].ChapterId, BuyTimes = response.infos[i].BuyTimes, PlayTimes = response.infos[i].PlayTimes, TotalPlayTimes = response.infos[i].TotalPlayTimes, ChapterScore = response.infos[i].ChapterScore, };
  41. StudioDataManager.Instance.RspStudioInfos(studioData);
  42. }
  43. // EventAgent.DispatchEvent(ConstMessage.GET_STUDIO_INFO);
  44. }
  45. }
  46. }
  47. //请求购买副本挑战次数
  48. public static async ETTask ReqBuyStudioPlayTimes(int chapterId, int buyType, int buyCount)
  49. {
  50. M2C_BuyStudioPlayTimes response = null;
  51. response = (M2C_BuyStudioPlayTimes)await MessageHelper.SendToServer(new C2M_BuyStudioPlayTimes() { ChapterId = chapterId, BuyType = buyType, BuyCount = buyCount });
  52. if (response != null)
  53. {
  54. if (response.Error == ErrorCode.ERR_Success)
  55. {
  56. StudioDataManager.Instance.RspBuyStudioPlayTimes(response.ChapterId, response.BuyTimes, response.TotalPlayTimes);
  57. EventAgent.DispatchEvent(ConstMessage.BUY_STUDIO_PLAY_TIMES);
  58. }
  59. }
  60. }
  61. //领取查阅建档分数宝箱
  62. public static async ETTask ReqFilingScoreRewards(int chapterId)
  63. {
  64. S2C_GetFilingScoreBonus response = null;
  65. response = (S2C_GetFilingScoreBonus)await MessageHelper.SendToServer(new C2S_GetFilingScoreBonus() { ChapterId = chapterId });
  66. if (response != null)
  67. {
  68. if (response.Error == ErrorCode.ERR_Success)
  69. {
  70. StudioDataManager.Instance.RspFilingScoreReward(response.ChapterId, response.BonusIndexList);
  71. EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);
  72. }
  73. }
  74. }
  75. }
  76. }