暂停逻辑
This commit is contained in:
@@ -21,6 +21,7 @@ export class Block extends Laya.Script {
|
|||||||
|
|
||||||
private sprite_show: Laya.Sprite
|
private sprite_show: Laya.Sprite
|
||||||
private blockSize: number
|
private blockSize: number
|
||||||
|
private obj_notes: Laya.Box
|
||||||
private label_show: Laya.Label
|
private label_show: Laya.Label
|
||||||
private tips_bgs: Array<Laya.Sprite> = []
|
private tips_bgs: Array<Laya.Sprite> = []
|
||||||
private tips_labels: Array<Laya.Label> = []
|
private tips_labels: Array<Laya.Label> = []
|
||||||
@@ -40,7 +41,8 @@ export class Block extends Laya.Script {
|
|||||||
this.blockSize = this.sprite_show.width
|
this.blockSize = this.sprite_show.width
|
||||||
this.label_show = this.owner.getChildByName("label_show") as Laya.Label
|
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++) {
|
for (let i = 0; i < notes.numChildren; i++) {
|
||||||
const hbox = notes.getChildAt(i)
|
const hbox = notes.getChildAt(i)
|
||||||
for (let j = 0; j < hbox.numChildren; j++) {
|
for (let j = 0; j < hbox.numChildren; j++) {
|
||||||
@@ -61,6 +63,12 @@ export class Block extends Laya.Script {
|
|||||||
this.updateBlock()
|
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 {
|
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.clear()
|
||||||
this.sprite_show.graphics.drawRect(0, 0, this.blockSize, this.blockSize, color)
|
this.sprite_show.graphics.drawRect(0, 0, this.blockSize, this.blockSize, color)
|
||||||
|
|||||||
@@ -164,6 +164,9 @@ export class Stage extends Laya.Script {
|
|||||||
if (Stage._instance) {
|
if (Stage._instance) {
|
||||||
Stage._instance.paused = arg
|
Stage._instance.paused = arg
|
||||||
Stage._instance.obj_mask.visible = arg
|
Stage._instance.obj_mask.visible = arg
|
||||||
|
for (let i = 0; i < Stage._instance.blocks.length; i++) {
|
||||||
|
Stage._instance.blocks[i].setPaused(arg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user