Files
sudoku/src/models/UIManager.ts

37 lines
908 B
TypeScript
Raw Normal View History

2025-05-12 22:06:04 +08:00
import { respath } from "../constants/respath"
import { Home } from "../views/Home"
2025-05-09 19:10:40 +08:00
import { Stage } from "../views/Stage"
const { regClass, property } = Laya
@regClass()
export class UIManager extends Laya.Script {
2025-05-12 22:06:04 +08:00
declare owner: Laya.Scene
2025-05-09 19:10:40 +08:00
private static _instance: UIManager
onAwake(): void {
UIManager._instance = this
2025-05-12 22:06:04 +08:00
this.loadHome()
2025-05-09 19:10:40 +08:00
}
public static getInstance(): UIManager {
return UIManager._instance
}
2025-05-12 22:06:04 +08:00
public loadHome(): void {
Laya.loader.load(respath.home_ui_res).then((go)=>{
var prefab = go.create()
this.owner.addChild(prefab)
})
}
2025-05-09 19:10:40 +08:00
public loadStage(): void {
2025-05-12 22:06:04 +08:00
Laya.loader.load(respath.stage_ui_res).then((go)=>{
var prefab = go.create()
var stage = this.owner.addChild(prefab).getComponent(Stage)
stage.onLoadStage("aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC");
})
2025-05-09 19:10:40 +08:00
}
}