41 lines
927 B
TypeScript
41 lines
927 B
TypeScript
import { respath } from "../constants/respath"
|
|
import { StorageManager } from "./StorageManager"
|
|
import { Stage } from "../views/Stage"
|
|
|
|
|
|
const { regClass, property } = Laya
|
|
|
|
@regClass()
|
|
export class UIManager extends Laya.Script {
|
|
declare owner: Laya.Scene
|
|
|
|
private static _instance: UIManager
|
|
onAwake(): void {
|
|
UIManager._instance = this
|
|
|
|
StorageManager.getInstance().init()
|
|
|
|
this.loadHome()
|
|
}
|
|
|
|
public static getInstance(): UIManager {
|
|
return UIManager._instance
|
|
}
|
|
|
|
public loadHome(): void {
|
|
Laya.loader.load(respath.home_ui_res).then((go)=>{
|
|
var prefab = go.create()
|
|
this.owner.addChild(prefab)
|
|
})
|
|
}
|
|
|
|
public loadStage(): void {
|
|
Laya.loader.load(respath.stage_ui_res).then((go)=>{
|
|
var prefab = go.create()
|
|
var stage = this.owner.addChild(prefab).getComponent(Stage)
|
|
stage.onLoadStage(StorageManager.getInstance().loadStage("first"))
|
|
})
|
|
}
|
|
|
|
}
|