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

const { ccclass, property } = cc._decorator;

@ccclass
export default class logPrefabScript extends cc.Component {

    @property(cc.Label)
    tabLab: cc.Label = null;

    @property(cc.Node)
    duihuaNode: cc.Node = null;


    start() {


    }

    setDailogShow(log, delayTime = 3) {
        this.tabLab.string = log
        this.duihuaNode.active = true
        this.duihuaNode.stopAllActions()
        cc.tween(this.duihuaNode)
            .delay(delayTime)
            .call(() => {
                this.duihuaNode.active = false
            })
            .start()
    }



    openTouchEvent(node) {
        node.on(cc.Node.EventType.TOUCH_START, this.touchStartNode, this)
        node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoveNode, this)
        node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEndNode, this)
        node.on(cc.Node.EventType.TOUCH_END, this.touchEndNode, this)
    }
    closeTouchEvent(node: cc.Node) {
        node.off(cc.Node.EventType.TOUCH_START, this.touchStartNode, this)
        node.off(cc.Node.EventType.TOUCH_MOVE, this.touchMoveNode, this)
        node.off(cc.Node.EventType.TOUCH_CANCEL, this.touchEndNode, this)
        node.off(cc.Node.EventType.TOUCH_END, this.touchEndNode, this)
    }

    touchStartNode(event) {
        let target = event.target

    }

    touchMoveNode(event) {



    }

    touchEndNode(event) {

        let target = event.target
        this.duihuaNode.active = false
        //
    }



    // update (dt) {}
}