//说明提示弹窗脚本
var TableReader =require("TableReader");

cc.Class({
    extends: cc.Component,

    properties: {
        knifeIcon: cc.Sprite,  //飞镖皮肤显示   
        labTitle: cc.Label,  //飞镖标题说明 
        labContent: cc.Label,  //飞镖数量 
        labExplain: cc.Label,  //对此飞镖的解释说明
        content: cc.Node,  //内容节点
        knife: cc.Node,   //一把飞镖节点
        knifeSp: cc.Sprite, //一把飞镖显示的皮肤
        knifeNum: cc.Node, //三把飞镖节点
        pumpNode: cc.Node,  //飞刀特效
        pumpNode1: cc.Node, //飞刀特效1
        threeDartBtn: cc.Node, //三镖齐发按钮
        textBg: cc.Node,
        labSanNum: cc.Label,  //显示三镖齐发还有几次用完
        labTinian: cc.Label, //显示体验次数
        titleSp: [cc.SpriteFrame],  //新武器图片或三镖齐发图片
        topSp: cc.Sprite, //弹框标题图片
        kuang: cc.Sprite,  //武器皮肤底框
        kuangSp: cc.SpriteFrame,  //武器皮肤底框精灵
        sanWeapon: cc.SpriteFrame,
        videoIcon: cc.Node,  //看视频图标
        videoIcon1: cc.Node,  //视频图标(屠龙刀)
        baodaoBtn: cc.Node,  //宝刀推荐按钮
        _type: null,  //免费领取三飞镖 或 皮肤
        _skinId: null,  //新皮肤
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
    },

    onEnable: function(){
        //免费领取按钮上，要不要显示视频图片
        let state =cc.HQ.GameMgr.onShareVideoState(sdk.getConfig2().model.v8);
        if(state){
            if(this._type ==3){
                this.videoIcon1.active =true;
            }else{
                this.videoIcon1.active =false;    
            }
        }else{
            if(this._type ==3){
                this.videoIcon1.active =false;
            }else{
                this.videoIcon1.active =false;    
            }
        }
        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);
    },

    init: function(data){
        if(data.type ==1){
            this._type =data.type;
            this.topSp.spriteFrame =this.titleSp[0];
            this.kuang.node.setPosition(-121,30);
            this.kuang.spriteFrame =null;
            this.knifeIcon.spriteFrame=this.sanWeapon;
        }else if(data.type ==2){
            this._type =data.type;
            this.topSp.spriteFrame =this.titleSp[1];
            this.kuang.node.setPosition(-121,30);
            this.kuang.spriteFrame =this.kuangSp;
            this.knifeIcon.node.scale =0.5; 
            this._skinId =Number(data.skinId);
            let tempData =TableReader.getTableRowByNum("knifeItems",this._skinId);
            //飞镖皮肤图片显示
            cc.HQ.GameMgr.onReplaceKnife(this.knifeIcon,tempData);
            //存体验皮肤
            cc.HQ.Local.knifeSkinId =this._skinId;   //存体验的皮肤
            cc.HQ.Local.weaponSkin =10;   //体验的皮肤体验的次数
            //体验飞刀皮肤就不显示飞刀特效了
            this.pumpNode.active =false;
            this.pumpNode1.active =false;
        }else if(data.type ==3){
            //特效皮肤武器 (屠龙刀)
            this._type =data.type;
            this.topSp.spriteFrame =this.titleSp[1];
            this.kuang.node.setPosition(-7,30);
            this.kuang.spriteFrame =this.kuangSp;
            this.knifeIcon.node.scale =0.5;
            this._skinId =Number(data.skinId);
            let tempData =TableReader.getTableRowByNum("knifeItems",this._skinId);
            //飞镖皮肤图片显示
            cc.HQ.GameMgr.onReplaceKnife(this.knifeIcon,tempData);
            cc.HQ.Local.weaponSkin =0;
            let skin =null;
            if(cc.HQ.Local.weaponSkin>0){  //皮肤体验的还有次数
                skin =TableReader.getTableRowByNum("knifeItems",cc.HQ.Local.knifeSkinId);
                // this.threeDartBtn.active =false;   //隐藏三飞镖按钮
            }else{
                let userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
                skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
                // this.threeDartBtn.active =true;   //显示三飞镖按钮
            }
            //更换飞刀图片
            if(cc.HQ.Local.weaponClones && cc.HQ.Local.weaponClones>0){
                let sanKnife =this.knifeNum.getComponent("sanlaunch");
                let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
                for(let i=0;i<arr.length;i++){
                    //更换飞刀图片
                    cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
                }
            }else{
                // cc.HQ.GameMgr.onReplaceKnife(this.knife.getComponent(cc.Sprite),skin);  
                cc.HQ.GameMgr.onReplaceKnife(this.knifeSp,skin);  
            }
        }

        //弹框中内容显示
        this.labTitle.string =data.title;
        this.labContent.string =data.content;
        this.labExplain.string =data.explain;
    },

    //免费领取按钮
    onFreeToReceive: function(){
        if(this._type == 1){
            //分享或视频模式
            cc.HQ.GameMgr.shareOrVideo(sdk.getConfig2().model.v1,this.onVideo,this.onShare,1);
            //埋点
            // sdk.setSceneEvent("游戏弹框","点击","三镖齐发-免费领取按钮",{},null);
        }else if(this._type ==2){
            //分享或视频模式
            cc.HQ.GameMgr.shareOrVideo(sdk.getConfig2().model.v2,this.onVideo1,this.onShare1,1);
            //埋点
            // sdk.setSceneEvent("游戏弹框","点击","新武器-免费领取按钮",{},null);
        }else if(this._type ==3){
            //分享或视频模式
            cc.HQ.GameMgr.shareOrVideo(sdk.getConfig2().model.v8,this.onVideo2,this.onShare2,1);
            //埋点
            // sdk.setSceneEvent("游戏弹框","点击","屠龙刀-免费领取按钮",{},null);
            // //获得新的皮肤飞刀
            // let arr =cc.HQ.GameMgr.getKnife();
            // if(typeof(arr)=="string"){
            //     arr =arr.split(",");
            // }
            // console.log("屠龙宝刀皮肤飞刀",this._skinId);
            // arr.push(this._skinId);
            // cc.HQ.GameMgr.setKnife(arr);  
            // this.node.active =false;
            // cc.HQ.Global.showTips(2,"恭喜获得使用屠龙宝刀飞镖!",0.2);
            // //当前装备的飞刀皮肤
            // cc.HQ.GameMgr.setCurKnife(this._skinId);
            // //更换飞刀图片
            // let userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
            // let skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
            // if(cc.HQ.Local.weaponClones){
            //     let sanKnife =this.knifeNum.getComponent("sanlaunch");
            //     let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
            //     for(let i=0;i<arr.length;i++){
            //         //更换飞刀图片
            //         cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
            //     }
            // }else{
            //     console.log("屠龙刀$$$$$",Number(userCurWeapan));
            //     // cc.HQ.GameMgr.onReplaceKnife(this.knife.getComponent(cc.Sprite),skin);
            //     cc.HQ.GameMgr.onReplaceKnife(this.knifeSp,skin);
            //     if(Number(userCurWeapan) ==82){   //特定的飞刀就显示飞刀特效
            //         this.pumpNode.active =true;
            //         this.pumpNode1.active =true;
            //     }else{
            //         this.pumpNode.active =false;
            //         this.pumpNode1.active =false;    
            //     }
            // }
            // //屠龙宝刀按钮隐藏
            // this.baodaoBtn.active =false;
            // //记录获得获得屠龙刀的时间
            // let date =Date.now();   //当天的当前时间
            // cc.HQ.GameMgr.setBaodaoTime(date);
        }
    },

    //调视频
    onVideo: function(data,type,isValue){
        // console.log("模式切换-2",data,type);
        sdk.videoSuccess = function(){
            //视频成功处理逻辑
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            cc.HQ.Local.weaponClones =5;
            bouncedJS.labSanNum.node.active =true;
            bouncedJS.textBg.active =true;
            bouncedJS.labSanNum.string ="X"+cc.HQ.Local.weaponClones;
            bouncedJS.knifeNum.active =true;
            bouncedJS.knife.active =false;
            bouncedJS.threeDartBtn.active =false;
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得三镖齐发*5!",0.2);

            let skin =null;
            let userCurWeapan =null;
            if(cc.HQ.Local.weaponSkin>0){  //皮肤体验的还有次数
                skin =TableReader.getTableRowByNum("knifeItems",cc.HQ.Local.knifeSkinId);
            }else{
                userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
                console.log("一镖变三镖",Number(userCurWeapan));
                skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
            }
            if(cc.HQ.Local.weaponClones){
                let sanKnife =bouncedJS.knifeNum.getComponent("sanlaunch");
                let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
                for(let i=0;i<arr.length;i++){
                    //更换飞刀图片
                    // cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
                    let spriteWeapon =arr[i].getChildByName("knifeSp").getComponent(cc.Sprite);
                    cc.HQ.GameMgr.onReplaceKnife(spriteWeapon,skin);
                    if(cc.HQ.Local.weaponSkin<=0 && cc.HQ.GameMgr.onCheckStarand(userCurWeapan)){   //特定的飞刀就显示飞刀特效
                        // this.pumpNode.active =true;
                        // this.pumpNode1.active =true;
                        arr[i].getChildByName("pumpNode").active =true;
                        arr[i].getChildByName("pumpNode1").active =true;
                    }else{
                        // this.pumpNode.active =false;
                        // this.pumpNode1.active =false; 
                        arr[i].getChildByName("pumpNode").active =false;
                        arr[i].getChildByName("pumpNode1").active =false;
                    }
                }
            }
            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }.bind(this);
        sdk.videoFail = function(){
            //视频失败处理逻辑
            console.log("视频未看完");
        };
        var videoAd = sdk.createRewardedVideoAd(sdk.getConfig2().videoIdArr[0]);
        videoAd.load().then(() => videoAd.show());
    },

    onShare: function(data,type,isValue){
        sdk.shareAppMessage({type:2,query:""});
        let shareFun1 =function(){
            console.log("老子响应的是三飞镖齐发");
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            cc.HQ.Local.weaponClones =5;
            bouncedJS.labSanNum.node.active =true;
            bouncedJS.textBg.active =true;
            bouncedJS.labSanNum.string ="X"+cc.HQ.Local.weaponClones;
            bouncedJS.knifeNum.active =true;
            bouncedJS.knife.active =false;
            bouncedJS.threeDartBtn.active =false;
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得三镖齐发*5!",0.2);

            let skin =null;
            let userCurWeapan =null;
            if(cc.HQ.Local.weaponSkin>0){  //皮肤体验的还有次数
                skin =TableReader.getTableRowByNum("knifeItems",cc.HQ.Local.knifeSkinId);
            }else{
                userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
                console.log("一镖变三镖",Number(userCurWeapan));
                skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
            }
            if(cc.HQ.Local.weaponClones){
                let sanKnife =bouncedJS.knifeNum.getComponent("sanlaunch");
                let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
                for(let i=0;i<arr.length;i++){
                    //更换飞刀图片
                    // cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
                    let spriteWeapon =arr[i].getChildByName("knifeSp").getComponent(cc.Sprite);
                    cc.HQ.GameMgr.onReplaceKnife(spriteWeapon,skin);
                    if(cc.HQ.Local.weaponSkin<=0 && cc.HQ.GameMgr.onCheckStarand(userCurWeapan)){   //特定的飞刀就显示飞刀特效
                        // this.pumpNode.active =true;
                        // this.pumpNode1.active =true;
                        arr[i].getChildByName("pumpNode").active =true;
                        arr[i].getChildByName("pumpNode1").active =true;
                    }else{
                        // this.pumpNode.active =false;
                        // this.pumpNode1.active =false; 
                        arr[i].getChildByName("pumpNode").active =false;
                        arr[i].getChildByName("pumpNode1").active =false;
                    }
                }
            }
            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }
        cc.HQ.GameMgr.clickShare =true;
        cc.HQ.GameMgr.shareNum++;
        cc.HQ.GameMgr.onSimulateShareBack(shareFun1,0);
        // cc.HQ.GameMgr.clickShare =true;
    },

    //调视频
    onVideo1: function(data,type,isValue){
        sdk.videoSuccess = function(){
            //视频成功处理逻辑
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            //获得新的皮肤飞刀
            let arr =cc.HQ.GameMgr.getKnife();
            if(typeof(arr)=="string"){
                arr =arr.split(",");
            }
            console.log("更新随到皮肤飞刀",bouncedJS._skinId);
            arr.push(bouncedJS._skinId);
            cc.HQ.GameMgr.setKnife(arr);  
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得新飞镖!",0.2);
            //当前装备的飞刀皮肤
            cc.HQ.GameMgr.setCurKnife(bouncedJS._skinId);

            //若领取了这皮肤，这存临时体验皮肤的变量就变成初始状态
            cc.HQ.Local.knifeSkinId =null;   //存体验的皮肤
            cc.HQ.Local.weaponSkin =0;   //体验的皮肤体验的次数
            bouncedJS.textBg.active =false;
            bouncedJS.labTinian.node.active =false;
            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }.bind(this);
        sdk.videoFail = function(){
            //视频失败处理逻辑
            console.log("视频未看完");
        };
        var videoAd = sdk.createRewardedVideoAd(sdk.getConfig2().videoIdArr[0]);
        videoAd.load().then(() => videoAd.show());
    },

    onShare1: function(data,type,isValue){
        sdk.shareAppMessage({type:3,query:""});
        let shareFun2 =function(){
            console.log("老子响应的是飞镖皮肤");
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            //获得新的皮肤飞刀
            let arr =cc.HQ.GameMgr.getKnife();
            if(typeof(arr)=="string"){
                arr =arr.split(",");
            }
            console.log("更新随到皮肤飞刀",bouncedJS._skinId);
            arr.push(bouncedJS._skinId);
            cc.HQ.GameMgr.setKnife(arr);  
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得新飞镖!",0.2);
            //当前装备的飞刀皮肤
            cc.HQ.GameMgr.setCurKnife(bouncedJS._skinId);

            //若领取了这皮肤，这存临时体验皮肤的变量就变成初始状态
            cc.HQ.Local.knifeSkinId =null;   //存体验的皮肤
            cc.HQ.Local.weaponSkin =0;   //体验的皮肤体验的次数
            bouncedJS.textBg.active =false;
            bouncedJS.labTinian.node.active =false;
            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }
        cc.HQ.GameMgr.clickShare =true;
        cc.HQ.GameMgr.shareNum1++;
        cc.HQ.GameMgr.onSimulateShareBack(shareFun2,1);
    },

    //调视频
    onVideo2: function(data,type,isValue){
        sdk.videoSuccess = function(){
            //视频成功处理逻辑
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            //获得新的皮肤飞刀
            let arr =cc.HQ.GameMgr.getKnife();
            if(typeof(arr)=="string"){
                arr =arr.split(",");
            }
            console.log("屠龙宝刀皮肤飞刀",bouncedJS._skinId);
            arr.push(bouncedJS._skinId);
            cc.HQ.GameMgr.setKnife(arr);  
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得屠龙宝刀!",0.8);
            //当前装备的飞刀皮肤
            cc.HQ.GameMgr.setCurKnife(bouncedJS._skinId);
            //更换飞刀图片
            let userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
            let skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
            if(cc.HQ.Local.weaponClones){
                let sanKnife =bouncedJS.knifeNum.getComponent("sanlaunch");
                let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
                for(let i=0;i<arr.length;i++){
                    //更换飞刀图片
                    // cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
                    let spriteWeapon =arr[i].getChildByName("knifeSp").getComponent(cc.Sprite);
                    cc.HQ.GameMgr.onReplaceKnife(spriteWeapon,skin);
                    if(Number(userCurWeapan) ==82){   //特定的飞刀就显示飞刀特效
                        // this.pumpNode.active =true;
                        // this.pumpNode1.active =true;
                        arr[i].getChildByName("pumpNode").active =true;
                        arr[i].getChildByName("pumpNode1").active =true;
                    }else{
                        // this.pumpNode.active =false;
                        // this.pumpNode1.active =false; 
                        arr[i].getChildByName("pumpNode").active =false;
                        arr[i].getChildByName("pumpNode1").active =false;
                    }
                }
            }else{
                console.log("屠龙刀$$$$$",Number(userCurWeapan));
                // cc.HQ.GameMgr.onReplaceKnife(this.knife.getComponent(cc.Sprite),skin);
                cc.HQ.GameMgr.onReplaceKnife(bouncedJS.knifeSp,skin);
                if(Number(userCurWeapan) ==82){   //特定的飞刀就显示飞刀特效
                    bouncedJS.pumpNode.active =true;
                    bouncedJS.pumpNode1.active =true;
                }else{
                    bouncedJS.pumpNode.active =false;
                    bouncedJS.pumpNode1.active =false;    
                }
            }
            cc.HQ.GameMgr.bdtips =true;
            //屠龙宝刀按钮隐藏
            bouncedJS.baodaoBtn.active =false;
            //记录获得获得屠龙刀的时间
            let date =Date.now();   //当天的当前时间
            cc.HQ.GameMgr.setBaodaoTime(date);
            console.log("屠龙刀使用时间记录1",date);

            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }.bind(this);
        sdk.videoFail = function(){
            //视频失败处理逻辑
            console.log("视频未看完");
        };
        var videoAd = sdk.createRewardedVideoAd(sdk.getConfig2().videoIdArr[1]);
        videoAd.load().then(() => videoAd.show());
    },

    onShare2: function(data,type,isValue){
        sdk.shareAppMessage({type:11,query:""});
        let shareFun9 =function(){
            // console.log("老子响应的屠龙刀皮肤");
            var bouncedJS =cc.find("Canvas").getChildByName("bouncedTips").getComponent("bouncedTipsUI");
            //获得新的皮肤飞刀
            let arr =cc.HQ.GameMgr.getKnife();
            if(typeof(arr)=="string"){
                arr =arr.split(",");
            }
            // console.log("屠龙宝刀皮肤飞刀",bouncedJS._skinId);
            arr.push(bouncedJS._skinId);
            cc.HQ.GameMgr.setKnife(arr);  
            bouncedJS.node.active =false;
            cc.HQ.Global.showTips(2,"恭喜获得屠龙宝刀!",0.8);
            //当前装备的飞刀皮肤
            cc.HQ.GameMgr.setCurKnife(bouncedJS._skinId);
            //更换飞刀图片
            let userCurWeapan =cc.HQ.GameMgr.getCurKnife();  //当前装备的飞刀
            let skin =TableReader.getTableRowByNum("knifeItems",Number(userCurWeapan));
            if(cc.HQ.Local.weaponClones){
                let sanKnife =bouncedJS.knifeNum.getComponent("sanlaunch");
                let arr =[sanKnife.feibiao1,sanKnife.feibiao2,sanKnife.feibiao3];
                for(let i=0;i<arr.length;i++){
                    //更换飞刀图片
                    // cc.HQ.GameMgr.onReplaceKnife(arr[i].getComponent(cc.Sprite),skin);
                    let spriteWeapon =arr[i].getChildByName("knifeSp").getComponent(cc.Sprite);
                    cc.HQ.GameMgr.onReplaceKnife(spriteWeapon,skin);
                    if(Number(userCurWeapan) ==82){   //特定的飞刀就显示飞刀特效
                        // this.pumpNode.active =true;
                        // this.pumpNode1.active =true;
                        arr[i].getChildByName("pumpNode").active =true;
                        arr[i].getChildByName("pumpNode1").active =true;
                    }else{
                        // this.pumpNode.active =false;
                        // this.pumpNode1.active =false; 
                        arr[i].getChildByName("pumpNode").active =false;
                        arr[i].getChildByName("pumpNode1").active =false;
                    }
                }
            }else{
                console.log("屠龙刀$$$$$",Number(userCurWeapan));
                // cc.HQ.GameMgr.onReplaceKnife(this.knife.getComponent(cc.Sprite),skin);
                cc.HQ.GameMgr.onReplaceKnife(bouncedJS.knifeSp,skin);
                if(Number(userCurWeapan) ==82){   //特定的飞刀就显示飞刀特效
                    bouncedJS.pumpNode.active =true;
                    bouncedJS.pumpNode1.active =true;
                }else{
                    bouncedJS.pumpNode.active =false;
                    bouncedJS.pumpNode1.active =false;    
                }
            }
            //屠龙宝刀按钮隐藏
            bouncedJS.baodaoBtn.active =false;
            //记录获得获得屠龙刀的时间
            let date =Date.now();   //当天的当前时间
            cc.HQ.GameMgr.setBaodaoTime(date)
            cc.HQ.GameMgr.bdtips =true;
            console.log("屠龙刀使用时间记录2",date);
            if(type =="cycle1"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }else if(type =="cycle2"){
                if(isValue){
                    cc.HQ.dConf.sv.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle3"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="video";
                }
                bouncedJS.videoIcon.active =true;
            }else if(type =="cycle4"){
                if(isValue){
                    cc.HQ.dConf.sv1.type ="share";
                }
                bouncedJS.videoIcon.active =false;
            }
            sdk.setToServer("VideoOrShareKey1","VideoOrShareData1",data,86400);
        }
        cc.HQ.GameMgr.clickShare =true;
        cc.HQ.GameMgr.shareNum2++;
        cc.HQ.GameMgr.onSimulateShareBack(shareFun9,2);
    },


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

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