12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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<M2C_NoticeMainStoryBoxBonusState>
- {
- 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<bool> 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;
- }
- }
- }
|