IEnumerator Transition(string newSceneName) { Debug.Log(newSceneName + "正在加载"); m_Transitioning = true; QuestController.Instance.UnRegisterAllQuest(); //注销所有机关 yield return(SceneManager.LoadSceneAsync(newSceneName)); //异步加载新场景 m_CurrentZoneScene = SceneManager.GetActiveScene(); //存储游戏最高进度 if (m_currLevelIndex > highestProgress) { highestProgress = m_currLevelIndex; WriteLevelProgressToFile(); } if (!m_CurrentZoneScene.name.Equals("Start")) { //获取UI脚本 gamingUI = GameObject.Find("GameUI").GetComponent <GamingUI>(); //加载对应关卡的提示(碎片)进度 int level = m_currLevelIndex; level = level == 1 ? level - 1 : level - 2; gamingUI.SettipIndexes(stageProgress[level]); //加载非开始关卡的开始画面 LoadFirstStageGameObjects(); } //加载该关卡默认设置 LoadInitSetting(); Debug.Log(newSceneName + "已经加载完成"); m_Transitioning = false; }
/// <summary> /// 更新对应关卡的提示(碎片)游戏进度 /// </summary> /// <param name="stage"></param> public void UpdateStageProgress(int stage) { int level = m_currLevelIndex; level = level == 1 ? level - 1 : level - 2; if (stageProgress[level] < stage) { stageProgress[level] = stage; gamingUI.SettipIndexes(stage); } gamingUI.ShowForTime(4); WriteLevelProgressToFile(); }
private void Start() { //关卡初始化设置 if (!m_CurrentZoneScene.name.Equals("Start")) { //获取UI脚本 gamingUI = GameObject.Find("GameUI").GetComponent <GamingUI>(); //加载对应关卡的提示(碎片)进度 int level = m_currLevelIndex; level = level == 1 ? level - 1 : level - 2; gamingUI.SettipIndexes(stageProgress[level]); //加载非开始关卡的开始画面 LoadFirstStageGameObjects(); } //加载该关卡默认设置 LoadInitSetting(); }