MainStorySProxy.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using ET;
  2. using GFGGame;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ET
  9. {
  10. public class M2C_NoticeMainStoryBoxBonusStateHandler : AMHandler<M2C_NoticeMainStoryBoxBonusState>
  11. {
  12. protected override async ETTask Run(Session session, M2C_NoticeMainStoryBoxBonusState message)
  13. {
  14. MainStoryDataManager.UpdateBoxBonusStates(message.ChapterId, message.BoxStates);
  15. EventAgent.DispatchEvent(ConstMessage.NOTICE_MAINSTORY_BOXBONUS_STATE);
  16. await ETTask.CompletedTask;
  17. }
  18. }
  19. }
  20. namespace GFGGame
  21. {
  22. public class MainStorySProxy
  23. {
  24. //请求剧情关卡数据
  25. public static async ETTask GetStoryBonusInfos()
  26. {
  27. M2C_GetMainStoryInfos response = null;
  28. response = (M2C_GetMainStoryInfos)await MessageHelper.SendToServer(new C2M_GetMainStoryInfos());
  29. if (response != null)
  30. {
  31. if (response.Error == ErrorCode.ERR_Success)
  32. {
  33. MainStoryDataManager.InitBoxBonusStates(response.KsBonusState, response.VsBonusState);
  34. }
  35. }
  36. }
  37. //请求剧情关卡数据
  38. public static async ETTask<bool> GetMainStoryBoxBonus(int chapterId, int index)
  39. {
  40. M2C_GetMainStoryBoxBonus response = null;
  41. response = (M2C_GetMainStoryBoxBonus)await MessageHelper.SendToServer(new C2M_GetMainStoryBoxBonus() { ChapterId = chapterId, Index = index });
  42. if (response != null)
  43. {
  44. if (response.Error == ErrorCode.ERR_Success)
  45. {
  46. MainStoryDataManager.UpdateBoxBonusStates(response.ChapterId, response.BoxStates);
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. }
  53. }