// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class Sample extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;
    @property(cc.Node)
    testNode: cc.Node = null;

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        cc.log("test")
        this.testNode.on(cc.Node.EventType.TOUCH_START, () => {
            this.label.string = 'touch start';
        }, this);

        this.testNode.on(cc.Node.EventType.TOUCH_CANCEL, () => {
            this.label.string = 'touch cancel';
        }, this);
        this.testNode.on(cc.Node.EventType.TOUCH_END, () => {
            this.label.string = 'touch end';
        }, this);
    }

    // update (dt) {}
}
