JM_KA/assets/Script/Engine/Component/Button/BlockDoubleClickButton.ts

27 lines
660 B
TypeScript
Raw Normal View History

2022-08-26 16:48:17 +08:00
const { ccclass, requireComponent, menu, property } = cc._decorator;
@ccclass
@menu("Plug-in/Button/BlockDoubleClickButton")
@requireComponent(cc.Button)
export default class BlockDoubleClickButton extends cc.Component {
//#region Lifecycle
protected onEnable(): void {
this.node.on("click", this.OnClickNode, this);
}
protected onDisable(): void {
this.node.off("click", this.OnClickNode, this);
}
//#endregion
//#region Event
public OnClickNode(event: cc.Button, customEventData: any): void {
this.getComponent(cc.Button).interactable = false;
}
//#endregion
}