mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 11:48:54 +00:00
23 lines
649 B
TypeScript
23 lines
649 B
TypeScript
import { _decorator, Component, Node, NodeEventType } from "cc";
|
|
import { ISignal } from "../../EventSystem/ISignal";
|
|
import { Signal } from "../../EventSystem/Signal";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass("UIButton")
|
|
export class UIButton extends Component {
|
|
private interactedEvent = new Signal<UIButton>();
|
|
|
|
public start(): void {
|
|
this.node.on(Node.EventType.TOUCH_START, this.interact, this);
|
|
}
|
|
|
|
public get InteractedEvent(): ISignal<UIButton> {
|
|
return this.interactedEvent;
|
|
}
|
|
|
|
private interact(): void {
|
|
console.log("interact");
|
|
this.interactedEvent.trigger(this);
|
|
}
|
|
}
|