// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.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

cc.Class({
    extends: cc.Component,

    properties: {
        border:cc.Node,
        chatCar:cc.Node,
        auctionBegins:cc.Node,
        addPrice:cc.Node,
        giveUp:cc.Node,
        hand:cc.Node,
        buttonAudio: {
            default: null,
            type: cc.AudioClip
        },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},
    playMusic(){
        let audioId = cc.audioEngine.playEffect(this.buttonAudio, false);
        cc.audioEngine.setVolume(audioId, 0.5);
    },
    clickYes(){
        this.playMusic()
        this.node.active=false
        this.border.active=true
        this.chatCar.active=true
        this.addPrice.active = true
        this.giveUp.active = true
        this.hand.active = true
        var action = cc.moveTo(1.5, 240, -302.578);
        this.hand.runAction(action);
        this.schedule(function () {    // 计时器将每隔 1s 执行一次。
            this.chatCar.active=false 
            this.auctionBegins.active = false
        }, 2);
    },
    clickNo(){
        this.playMusic()
        this.node.active=false
        this.auctionBegins.active = false
        this.addPrice.active = true
        this.giveUp.active = true
        this.hand.active = true
        var action = cc.moveTo(1.5, 240, -302.578);
        this.hand.runAction(action);
    },

    start () {

    },

    // update (dt) {},
});
