import { SceneId } from '../../../framework/scene/SceneNavigator'; import { LaunchContext, LaunchState, LaunchStateId } from './LaunchState'; export class PreloadLobbyState implements LaunchState { readonly id = LaunchStateId.PreloadLobby; async enter(context: LaunchContext): Promise { context.progress({ state: this.id, title: '预加载资源' }); try { await context.kernel.scenes.preload(SceneId.Lobby); } catch (error) { context.error = error; const retry = await context.dialog({ title: "", message: '加载失败,是否重试', lblOK: "重试", }); if (retry) { return LaunchStateId.CheckVersion; } throw error; } context.progress({ state: this.id, progress: 0.9 }); return LaunchStateId.EnterLobby; } }