using ET; using GFGGame; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ET { public class M2C_NoticeMainStoryBoxBonusStateHandler : AMHandler { protected override async ETTask Run(Session session, M2C_NoticeMainStoryBoxBonusState message) { var levelCfg = StoryLevelCfgArray.Instance.GetCfg(message.LevelCfgId); MainStoryDataManager.UpdateBoxBonusStates(levelCfg.chapterId, message.BoxStates); EventAgent.DispatchEvent(ConstMessage.NOTICE_MAINSTORY_BOXBONUS_STATE); await ETTask.CompletedTask; } } } namespace GFGGame { public class MainStorySProxy { //请求剧情关卡数据 public static async ETTask GetStoryInfos() { M2C_GetMainStoryInfos response = null; response = (M2C_GetMainStoryInfos)await MessageHelper.SendToServer(new C2M_GetMainStoryInfos()); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { MainStoryDataManager.InitBoxBonusStates(response.ksBonusState, response.vsBonusState); } } } //请求剧情关卡数据 public static async ETTask GetMainStoryBoxBonus(int chapterId, int index) { M2C_GetMainStoryBoxBonus response = null; response = (M2C_GetMainStoryBoxBonus)await MessageHelper.SendToServer(new C2M_GetMainStoryBoxBonus() { ChapterId = chapterId, Index = index }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { MainStoryDataManager.UpdateBoxBonusStates(response.ChapterId, response.BoxStates); return true; } } return false; } } }