using System; using System.Collections.Generic; using System.Linq; using System.Text; using ET; namespace GFGGame { public class InstanceZonesSProxy { //请求剧情关卡数据 public static async ETTask GetInstanceZonesInfos() { M2C_GetInstanceZonesInfos response = null; response = (M2C_GetInstanceZonesInfos)await MessageHelper.SendToServer(new C2M_GetInstanceZonesInfos()); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { InstanceZonesDataManager.InitScoreList(response.ksScore, response.vsScore); InstanceZonesDataManager.InitStarList(response.ksStar, response.vsStar); InstanceZonesDataManager.InitLevelPass(response.ksPass, response.VsPass); EventAgent.DispatchEvent(ConstMessage.STORY_LEVEL_CHANGE); } } } //完成剧情对话关卡 public static async ETTask FinishStoryDialogLevel(int levelCfgId) { M2C_FinishInstanceZonesDialog response = null; response = (M2C_FinishInstanceZonesDialog)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesDialog() { LevelCfgId = levelCfgId }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { List bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, true); InstanceZonesDataManager.TrySetLevelPass(response.LevelCfgId); InstanceZonesController.OnFinishStoryLevel(levelCfgId, true, true); FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(response.LevelCfgId);//首次通过要检查是否有功能开启 BonusController.TryShowBonusList(bonusList); StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId); if (storyLevelCfg.type == ConstInstanceZonesType.Studio && storyLevelCfg.subType == ConstInstanceZonesSubType.Hard3) { StudioCfg filingCfg = StudioCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId); if(filingCfg.suitId != 0) { SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(filingCfg.suitId); if (suitCfg.syntheticStoryLevelId == levelCfgId && levelCfgId != StudioDataManager.Instance.GetLuckyBoxActivityID()) { PromptController.Instance.ShowFloatTextPrompt(string.Format("已解锁{0}套装制作", suitCfg.name)); } } } //if(storyLevelCfg.id == 100001001) //{ ////新玩家选择套装 //if (RoleInfoManager.Instance.NewRoleSuitStatus == false) //{ //ViewManager.Show(); //} //} EventAgent.DispatchEvent(ConstMessage.STORY_LEVEL_CHANGE); return; } } InstanceZonesController.OnFinishStoryLevel(levelCfgId, false, false); } //完成剧情战斗关卡 public static async ETTask FinishStoryFightLevel(int levelCfgId, int score, int npcScore, bool useRecomend) { M2C_FinishInstanceZonesFightLevel response = null; response = (M2C_FinishInstanceZonesFightLevel)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesFightLevel() { LevelCfgId = levelCfgId, Score = score, NpcScore = npcScore, UseRecommend = false }); bool isFirstFinish = false; if (response != null) { if (response.Error == ErrorCode.ERR_Success) { //更新数据 InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score); InstanceZonesDataManager.TryUpdateLevelStar(response.LevelCfgId, response.Star); //展示奖励 List bonusList = StoryBonusDataCache.GetBonusList(response.LevelCfgId, response.HasOnceBonus); if (response.RandomBonusList != null) { foreach (var item in response.RandomBonusList) { var itemData = ItemUtil.createItemData(item.ConfigId, item.Count); bonusList.Add(itemData); } } if (response.HasOnceBonus) { isFirstFinish = true; } InstanceZonesDataManager.TrySetLevelPass(response.LevelCfgId); ViewManager.Show(new StoryFightResultData { Result = true, Score = response.Score, FirstPass = response.HasOnceBonus, Star = response.Star, BonusList = bonusList }, true); if (response.HasOnceBonus) { FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(response.LevelCfgId); } return; } } InstanceZonesController.OnFinishStoryLevel(levelCfgId, false, false); if (isFirstFinish) { //首次通过要检查是否有功能开启 FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(response.LevelCfgId); EventAgent.DispatchEvent(ConstMessage.STORY_LEVEL_CHANGE); } } //剧情战斗关卡失败,更新最高分 public static async ETTask StoryFightLevelFail(int levelCfgId, int score) { M2C_FinishInstanceZonesFightLevelFail response = null; response = (M2C_FinishInstanceZonesFightLevelFail)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesFightLevelFail() { LevelCfgId = levelCfgId, Score = score, }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { InstanceZonesDataManager.TryUpdateScore(response.LevelCfgId, response.Score); } } } //快速完成关卡战斗 public static async ETTask> FinishStoryFightQuickly(int levelCfgId, int times) { M2C_FinishInstanceZonesFightQuickly response = null; response = (M2C_FinishInstanceZonesFightQuickly)await MessageHelper.SendToServer(new C2M_FinishInstanceZonesFightQuickly() { LevelCfgId = levelCfgId, Times = times }); if (response != null) { if (response.Error == ErrorCode.ERR_Success) { List> bonusLists = new List>(); List allList = new List(); foreach (var proto in response.RandomBonusList) { var itemData = ItemUtil.createItemData(proto.ConfigId, proto.Count); allList.Add(itemData); } var baseBonusList = StoryBonusDataCache.GetBaseBonusList(response.LevelCfgId); if (baseBonusList != null) { allList.AddRange(baseBonusList); } EventAgent.DispatchEvent(ConstMessage.FIGHT_QUICKLY); // var index = 0; // for (int i = 0; i < response.BonusLengths.Count; ++i) // { // var len = response.BonusLengths[i]; // var baseBonusList = StoryBonusDataCache.GetBaseBonusList(response.LevelCfgId); // List bonusList = new List(); // if (baseBonusList != null) // { // bonusList.AddRange(baseBonusList); // } // if (len > 0) // { // bonusList.AddRange(allList.GetRange(index, len)); // } // bonusLists.Add(bonusList); // index += len; // } return allList; // EventAgent.DispatchEvent(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, bonusLists); } } return null; } } }