[LayaAir3]clickHandler只会执行一次,之后点击不再触发 laya.3.0.9
//组件被启用后执行,例如节点被添加到舞台后
onEnable(): void {
console.log("2d gamescene onEnable");
let btn:Laya.Button = LayaUtil.GetChildByPath(this.owner, "CreatePanel/BtnCreate");
btn.clickHandler = Laya.Handler.create(this, this.onClickCreate)
this.drawGrid();
}
onClickCreate()
{
// ()=>{
console.log("button CreateShovel 多次点击只会执行第一次")
M_GameScene.CreateShovel();
// }
}
onEnable(): void {
console.log("2d gamescene onEnable");
let btn:Laya.Button = LayaUtil.GetChildByPath(this.owner, "CreatePanel/BtnCreate");
btn.clickHandler = Laya.Handler.create(this, this.onClickCreate)
this.drawGrid();
}
onClickCreate()
{
// ()=>{
console.log("button CreateShovel 多次点击只会执行第一次")
M_GameScene.CreateShovel();
// }
}
没有找到相关结果
已邀请:
2 个回复
shiyang
赞同来自:
Laya_Fred
赞同来自: layabox 、勤