添加加载遮罩

This commit is contained in:
2025-05-29 17:28:40 +08:00
parent 2e7f15bf57
commit aefc0be816
3 changed files with 34 additions and 7 deletions

View File

@@ -7,8 +7,8 @@
"top": 0,
"bottom": 0,
"name": "Scene2D",
"width": 1080,
"height": 1920,
"width": 1920,
"height": 1080,
"_$comp": [
{
"_$type": "7bad1742-6eed-4d8d-81c0-501dc5bf03d6",
@@ -17,7 +17,10 @@
},
{
"_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac",
"scriptPath": "../src/models/UIManager.ts"
"scriptPath": "../src/models/UIManager.ts",
"mask": {
"_$ref": "2668mvhf"
}
}
],
"_$child": [
@@ -25,12 +28,25 @@
"_$id": "4rxcl2w3",
"_$type": "Panel",
"name": "UIRoot",
"x": -420,
"y": 420,
"width": 1920,
"height": 1080,
"_mouseState": 2,
"centerX": 0,
"centerY": 0
},
{
"_$id": "2668mvhf",
"_$type": "Image",
"name": "mask",
"width": 1920,
"height": 1080,
"alpha": 0,
"left": 0,
"right": 0,
"top": 0,
"bottom": 0,
"skin": "res://a98f334e-ce04-4cd0-8fc5-bbdf9b048609",
"color": "#ffffff"
}
]
}

View File

@@ -13,7 +13,7 @@ import { Stage } from "../views/Stage"
import { TopBar } from "../views/TopBar"
import { StorageManager } from "./StorageManager"
const { regClass } = Laya
const { regClass, property } = Laya
@regClass()
export class UIManager extends Laya.Script {
@@ -24,8 +24,15 @@ export class UIManager extends Laya.Script {
return UIManager._instance
}
@property(Laya.Image)
public mask: Laya.Image
onAwake(): void {
UIManager._instance = this
this.mask.on(Laya.Event.CLICK, this, ()=>{
console.log("on click mask >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
})
this.mask.visible = false
}
private UIRoot: Laya.Panel
@@ -77,10 +84,12 @@ export class UIManager extends Laya.Script {
}
public loadDCUI(): void {
this.mask.visible = true
Laya.loader.load(respath.dc_ui_res()).then((go) => {
const prefab = go.create()
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
this.dc_ui.loadWithMonth()
this.mask.visible = false
})
}
@@ -100,9 +109,11 @@ export class UIManager extends Laya.Script {
}
public loadTrophyUI(): void {
this.mask.visible = true
Laya.loader.load(respath.trophy_ui_res()).then((go) => {
const prefab = go.create()
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
this.mask.visible = false
})
}