整理层级

This commit is contained in:
2025-05-12 10:43:02 +08:00
parent cacd1c2574
commit 45d7df0184
9 changed files with 17567 additions and 792 deletions

View File

@@ -4,6 +4,9 @@ const { regClass, property } = Laya;
export class Block extends Laya.Script {
declare owner : Laya.Button;
private label_show: Laya.Label;
private tips_labels: Array<Laya.Label> = new Array();
@property(Number)
public XIndex: number = 0;
@property(Number)
@@ -18,7 +21,17 @@ export class Block extends Laya.Script {
private showNumber: number = 0;
private correctNumber: number = 0;
public onInit(XIndex: number, YIndex: number, XGroup: number, YGroup: number, handler: any, func: any): void {
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<VBox.numChildren; i++) {
var hbox = VBox.getChildAt(i);
for (var j=0; j<hbox.numChildren; j++) {
var Label = hbox.getChildAt(j) as Laya.Label
Label.text = ""
this.tips_labels.push(Label)
}
}
this.XIndex = XIndex;
this.YIndex = YIndex;
this.XGroup = XGroup;
@@ -63,14 +76,16 @@ export class Block extends Laya.Script {
updateBlock(): void {
if (this.showNumber > 0) {
this.owner.label = this.showNumber.toString();
if (this.checked)
this.owner.labelColors = "#000000,#000000,#000000"
else
this.owner.labelColors = "#ff0000,#ff0000,#ff0000"
this.label_show.text = this.showNumber.toString();
if (this.checked) {
this.label_show.color = "#000000"
}
else {
this.label_show.color = "#ff0000"
}
}
else {
this.owner.label = "";
this.label_show.text = "";
}
}