调整棋盘UI

This commit is contained in:
2025-05-30 08:54:57 +08:00
parent bb25aba93a
commit 74758b2322
4 changed files with 780 additions and 1048 deletions

View File

@@ -11,11 +11,11 @@ export class Candy extends Laya.Script {
private show: number
private left: number
public onInit(label_obj: Laya.Box, handler: any, func: any): void {
public onInit(handler: any, func: any): void {
this.owner.on(Laya.Event.CLICK, handler, func)
this.show_sprite = this.owner.getChildByName("Sprite") as Laya.Sprite
this.label_show = label_obj.getChildByName("label") as Laya.Label
this.label_left = label_obj.getChildByName("label_left") as Laya.Label
this.label_show = this.show_sprite.getChildByName("label") as Laya.Label
this.label_left = this.show_sprite.getChildByName("label_left") as Laya.Label
}
public setNoteStatus(note_open: boolean) {

View File

@@ -47,9 +47,6 @@ export class Stage extends Laya.Script {
@property(Laya.Box)
public obj_candys: Laya.Box
@property(Laya.Box)
public obj_candy_labels: Laya.Box
private candys: Array<Candy> = []
@property(Laya.Button)
@@ -125,12 +122,10 @@ export class Stage extends Laya.Script {
}
for (let i = 0; i < this.obj_candys.numChildren; i++) {
const hbox = this.obj_candys.getChildAt(i)
const l_hbox = this.obj_candy_labels.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
const candy = hbox.getChildAt(j).getComponent(Candy)
this.candys.push(candy)
const box = l_hbox.getChildAt(j) as Laya.Box
candy.onInit(box, this, this.onClickCandy)
candy.onInit(this, this.onClickCandy)
}
}