public void OnLoadBackgroundSceneComplete(Transform backgroundRootTf) { System.Type classType = System.Type.GetType(_curLoadedBgCfg.className); _currentBg = System.Activator.CreateInstance(classType) as BackgroundBase; _currentBg.Init(backgroundRootTf); _curLoadedBgCfg = null; CommandManager.GetInstance().RunCommand(CommandConsts.STGLoadStageDefaultBgComplete); }
/// <summary> /// 加载背景 -- 同步方法 /// </summary> /// <param name="id"></param> public void LoadBackground(string id) { StageBgCfg cfg = GetBackgroundCfgById(id); if (cfg == null) { Logger.LogError("Background cfg with id " + id + " is not exist"); } SceneManager.LoadScene(cfg.sceneName, LoadSceneMode.Single); }
/// <summary> /// 加载关卡的默认背景 /// </summary> /// <param name="stageName"></param> public void LoadStageDefaultBg(string stageName) { string bgId = GetStageDefaultBgId(stageName); _curLoadedBgCfg = GetBackgroundCfgById(bgId); if (_curLoadedBgCfg != null) { //LoadBackgroundByBgName(_curLoadedBgCfg.sceneName); LoadBackgroundAsyncByBgName(_curLoadedBgCfg.sceneName); } }