private void JudgeChaptersOpen() { for (int i = 0; i < _chapterList.Count; i++) { CapsuleChapterVo chapter = _chapterList[i]; var firstLevel = chapter.LevelList[0]; int beforeLevelId = firstLevel.BeforeLevelId; if (beforeLevelId == 0) { _firstNormalLevel = firstLevel; chapter.IsNormalOpen = true; } else { var level = GetLevelInfo(beforeLevelId); chapter.IsNormalOpen = level.IsPass; } } _newNormalLevel = GetNewLevel(_firstNormalLevel); }
/// <summary> /// 设置扭蛋战斗关卡Data /// </summary> /// <param name="pbs"></param> /// <param name="plotRule"></param> /// <param name="infoRule"></param> public void SetCapsuleBattleData(ActivityVo curActivity) { _curActivity = curActivity; var pbs = GetLevelRule(curActivity.ActivityId);//GlobalData.ActivityModel.BaseTemplateActivityRule.ActivityLevelRules; _capsuleBattleLevelDict = new Dictionary <int, CapsuleLevelVo>(); _chapterList = new List <CapsuleChapterVo>(); CapsuleChapterVo chapter = null; Dictionary <int, CapsuleChapterVo> chapterDict = new Dictionary <int, CapsuleChapterVo>(); var plotRule = GlobalData.LevelModel.PlotRule; var infoRule = GlobalData.LevelModel.InfoRule; foreach (var t in pbs) { var level = new CapsuleLevelVo(); level.SetData(t, plotRule, infoRule); _capsuleBattleLevelDict.Add(level.LevelId, level); if (chapterDict.ContainsKey(level.ChapterGroup) == false) { chapter = new CapsuleChapterVo(); chapterDict[level.ChapterGroup] = chapter; chapter.LevelList = new List <CapsuleLevelVo>(); chapter.HardLevelList = new List <CapsuleLevelVo>(); chapter.ChapterId = level.ChapterGroup; for (int j = 0; j < infoRule.Count; j++) { var info = infoRule[j]; if (info.InfoType == 1 && info.InfoId == level.ChapterGroup) { chapter.ChapterName = info.LevelName; chapter.ChapterDesc = info.LevelDesc; break; } } } if (level.Hardness == GameTypePB.Difficult) { chapterDict[level.ChapterGroup].HardLevelList.Add(level); } else { chapterDict[level.ChapterGroup].LevelList.Add(level); } } foreach (var chapterVo in chapterDict) { _chapterList.Add(chapterVo.Value); if (chapterDict.ContainsKey(chapterVo.Value.ChapterId + 1)) { chapterVo.Value.NextChapterVo = chapterDict[chapterVo.Value.ChapterId + 1]; } if (chapterDict.ContainsKey(chapterVo.Value.ChapterId - 1)) { chapterVo.Value.PrevChapterVo = chapterDict[chapterVo.Value.ChapterId - 1]; } } Debug.LogError("ChapterList.Count===>" + _chapterList.Count); }