MainStorySProxy.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(message.LevelCfgId);
  15. MainStoryDataManager.UpdateBoxBonusStates(levelCfg.chapterId, message.BoxStates);
  16. EventAgent.DispatchEvent(ConstMessage.NOTICE_MAINSTORY_BOXBONUS_STATE);
  17. await ETTask.CompletedTask;
  18. }
  19. }
  20. }
  21. namespace GFGGame
  22. {
  23. public class MainStorySProxy
  24. {
  25. //请求剧情关卡数据
  26. public static async ETTask GetStoryInfos()
  27. {
  28. M2C_GetMainStoryInfos response = null;
  29. response = (M2C_GetMainStoryInfos)await MessageHelper.SendToServer(new C2M_GetMainStoryInfos());
  30. if (response != null)
  31. {
  32. if (response.Error == ErrorCode.ERR_Success)
  33. {
  34. MainStoryDataManager.InitBoxBonusStates(response.ksBonusState, response.vsBonusState);
  35. }
  36. }
  37. }
  38. //请求剧情关卡数据
  39. public static async ETTask<bool> GetMainStoryBoxBonus(int chapterId, int index)
  40. {
  41. M2C_GetMainStoryBoxBonus response = null;
  42. response = (M2C_GetMainStoryBoxBonus)await MessageHelper.SendToServer(new C2M_GetMainStoryBoxBonus() { ChapterId = chapterId, Index = index });
  43. if (response != null)
  44. {
  45. if (response.Error == ErrorCode.ERR_Success)
  46. {
  47. MainStoryDataManager.UpdateBoxBonusStates(response.ChapterId, response.BoxStates);
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. }
  54. }