const { regClass, property } = Laya; @regClass() export class Block extends Laya.Script { declare owner : Laya.Button; private label_show: Laya.Label; private tips_labels: Array = new Array(); @property(Number) public XIndex: number = 0; @property(Number) public YIndex: number = 0; @property(Number) public XGroup: number = 0; @property(Number) public YGroup: number = 0; private preset: boolean = false//预设格子 private checked: boolean = false//正确格子 private showNumber: number = 0; private correctNumber: number = 0; public onInit(label_obj: Laya.Box, XIndex: number, YIndex: number, XGroup: number, YGroup: number, handler: any, func: any): void { this.label_show = label_obj.getChildByName("label_show") as Laya.Label var VBox = label_obj.getChildByName("VBox") for (var i=0; i>>>>", showNumber, this.correctNumber, this.XIndex, this.YIndex) if (this.checked == false) { if (showNumber == this.correctNumber) this.checked = true; this.showNumber = showNumber; this.updateBlock(); } return this.checked } updateBlock(): void { if (this.showNumber > 0) { this.label_show.text = this.showNumber.toString(); if (this.checked) { this.label_show.color = "#000000" } else { this.label_show.color = "#ff0000" } } else { this.label_show.text = ""; } } }