加载预制

This commit is contained in:
2025-05-12 22:06:04 +08:00
parent 2ca60b215b
commit 941dd170b5
10 changed files with 23405 additions and 23390 deletions

View File

@@ -1,26 +1,36 @@
import { respath } from "../constants/respath"
import { Home } from "../views/Home"
import { Stage } from "../views/Stage"
const { regClass, property } = Laya
@regClass()
export class UIManager extends Laya.Script {
@property(Stage)
public stage: Stage
declare owner: Laya.Scene
private static _instance: UIManager
onAwake(): void {
UIManager._instance = this
this.stage.owner.visible = false
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 {
this.stage.owner.visible = true
this.stage.onLoadStage("aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC");
Laya.loader.load(respath.stage_ui_res).then((go)=>{
var prefab = go.create()
var stage = this.owner.addChild(prefab).getComponent(Stage)
stage.onLoadStage("aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC");
})
}
}