积分遮挡问题
This commit is contained in:
@@ -19,6 +19,9 @@ export class Block extends Laya.Script {
|
||||
@property(Number)
|
||||
public YGroup: number = 0
|
||||
|
||||
@property(Laya.Box)
|
||||
private obj_pos: Laya.Box
|
||||
|
||||
private sprite_show: Laya.Sprite
|
||||
private blockSize: number
|
||||
private obj_notes: Laya.Box
|
||||
@@ -31,11 +34,12 @@ export class Block extends Laya.Script {
|
||||
|
||||
private data: DOBlock
|
||||
|
||||
public onInit(XIndex: number, YIndex: number, XGroup: number, YGroup: number, handler: any, func: any): void {
|
||||
public onInit(XIndex: number, YIndex: number, XGroup: number, YGroup: number, obj_pos: Laya.Box, handler: any, func: any): void {
|
||||
this.XIndex = XIndex
|
||||
this.YIndex = YIndex
|
||||
this.XGroup = XGroup
|
||||
this.YGroup = YGroup
|
||||
this.obj_pos = obj_pos
|
||||
|
||||
this.sprite_show = this.owner.getChildByName("Sprite") as Laya.Sprite
|
||||
this.blockSize = this.sprite_show.width
|
||||
@@ -136,7 +140,7 @@ export class Block extends Laya.Script {
|
||||
if (this.data.get_checked()) {
|
||||
this.data.set_score(score)
|
||||
if (score > 0)
|
||||
G_ShowScoreTips(`+${score}`, this.owner)
|
||||
G_ShowScoreTips(`+${score}`, this.obj_pos)
|
||||
} else {
|
||||
if (this.data.get_score() !== 0)
|
||||
this.data.set_score(0)
|
||||
|
||||
@@ -45,6 +45,9 @@ export class Stage extends Laya.Script {
|
||||
@property(Laya.Box)
|
||||
public obj_blocks: Laya.Box
|
||||
|
||||
@property(Laya.Box)
|
||||
public obj_pos: Laya.Box
|
||||
|
||||
private blocks: Array<Block> = []
|
||||
|
||||
@property(Laya.Box)
|
||||
@@ -108,17 +111,21 @@ export class Stage extends Laya.Script {
|
||||
for (let i = 0; i < this.obj_blocks.numChildren; i++) {
|
||||
YGroup = i
|
||||
const ibox = this.obj_blocks.getChildAt(i)
|
||||
const pos_ibox = this.obj_pos.getChildAt(i)
|
||||
for (let j = 0; j < ibox.numChildren; j++) {
|
||||
XGroup = j
|
||||
const jbox = ibox.getChildAt(j)
|
||||
const VBox = jbox.getChildByName("VBox")
|
||||
const pos_jbox = pos_ibox.getChildAt(j)
|
||||
const pos_VBox = pos_jbox.getChildByName("VBox")
|
||||
for (let k = 0; k < VBox.numChildren; k++) {
|
||||
const kbox = VBox.getChildAt(k)
|
||||
const pos_kbox = pos_VBox.getChildAt(k)
|
||||
for (let l = 0; l < kbox.numChildren; l++) {
|
||||
const block = kbox.getChildAt(l).getComponent(Block)
|
||||
const XIndex = j * 3 + l
|
||||
const YIndex = i * 3 + k
|
||||
block.onInit(XIndex, YIndex, XGroup, YGroup, this, this.onClickBlock)
|
||||
block.onInit(XIndex, YIndex, XGroup, YGroup, pos_kbox.getChildAt(l) as Laya.Box, this, this.onClickBlock)
|
||||
this.blocks[XIndex + YIndex * 9] = block
|
||||
}
|
||||
}
|
||||
@@ -369,6 +376,7 @@ export class Stage extends Laya.Script {
|
||||
this.onApplyBlock(this.selectedBlock)
|
||||
}
|
||||
this.onSetBlock(this.selectedBlock)
|
||||
this.onUpdateCandys()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user