using System.Collections.Generic; using ET; using GFGGame; namespace ET { public class NoticeStudioPlayTimes : AMHandler { protected override async ETTask Run(Session session, M2C_NoticeStudioPlayTimes message) { StudioDataManager.Instance.NoticeStudioPlayTimes(message); EventAgent.DispatchEvent(ConstMessage.NOTICE_STUDIO_PLAY_TIMES); await ETTask.CompletedTask; } } } namespace GFGGame { public class StudioProxy { //请求工作室副本数据 public static async ETTask ReqStudioInfos() { M2C_GetStudioInfos response = null; response = (M2C_GetStudioInfos)await MessageHelper.SendToServer(new C2M_GetStudioInfos()); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { for (int i = 0; i < response.infos.Count; i++) { StudioData studioData = new StudioData { ChapterId = response.infos[i].ChapterId, BuyTimes = response.infos[i].BuyTimes, PlayTimes = response.infos[i].PlayTimes, TotalPlayTimes = response.infos[i].TotalPlayTimes }; StudioDataManager.Instance.RspStudioInfos(studioData); } EventAgent.DispatchEvent(ConstMessage.GET_STUDIO_INFO); } } } //请求购买副本挑战次数 public static async ETTask ReqBuyStudioPlayTimes(int chapterId, int buyType, int buyCount) { M2C_BuyStudioPlayTimes response = null; response = (M2C_BuyStudioPlayTimes)await MessageHelper.SendToServer(new C2M_BuyStudioPlayTimes() { ChapterId = chapterId, BuyType = buyType, BuyCount = buyCount }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { StudioDataManager.Instance.RspBuyStudioPlayTimes(response.ChapterId, response.BuyTimes, response.TotalPlayTimes); EventAgent.DispatchEvent(ConstMessage.BUY_STUDIO_PLAY_TIMES); } } } } }