整理层级
This commit is contained in:
@@ -13,10 +13,14 @@ export class Stage extends Laya.Script {
|
||||
|
||||
@property(Laya.Box)
|
||||
public obj_blocks: Laya.Box;
|
||||
@property(Laya.Box)
|
||||
public obj_block_labels: Laya.Box;
|
||||
private blocks: Array<Block> = new Array();
|
||||
|
||||
@property(Laya.Box)
|
||||
public obj_candys: Laya.Box;
|
||||
@property(Laya.Box)
|
||||
public obj_candy_labels: Laya.Box;
|
||||
private candys: Array<Candy> = new Array();
|
||||
|
||||
@property(Laya.Box)
|
||||
@@ -63,6 +67,7 @@ export class Stage extends Laya.Script {
|
||||
|
||||
for (var i=0; i<this.obj_blocks.numChildren; i++) {
|
||||
var hbox = this.obj_blocks.getChildAt(i);
|
||||
var l_hbox = this.obj_block_labels.getChildAt(i);
|
||||
for (var j=0; j<hbox.numChildren; j++) {
|
||||
var block = hbox.getChildAt(j).getComponent(Block);
|
||||
this.blocks.push(block);
|
||||
@@ -76,13 +81,15 @@ export class Stage extends Laya.Script {
|
||||
YGroup = 1
|
||||
if (j==6 || j==7 || j==8)
|
||||
YGroup = 2
|
||||
block.onInit(i, j, XGroup, YGroup, this, this.onClickBlock)
|
||||
var l_vbox = l_hbox.getChildAt(j) as Laya.Box
|
||||
block.onInit(l_vbox, i, j, XGroup, YGroup, this, this.onClickBlock)
|
||||
}
|
||||
}
|
||||
for (var i=0; i<this.obj_candys.numChildren; i++) {
|
||||
var candy = this.obj_candys.getChildAt(i).getComponent(Candy);
|
||||
this.candys.push(candy);
|
||||
candy.onInit(i+1, this, this.onClickCandy)
|
||||
var box = this.obj_candy_labels.getChildAt(i) as Laya.Box
|
||||
candy.onInit(box, i+1, this, this.onClickCandy)
|
||||
}
|
||||
|
||||
this.obj_block_colors.visible = false
|
||||
|
||||
Reference in New Issue
Block a user