From 6e53f18166a416f8d5ca7344d21f4678fb21755f Mon Sep 17 00:00:00 2001 From: yangwen Date: Fri, 30 May 2025 19:09:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=81=9C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Block.ts | 10 +++++++++- src/views/Stage.ts | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/Block.ts b/src/views/Block.ts index b2b1352..0738a7d 100644 --- a/src/views/Block.ts +++ b/src/views/Block.ts @@ -21,6 +21,7 @@ export class Block extends Laya.Script { private sprite_show: Laya.Sprite private blockSize: number + private obj_notes: Laya.Box private label_show: Laya.Label private tips_bgs: Array = [] private tips_labels: Array = [] @@ -40,7 +41,8 @@ export class Block extends Laya.Script { this.blockSize = this.sprite_show.width this.label_show = this.owner.getChildByName("label_show") as Laya.Label - const notes = this.owner.getChildByName("notes") + const notes = this.owner.getChildByName("notes") as Laya.Box + this.obj_notes = notes for (let i = 0; i < notes.numChildren; i++) { const hbox = notes.getChildAt(i) for (let j = 0; j < hbox.numChildren; j++) { @@ -61,6 +63,12 @@ export class Block extends Laya.Script { this.updateBlock() } + public setPaused(paused: boolean): void { + this.sprite_show.visible = !paused + this.obj_notes.visible = !paused + this.label_show.visible = !paused + } + public setBlockColor(color: string, alpha: number = 1, animated: boolean = false, completedColor: string = "", completedAlpha: number = 1): void { this.sprite_show.graphics.clear() this.sprite_show.graphics.drawRect(0, 0, this.blockSize, this.blockSize, color) diff --git a/src/views/Stage.ts b/src/views/Stage.ts index ea98933..19388b6 100644 --- a/src/views/Stage.ts +++ b/src/views/Stage.ts @@ -164,6 +164,9 @@ export class Stage extends Laya.Script { if (Stage._instance) { Stage._instance.paused = arg Stage._instance.obj_mask.visible = arg + for (let i = 0; i < Stage._instance.blocks.length; i++) { + Stage._instance.blocks[i].setPaused(arg) + } } }