public override IEnumerator OnInit(object userdata = null) { sceneID = (int)userdata; SceneTableSetting setting = SceneTableSettings.Get(sceneID); if (setting == null) { yield break; } yield return(base.OnInit(userdata)); }
protected override void OnUpdate() { base.OnUpdate(); if (lastLoadState != loadState) { lastLoadState = loadState; switch (loadState) { case LoadState.None: loadState = LoadState.CheckValid; break; case LoadState.CheckValid: SceneTableSetting setting = SceneTableSettings.Get(nextSceneID); if (setting == null) { Debug.LogError("要加载的场景不存在表中"); loadState = LoadState.Failed; return; } sceneTable = setting; loadState = LoadState.CloseForms; break; case LoadState.CloseForms: Game.UI.CloaseAllForm(Table.Id); loadState = LoadState.LoadScene; break; case LoadState.LoadScene: LoadScene(nextSceneID); break; case LoadState.ClearMemery: ClearMemery(); loadState = LoadState.InitNextProcedure; break; case LoadState.InitNextProcedure: if (sceneTable.Procedure != "NULL") { ProcedureManager.ChangeProcedure(sceneTable.Procedure); } break; case LoadState.Success: Game.Sound.StopAll(sceneTable.BGM); Game.Sound.Play(sceneTable.BGM); break; case LoadState.Failed: break; default: break; } } if (progress < 100) { progress += 3; } if (progress >= 100f * ((float)loadState / (float)LoadState.Success)) { progress = 100f * ((float)loadState / (float)LoadState.Success); } sliderProgress.value = progress / 100f; if (progress >= 100f) { Game.UI.CloseForm <WND_Loading>(); } }