重新摆放棋盘

This commit is contained in:
2025-05-29 15:37:45 +08:00
parent 6f3c1f9d6d
commit 4c2915ead8
7 changed files with 83648 additions and 78884 deletions

View File

@@ -42,9 +42,6 @@ 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> = []
@property(Laya.Box)
@@ -104,24 +101,26 @@ export class Stage extends Laya.Script {
this.btn_pause.on(Laya.Event.CLICK, this, () => {
UIManager.getInstance().loadGamePauseUI(this.data)
})
let XGroup = 0
let YGroup = 0
for (let i = 0; i < this.obj_blocks.numChildren; i++) {
const hbox = this.obj_blocks.getChildAt(i)
const l_hbox = this.obj_block_labels.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
const block = hbox.getChildAt(j).getComponent(Block)
this.blocks.push(block)
let XGroup = 0
if (j === 3 || j === 4 || j === 5)
XGroup = 1
if (j === 6 || j === 7 || j === 8)
XGroup = 2
let YGroup = 0
if (i === 3 || i === 4 || i === 5)
YGroup = 1
if (i === 6 || i === 7 || i === 8)
YGroup = 2
const l_vbox = l_hbox.getChildAt(j) as Laya.Box
block.onInit(j, i, XGroup, YGroup, l_vbox, this, this.onClickBlock)
YGroup = i
const ibox = this.obj_blocks.getChildAt(i)
for (let j = 0; j < ibox.numChildren; j++) {
XGroup = j
const jbox = ibox.getChildAt(j)
const VBox = jbox.getChildByName("VBox")
for (let k = 0; k < VBox.numChildren; k++) {
const kbox = VBox.getChildAt(k)
for (let l = 0; l < kbox.numChildren; l++) {
const block = kbox.getChildAt(l).getComponent(Block)
this.blocks.push(block)
const XIndex = j * 3 + l
const YIndex = i * 3 + k
block.onInit(XIndex, YIndex, XGroup, YGroup, this, this.onClickBlock)
}
}
}
}
for (let i = 0; i < this.obj_candys.numChildren; i++) {