更新棋子状态效果
This commit is contained in:
@@ -129,7 +129,7 @@ export class Stage extends Laya.Script {
|
||||
for (let j = 0; j < hbox.numChildren; j++) {
|
||||
const candy = hbox.getChildAt(j).getComponent(Candy)
|
||||
this.candys.push(candy)
|
||||
candy.onInit(this, this.onClickCandy)
|
||||
candy.onInit(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +340,9 @@ export class Stage extends Laya.Script {
|
||||
this.selectedBlock.setSelected(true)
|
||||
this.onSetBlock(this.selectedBlock)
|
||||
this.data.set_select_index(this.selectedBlock.getData().get_index())
|
||||
for (let i = 0; i < this.candys.length; i++) {
|
||||
this.candys[i].setAvailableStatus(this.selectedBlock.getData().get_checked() === false)
|
||||
}
|
||||
}
|
||||
|
||||
onClickBlock(evt: Laya.Event): void {
|
||||
@@ -534,14 +537,6 @@ export class Stage extends Laya.Script {
|
||||
}
|
||||
}
|
||||
|
||||
public onClickCandy(evt: Laya.Event): void {
|
||||
const candy = evt.target.getComponent(Candy)
|
||||
this.onApplyCandy(candy.get_show(), false)
|
||||
const sp = evt.target.getChildByName("offset") as Laya.Sprite
|
||||
Laya.Tween.to(sp, { scaleX: 0.9, scaleY: 0.9 }, 100, Laya.Ease.linearIn)
|
||||
Laya.Tween.to(sp, { scaleX: 1, scaleY: 1 }, 100, Laya.Ease.linearInOut, null, 100)
|
||||
}
|
||||
|
||||
onKeyUp(evt: Laya.Event): void {
|
||||
const n = Number(evt.key)
|
||||
if (n && n > 0) {
|
||||
|
||||
Reference in New Issue
Block a user