暂停逻辑

This commit is contained in:
2025-05-30 19:09:06 +08:00
parent ddb00a010b
commit 6e53f18166
2 changed files with 12 additions and 1 deletions

View File

@@ -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<Laya.Sprite> = []
private tips_labels: Array<Laya.Label> = []
@@ -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)

View File

@@ -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)
}
}
}