// 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: {
        downLoad:cc.Node,
        downLoadElse:cc.Node,
        audio: {
            default: null,
            type: cc.AudioClip
        },
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
       if(this.pochan){
        console.log(this.pochan.scale)
       }
    },
    onDownLoad(e){
        // $('#btn').on('touchstart', function (e) {
            window.playableSDK.sendEvent('clickFinishDownloadBar', {
                section: 'section2',
                area: 'area3'
            });
            window.playableSDK.openAppStore()


        // })
    },
    agin(){
        if(localStorage.getItem('agin')){
            window.playableSDK.sendEvent('clickResurrection', { section: 'section2', area: 'area3' });
            window.playableSDK.openAppStore()
        }else{
            cc.director.loadScene("index");
            localStorage.setItem('agin',1)
        }
            
        
       
    },
    start () {
        let audioId = cc.audioEngine.playEffect(this.audio, false);
        cc.audioEngine.setVolume(audioId, 0.5);
    },

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