加载预制
This commit is contained in:
@@ -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");
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user