添加加载遮罩

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, "top": 0,
"bottom": 0, "bottom": 0,
"name": "Scene2D", "name": "Scene2D",
"width": 1080, "width": 1920,
"height": 1920, "height": 1080,
"_$comp": [ "_$comp": [
{ {
"_$type": "7bad1742-6eed-4d8d-81c0-501dc5bf03d6", "_$type": "7bad1742-6eed-4d8d-81c0-501dc5bf03d6",
@@ -17,7 +17,10 @@
}, },
{ {
"_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac", "_$type": "cd70cd5e-b4cd-4277-ac0a-2224cfbe89ac",
"scriptPath": "../src/models/UIManager.ts" "scriptPath": "../src/models/UIManager.ts",
"mask": {
"_$ref": "2668mvhf"
}
} }
], ],
"_$child": [ "_$child": [
@@ -25,12 +28,25 @@
"_$id": "4rxcl2w3", "_$id": "4rxcl2w3",
"_$type": "Panel", "_$type": "Panel",
"name": "UIRoot", "name": "UIRoot",
"x": -420,
"y": 420,
"width": 1920, "width": 1920,
"height": 1080, "height": 1080,
"_mouseState": 2,
"centerX": 0, "centerX": 0,
"centerY": 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 { TopBar } from "../views/TopBar"
import { StorageManager } from "./StorageManager" import { StorageManager } from "./StorageManager"
const { regClass } = Laya const { regClass, property } = Laya
@regClass() @regClass()
export class UIManager extends Laya.Script { export class UIManager extends Laya.Script {
@@ -24,8 +24,15 @@ export class UIManager extends Laya.Script {
return UIManager._instance return UIManager._instance
} }
@property(Laya.Image)
public mask: Laya.Image
onAwake(): void { onAwake(): void {
UIManager._instance = this UIManager._instance = this
this.mask.on(Laya.Event.CLICK, this, ()=>{
console.log("on click mask >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
})
this.mask.visible = false
} }
private UIRoot: Laya.Panel private UIRoot: Laya.Panel
@@ -77,10 +84,12 @@ export class UIManager extends Laya.Script {
} }
public loadDCUI(): void { public loadDCUI(): void {
this.mask.visible = true
Laya.loader.load(respath.dc_ui_res()).then((go) => { Laya.loader.load(respath.dc_ui_res()).then((go) => {
const prefab = go.create() const prefab = go.create()
this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge) this.dc_ui = this.getUIRoot().addChild(prefab).getComponent(DailyChallenge)
this.dc_ui.loadWithMonth() this.dc_ui.loadWithMonth()
this.mask.visible = false
}) })
} }
@@ -100,9 +109,11 @@ export class UIManager extends Laya.Script {
} }
public loadTrophyUI(): void { public loadTrophyUI(): void {
this.mask.visible = true
Laya.loader.load(respath.trophy_ui_res()).then((go) => { Laya.loader.load(respath.trophy_ui_res()).then((go) => {
const prefab = go.create() const prefab = go.create()
this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom) this.trophyRoom = this.getUIRoot().addChild(prefab).getComponent(TrophyRoom)
this.mask.visible = false
}) })
} }

View File

@@ -254,7 +254,7 @@ export class DailyChallenge extends Laya.Script {
this.selectedUnit.setSelected(true) this.selectedUnit.setSelected(true)
const stageID = `${unit.year}-${unit.month}-${unit.day}` const stageID = `${unit.year}-${unit.month}-${unit.day}`
this.label_date.text = `${config.MONTH_ABBRS[unit.month - 1]} ${unit.day},${unit.year}` this.label_date.text = `${config.MONTH_ABBRS[unit.month - 1]} ${unit.day}, ${unit.year}`
const user = StorageManager.getInstance().getUser() const user = StorageManager.getInstance().getUser()
const progress = user.get_done(stageID) const progress = user.get_done(stageID)
// console.log("onApplyUnit >>>>>", stageID, progress) // console.log("onApplyUnit >>>>>", stageID, progress)