//一刀切奖励脚本

cc.Class({
    extends: cc.Component,

    properties: {
        labNum: cc.Label,  //获得的金币数 
        labGold: cc.Label,  //胜利界面上用户拥有的金币   
        content: cc.Node,  //内容节点    
        _tempGold: null,
        
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},
    init: function(tempGold){
        this._tempGold =tempGold;
    },

    start () {
    },

    onEnable: function(){
        var actionScaleIn = cc.sequence(cc.scaleTo(0.3, 1.05, 1.05).easing(cc.easeCubicActionOut()),cc.scaleTo(0.1, 1, 1).easing(cc.easeCubicActionOut()));
        this.content.scale = 0.5;
        this.content.runAction(actionScaleIn);
    },

    onSure: function(){
        
        sdk.shareAppMessage({type:15,query:""});
        //埋点
        // sdk.setSceneEvent("结算","点击","炫耀有奖按钮",{},null);
        let shareFun11 =() =>{
            let zongGold =0;
            let gold =cc.HQ.GameMgr.getGold(); //显示用户金币数 
            this.labNum.string ="+"+this._tempGold;
            //用户拥有的金币数加上领取的金币数 
            zongGold =Number(gold)+this._tempGold;
            cc.HQ.GameMgr.setGold(zongGold);
            this.labGold.string =zongGold;

            cc.HQ.Global.showTips(2,"获得200金币!",1.5);     //一刀切奖励
            this.node.active =false;
        }
        cc.HQ.GameMgr.clickShare =true;
        cc.HQ.GameMgr.shareNum6++;
        cc.HQ.GameMgr.onSimulateShareBack(shareFun11,6);
    },

    //关闭按钮
    onClose: function(){
        this.node.active =false;
    },

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