StudioSProxy.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using cfg.GfgCfg;
  4. using ET;
  5. using GFGGame;
  6. namespace ET
  7. {
  8. public class NoticeFilingScoreBonusChanged : AMHandler<S2C_FilingScoreBonusChanged>
  9. {
  10. protected override async ETTask Run(Session session, S2C_FilingScoreBonusChanged message)
  11. {
  12. StudioDataManager.Instance.NoticeFilingScoreBonusChanged(message.ChapterId, message.ChapterScore,
  13. message.BonusStatusList);
  14. EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);
  15. EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
  16. await ETTask.CompletedTask;
  17. }
  18. }
  19. }
  20. namespace GFGGame
  21. {
  22. public class StudioSProxy
  23. {
  24. //请求工作室副本数据
  25. public static async ETTask ReqStudioInfos()
  26. {
  27. M2C_GetStudioInfos response = null;
  28. response = (M2C_GetStudioInfos)await MessageHelper.SendToServer(new C2M_GetStudioInfos());
  29. if (response != null)
  30. {
  31. if (response.Error == ErrorCode.ERR_Success)
  32. {
  33. for (int i = 0; i < response.infos.Count; i++)
  34. {
  35. StudioData studioData = new StudioData
  36. {
  37. ChapterId = response.infos[i].ChapterId, ChapterScore = response.infos[i].ChapterScore,
  38. RewardsStatus = response.infos[i].BonusStatusList
  39. };
  40. StudioDataManager.Instance.RspStudioInfos(studioData);
  41. }
  42. StudioDataManager.Instance.PorcelainTheme = response.RepairPorcelainTheme;
  43. }
  44. }
  45. }
  46. //领取查阅建档分数宝箱
  47. public static async ETTask ReqFilingScoreRewards(int chapterId)
  48. {
  49. S2C_GetFilingScoreBonus response = null;
  50. response = (S2C_GetFilingScoreBonus)await MessageHelper.SendToServer(new C2S_GetFilingScoreBonus()
  51. { ChapterId = chapterId });
  52. if (response != null)
  53. {
  54. if (response.Error == ErrorCode.ERR_Success)
  55. {
  56. List<ItemData> itemDatas = new List<ItemData>();
  57. for (int i = 0; i < response.BonusIndexList.Count; i++)
  58. {
  59. StudioDataManager.Instance.RspFilingScoreReward(response.ChapterId, response.BonusIndexList[i]);
  60. List<FilingRewardCfg> filingRewards =
  61. CommonDataManager.Tables.TblFilingRewardCfg.DataList.Where(a => a.Id == response.ChapterId)
  62. .ToList();
  63. var rewards = filingRewards[response.BonusIndexList[i]].Items;
  64. for (int j = 0; j < rewards.Count; j++)
  65. {
  66. itemDatas.Add(ItemUtil.createItemData(rewards[j].ToGfgGameItemParam()));
  67. }
  68. }
  69. BonusController.TryShowBonusList(itemDatas);
  70. EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);
  71. EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
  72. }
  73. }
  74. }
  75. }
  76. }