| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 | using System.Collections.Generic;using ET;using GFGGame;namespace ET{    public class NoticeStudioPlayTimes : AMHandler<M2C_NoticeStudioPlayTimes>    {        protected override async ETTask Run(Session session, M2C_NoticeStudioPlayTimes message)        {            StudioDataManager.Instance.NoticeStudioPlayTimes(message.ChapterId, message.PlayTimes);            EventAgent.DispatchEvent(ConstMessage.NOTICE_STUDIO_PLAY_TIMES);            await ETTask.CompletedTask;        }    }    public class NoticeFilingScoreBonusChanged : AMHandler<S2C_FilingScoreBonusChanged>    {        protected override async ETTask Run(Session session, S2C_FilingScoreBonusChanged message)        {            StudioDataManager.Instance.NoticeFilingScoreBonusChanged(message.ChapterId, message.ChapterScore, message.BonusStatusList);            EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);            EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);            await ETTask.CompletedTask;        }    }}namespace GFGGame{    public class StudioSProxy    {        //请求工作室副本数据        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, ChapterScore = response.infos[i].ChapterScore, RewardsStatus = response.infos[i].BonusStatusList };                        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);                }            }        }        //领取查阅建档分数宝箱        public static async ETTask ReqFilingScoreRewards(int chapterId)        {            S2C_GetFilingScoreBonus response = null;            response = (S2C_GetFilingScoreBonus)await MessageHelper.SendToServer(new C2S_GetFilingScoreBonus() { ChapterId = chapterId });            if (response != null)            {                if (response.Error == ErrorCode.ERR_Success)                {                    List<ItemData> itemDatas = new List<ItemData>();                    for (int i = 0; i < response.BonusIndexList.Count; i++)                    {                        StudioDataManager.Instance.RspFilingScoreReward(response.ChapterId, response.BonusIndexList[i]);                        List<FilingRewardCfg> filingRewards = FilingRewardCfgArray.Instance.GetCfgsByid(response.ChapterId);                        int[][] rewards = filingRewards[response.BonusIndexList[i]].itemsArr;                        for (int j = 0; j < rewards.Length; j++)                        {                            itemDatas.Add(ItemUtil.createItemData(rewards[j]));                        }                    }                    BonusController.TryShowBonusList(itemDatas);                    EventAgent.DispatchEvent(ConstMessage.FILING_SCORE_CHANGE);                    EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);                }            }        }    }}
 |