public bool InitChapterById(int chapterId, int[] chapterInfo, SubSceneType subType, ref bool isNextChapterUnlock) { isNextChapterUnlock = false; if (chapterInfo == null) { return(true); } m_ChapterId = chapterId; int index = 0; bool isLockChapter = true;//判断当前关卡是否解锁() for (index = 0; index < chapterInfo.Length; ++index) { if (index < sceneArr.Length && sceneArr[index] != null) { UIScene sceneScript = sceneArr[index]; if (sceneScript != null) { bool isLock = true; //星级 int grade = 0; RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (role_info != null) { if (!role_info.SceneInfo.ContainsKey(chapterInfo[index]) && chapterInfo[index] != -1) { //判断这一章是否已经全部打完 isNextChapterUnlock = false; } //判断是否已经打过 if (role_info.SceneInfo.ContainsKey(chapterInfo[index])) { isLock = false; int id_key = chapterInfo[index]; grade = role_info.SceneInfo[id_key]; } else if (UICurrentChapter.m_UnLockNextScene == false) { //每次初始化时、应该解锁下一关 UICurrentChapter.m_UnLockNextScene = true; isLock = false; } } if (isLock == false) { isLockChapter = false; } if (index == chapterInfo.Length - 1 && isNextChapterUnlock) { if (chapterInfo[index] == -1) { UICurrentChapter.m_UnLockNextScene = false; } } sceneScript.InitScene(chapterInfo[index], isLock, subType, grade); } } } return(isLockChapter); }