// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.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 import GameM, { AUDIO_TYPE, VIDEO_TYPE } from "../manager/GameM"; import { RecordTYPE, HTTP_TYPE } from "../datas/CommonData"; import EffectNode from "./EffectNode"; import UiM, { PANEL_NAME } from "../manager/UiM"; import CarSpace from "../prefabs/CarSpace"; import Main from "../Main"; import AdM from "../manager/AdM"; import Daily from "./Daily"; import LogUtil from "../utils/LogUtil"; import DailyCashData from "../datas/DailyCashData"; import UsualCaidanData from "../datas/UsualCaidanData"; import { GameController } from "../manager/GameController"; import GuideMng from "../manager/GuideMng"; const { ccclass, property } = cc._decorator; @ccclass export default class RedPackageNode extends cc.Component { @property(cc.Node) bgNode: cc.Node = null; @property(cc.Node) backNode: cc.Node = null; @property(cc.Label) labRedMoney: cc.Label = null; @property(cc.Node) moneyLy: cc.Node = null; @property(cc.Label) labRedMoneyF: cc.Label = null; @property(cc.Label) labMoney: cc.Label = null; @property(cc.Node) frontNode: cc.Node = null; @property(cc.Node) frontCashNode: cc.Node = null; @property(cc.Node) btnClose: cc.Node = null; @property(cc.Animation) openAni: cc.Animation = null; @property(cc.Node) hongbaoTop: cc.Node = null; @property(cc.Node) hongbaoDown: cc.Node = null; @property(cc.Node) videoIcon: cc.Node = null; @property(cc.Node) btnCloseFront: cc.Node = null; // @property(cc.Label) // labTitle: cc.Label = null; @property(cc.Label) labTitleO: cc.Label = null; @property(cc.Node) btnDoubleGet: cc.Node = null; @property(cc.Node) videoIconDouble: cc.Node = null; @property(cc.Label) labGet: cc.Label = null; @property(cc.Label) labDouble: cc.Label = null; @property(cc.Node) btnCloseN: cc.Node = null; @property(cc.Node) redPart: cc.Node = null; @property(cc.Node) moneyPart: cc.Node = null; @property(cc.Label) labFade: cc.Label = null; @property(cc.Node) fiveLuckNode: cc.Node = null; @property(cc.Label) labPro: cc.Label = null; @property(cc.Sprite) spPro: cc.Sprite = null; @property(cc.Animation) cashOpenAni: cc.Animation = null; @property(cc.Node) cashHongbaoTop: cc.Node = null; @property(cc.Node) cashHongbaoDown: cc.Node = null; @property(cc.Node) redRain: cc.Node = null; @property(cc.Label) labCashCon: cc.Label = null; @property(cc.Node) desNode: cc.Node = null; @property(cc.Node) loadPart: cc.Node = null; @property(cc.Animation) loadAni: cc.Animation = null; @property(cc.Node) cashPro: cc.Node = null; @property(cc.Node) finishNode: cc.Node = null; @property(cc.Label) labMoney1: cc.Label = null; @property(cc.Label) labMoney2: cc.Label = null; @property(cc.Node) par: cc.Node = null @property(cc.Node) btnPos: cc.Node = null @property(cc.Node) iconOpen: cc.Node = null; @property(cc.Node) guideNode: cc.Node = null; @property(cc.Node) btnTixian: cc.Node = null; @property(cc.Node) btnAuth: cc.Node = null; @property(cc.Node) redHand: cc.Node = null; @property(cc.Node) guideHand: cc.Node = null; @property(cc.Node) jinriTitle: cc.Node = null; @property(cc.Node) mingriTitle: cc.Node = null; /** -------红包随机动画-------- */ @property(cc.Animation) hongbaoAni: cc.Animation = null; @property(cc.Node) nodeTop: cc.Node = null; @property(cc.Node) nodeCenter: cc.Node = null; @property(cc.Node) labCheck: cc.Node = null; @property(cc.RichText) proShowLabel: cc.RichText = null; @property(cc.Sprite) titleSprite: cc.Sprite = null; @property([cc.SpriteFrame]) titleSf: cc.SpriteFrame[] = []; //西游 @property(cc.Node) xiYou_Panel: cc.Node = null; /**西游五福转盘*/ @property(cc.Node) xiYouTurntable: cc.Node = null; @property(cc.Node) xiYou_lucks: cc.Node[] = []; @property(cc.Node) xiYou_rb: cc.Node = null; @property(cc.Label) xiYou_rbTxt: cc.Label = null; @property(sp.Skeleton) xiYou_ligth: sp.Skeleton = null; @property(cc.Node) xiYou_btn_check: cc.Node = null; @property(cc.Label) redMoneyLabel: cc.Label = null; @property(cc.Label) redMoneyInfo: cc.Label = null; private xiYou_luckPosAry: cc.Vec2[] = [ cc.v2(271.05111, 88.06984), cc.v2(167.5188, -230.56984), cc.v2(-167.5188, -230.56984), cc.v2(-271.05111, 88.06984), cc.v2(0, 285) ]; private redmoneyNum: number = 0 /** 类型 0 不看视频 1看视频 */ private isVideo = 0 /** 类型 3 '惊喜红包', 4 '每日提现' */ public type = 0 /** 车位 */ private carSp = null private canCash = false private dailyCash = null private coolTime = false private labAddNum = 0 onLoad() { this.node.height = cc.winSize.height this.par.height = cc.winSize.height } onEnable() { } onDisable() { if (this.type == 4) { AdM.createInter(19) //每日提现成功后关闭,显示彩蛋 if (DailyCashData.Instance.needShowUsualCaidan) { DailyCashData.Instance.needShowUsualCaidan = false setTimeout(() => { if (UsualCaidanData.Instance.userUsualEggInfo && UsualCaidanData.Instance.userUsualEggInfo.isEnd == 0 && UsualCaidanData.Instance.userUsualEggInfo.isOpen == 1) { // UiM.Instance.onPanel(PANEL_NAME.UsualCaidanNode, false, () => { // UiM.Instance.usualCaidanNode.getComponent(UsualCaidanNode).init() // }) EffectNode.instance.playEggIn() } }, 1000); } UiM.Instance.hallNode.getComponent(Main).freshDailyPro() } } /** 初始化 * @param redmoneyNum 红包金额 * @param isVideo 是否视频 * @param type 类型 3 '惊喜红包' 4 '每日提现' * @param carSp 车位 * @param callBack 回调函数 * @param needShow 每日提现显示接受任务引导 * @param delayTime 每日提现指引延迟时间 */ init(redmoneyNum: number, isVideo: number = 0, type: number, carSp = null, needShow = false, delayTime = 0) { LogUtil.logV("RedPackageNode init", type) this.redmoneyNum = redmoneyNum this.isVideo = isVideo this.type = type this.carSp = carSp this.bgNode.active = true this.backNode.active = false this.btnClose.active = false this.btnCloseN.opacity = 0 this.loadPart.active = false this.cashPro.active = false this.finishNode.active = false this.guideNode.active = false this.redHand.active = false this.guideHand.active = false this.cashOpenAni.node.getComponent(cc.Button).transition = cc.Button.Transition.NONE if (this.type == 4) { if (GuideMng.Ins.CurGuideId == 1) { this.scheduleOnce(() => { GuideMng.Ins.ResumeGuide(); }, 0.6); } // //西游 // this.xiYou_Panel.active = true; this.redRain.active = true //航海 this.cashHongbaoTop.setScale(0.78, 0.78) this.cashHongbaoDown.setScale(0.78, 0.78) this.cashHongbaoTop.setPosition(0, -293.5) this.cashHongbaoDown.setPosition(0, -204) this.cashOpenAni.currentClip = null this.frontCashNode.active = true this.frontCashNode.x = 0 this.frontNode.active = false this.redPart.active = false this.moneyPart.active = true this.labFade.node.active = false if (GameM.commonData.roleData.canDailyCash == 0) { this.proShowLabel.string = "今日任务:购买" this.titleSprite.spriteFrame = this.titleSf[0] this.titleSprite.node.scale = 1 this.jinriTitle.active = true this.mingriTitle.active = false } else { this.proShowLabel.string = "明日任务:购买" this.titleSprite.spriteFrame = this.titleSf[1] this.titleSprite.node.scale = 1 this.jinriTitle.active = false this.mingriTitle.active = true this.scheduleOnce(() => { GuideMng.Ins.CheckNextDailyCashGuide19() }, 0.6); } this.dailyCash = DailyCashData.Instance.getTodayDailyCash() // console.log("--->DailyCfg:", this.dailyCash); LogUtil.logV('init ', GameM.commonData.roleData.dailyCashAniPlayed) if (GameM.commonData.roleData.dailyCashAniPlayed == 0) { this.labAddNum = 0 this.canCash = false this.nodeCenter.opacity = 0 this.nodeTop.scale = 0 //航海 this.labCheck.active = true // //西游 // this.xiYou_btn_check.active = true; this.iconOpen.active = false this.desNode.active = true this.labCashCon.node.scale = 3 this.labCashCon.node.setPosition(cc.v2(0, 464)) this.labCashCon.string = '???' this.labCashCon.node.color = cc.color(235, 213, 148, 255) if (this.dailyCash.index > 1) { this.redHand.active = true } this.cashOpenAni.currentClip = null cc.loader.loadRes('gift/btnBg', cc.SpriteFrame, (err, assets) => { if (err) { cc.error(err); return; } this.cashOpenAni.node.getComponent(cc.Sprite).spriteFrame = assets; this.cashOpenAni.node.active = true }) this.labPro.string = `0/0` this.spPro.fillRange = 0 // //西游 // this.spPro.fillRange = 0 // this.xiYou_lucks[4].getChildByName("max").active = false; // this.xiYou_ligth.node.active = false; // this.xiYou_rb.active = false; // for (let i = 0; i < 5; i++) { // this.xiYou_lucks[i].getChildByName("get").active = false; // this.xiYou_lucks[i].scale = 1; // this.xiYou_lucks[i].setPosition(this.xiYou_luckPosAry[i]); // } // this.xiYou_lucks[4].angle = 0; } else { // let need = Number(this.dailyCash.buyTime) - GameM.commonData.roleData.dailyPro let need = DailyCashData.Instance.userDailyCashInfo.buyTime - GameM.commonData.roleData.dailyPro this.nodeCenter.opacity = 255 this.nodeTop.scale = 1 //航海 this.labCheck.active = false // //西游 // this.xiYou_btn_check.active = false; this.labCashCon.node.scale = 1 this.labCashCon.node.setPosition(cc.v2(68, 281)) if (need > 0) { this.desNode.active = true this.canCash = false this.iconOpen.active = true this.labCashCon.string = DailyCashData.Instance.userDailyCashInfo.buyTime.toString() } else { this.desNode.active = false this.labCashCon.node.color = cc.color(235, 213, 148, 255) this.labCashCon.node.x = 0 this.labCashCon.node.scale = 0.8 if (GameM.commonData.roleData.canDailyCash == 0) { this.labCashCon.string = '条件达成,点击提现' } else { this.labCashCon.string = '条件达成,明日提现' } this.labRedMoneyF.string = `¥ ${this.dailyCash.money}` // //西游 // this.xiYou_rbTxt.string = `¥ ${this.dailyCash.money}` this.canCash = true console.log("---------------2") this.iconOpen.active = true this.labRedMoneyF.string = `¥ ${this.dailyCash.money}` if (this.dailyCash.index > 1) { this.redHand.active = true } } this.cashOpenAni.currentClip = null cc.loader.loadRes('gift/tongbi', cc.SpriteFrame, (err, assets) => { if (err) { cc.error(err); return; } this.cashOpenAni.node.getComponent(cc.Sprite).spriteFrame = assets; this.cashOpenAni.node.active = true }) let pro = GameM.commonData.roleData.dailyPro / DailyCashData.Instance.userDailyCashInfo.buyTime this.spPro.fillRange = pro this.labPro.string = `${GameM.commonData.roleData.dailyPro}/ ${DailyCashData.Instance.userDailyCashInfo.buyTime}` // //西游 // this.xiYou_lucks[4].getChildByName("max").active = false; // this.xiYou_ligth.node.active = false; // this.xiYou_rb.active = false; // let num = Math.floor(pro / 0.2); // console.log("--->Num:" + num + " value: " + pro); // for (let i = 0; i < 5; i++) { // if (i <= num - 1) { // this.xiYou_lucks[i].getChildByName("get").active = true; // } else { // this.xiYou_lucks[i].getChildByName("get").active = false; // } // this.xiYou_lucks[i].scale = 1; // this.xiYou_lucks[i].setPosition(this.xiYou_luckPosAry[i]); // } // this.xiYou_lucks[4].angle = 0; } // this.StopOpenLuckAni(); } else { this.hongbaoTop.setScale(0.78, 0.78) this.hongbaoDown.setScale(0.78, 0.78) this.hongbaoTop.setPosition(0, -293.5) this.hongbaoDown.setPosition(0, -204) this.openAni.currentClip = null cc.loader.loadRes('gift/tongbi', cc.SpriteFrame, (err, assets) => { if (err) { cc.error(err); return; } this.openAni.node.getComponent(cc.Sprite).spriteFrame = assets; }) this.openAni.node.active = true this.frontCashNode.active = false this.frontNode.active = true this.redPart.active = true this.moneyPart.active = false this.redMoneyInfo.string = redmoneyNum + " ≈ " + (redmoneyNum / 10000) + "元" this.redMoneyLabel.string = redmoneyNum + "" this.labTitleO.string = GameM.commonData.typeArr[this.type] this.moneyLy.active = true this.labRedMoney.string = this.redmoneyNum.toString() if (GameM.commonData.redSwitch) { this.labMoney.string = `≈ ${(this.redmoneyNum * 0.0001).toFixed(2)}元` } else { this.labMoney.string = '' } if (this.type == 0) { this.labGet.string = '领取' this.labDouble.string = '' this.labDouble.node.active = true this.btnDoubleGet.active = true this.btnCloseN.active = false this.videoIconDouble.active = false this.guideHand.active = true this.guideHand.setPosition(cc.v2(0, -300)) } else { this.labGet.string = '额外获得300' this.labDouble.string = '已存入钱包,可进行提现>' this.labDouble.node.active = false this.btnDoubleGet.active = false this.btnCloseN.active = true this.videoIconDouble.active = true } if (this.isVideo) { this.videoIcon.active = true this.btnCloseFront.active = true } else { this.videoIcon.active = false this.btnCloseFront.active = false } } } clickOpen() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (this.isVideo) { if (this.type == 3) { if (GameM.commonData.isVideoTest) { this.onOpenVideoEnd() } else { GameM.adM.watchVideo(VIDEO_TYPE.freshOpenRed) } } } else { this.onOpenVideoEnd() } if (this.type == 0) { this.guideHand.active = false } } onOpenVideoEnd() { this.coolTime = true this.videoIcon.active = false this.openAni.play('openAni', 0) this.scheduleOnce(this.schedueOpen, 0.9) } clickFinishNode() { let action1 = cc.scaleTo(0.8, 0.8) let action2 = cc.scaleTo(0.8, 0.8) cc.tween(this.finishNode) .to(0.6, { position: cc.v3(-800, 0) }) .call(() => { if (cc.isValid(this.node)) { this.finishNode.active = false this.finishNode.x = 0 this.init(0, 0, 4, null, true, 0.6) // if (GuideMng.Ins.CurGuideId == 12) { // this.scheduleOnce(() => { // GuideMng.Ins.ResumeGuide(); // }, 0.6); // } this.frontCashNode.x = 800 this.coolTime = true cc.tween(this.frontCashNode) // .to(0.2, { position: cc.v3(-20,0)}) // .to(0.1,{position:cc.v3(20)}, { easing: "backOut" }) .to(0.6, { position: cc.v3(0) }) .call(() => { this.coolTime = false }) .start(); } }) .start(); } schedueOpen() { this.openAni.stop() this.openAni.node.active = false let toy = 473 + (cc.winSize.height - 1334) * 0.5 cc.tween(this.hongbaoTop).to(0.3, { scale: 1, position: cc.v2(0, toy) }).start() cc.tween(this.hongbaoDown).to(0.3, { scale: 1, position: cc.v2(0, -1000) }).start() if (this.type == 0) { GameM.commonData.updateRoleNewUser() GameM.commonData.updateRedMoney(this.redmoneyNum, RecordTYPE.newUser) // GameM.commonData.updateRoleNewUser() EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) this.scheduleOnce(() => { this.guideHand.active = true this.guideHand.setPosition(cc.v2(100, -250)) }, 1) } else if (this.type == 1) { GameM.commonData.updateRedMoney(this.redmoneyNum, RecordTYPE.signIn) GameM.commonData.updateChatRed(this.redmoneyNum) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) } else if (this.type == 2) { GameM.commonData.updateRedMoney(this.redmoneyNum, RecordTYPE.online) GameM.commonData.updateChatRed(this.redmoneyNum) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) } else if (this.type == 3) { GameM.commonData.updateRedMoney(this.redmoneyNum, RecordTYPE.onlineGiftRed) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) if (this.carSp != null) { let s = this.carSp.getComponent(CarSpace) s.changeType(0) GameM.commonData.updateBagCarData(s.index.toString(), 0) UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece() } GameM.commonData.hasRedMoney-- if (GameM.commonData.hasRedMoney < 0) { GameM.commonData.hasRedMoney = 0 } } this.scheduleOnce(() => { this.backNode.active = true }, 0.1) this.coolTime = false this.btnClose.active = true this.btnCloseN.opacity = 0 cc.tween(this.btnCloseN).delay(0).to(0.7, { opacity: 255 }).start() } clickCashOpen() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (this.coolTime) { return } this.coolTime = true if (GameM.commonData.roleData.dailyCashAniPlayed == 0) { this.redHand.active = false; DailyCashData.Instance.getDailyCashBuyTime() } else { if (this.canCash) { this.redHand.active = false; if (GameM.commonData.loginDays < this.dailyCash.time) { EffectNode.instance.PlayTip('每日提现次数已达上限,请明天再来!') this.coolTime = false return } // GameM.adM.watchVideo(VIDEO_TYPE.dailyCash) if (GameM.commonData.roleData.canDailyCash == 0) { console.log("---> canDailyCash = 0") DailyCashData.Instance.getDailyCashMoney() } else { console.log("---> canDailyCash = 1") let btnNode = this.cashOpenAni.node btnNode.stopAllActions() this.labCashCon.node.stopAllActions() cc.tween(btnNode).to(0.1, { scale: 1.2 }) .to(0.1, { scale: 1 }) .start() cc.tween(this.labCashCon.node).to(0.1, { scale: 1 }) .to(0.1, { scale: 0.8 }) .start() EffectNode.instance.PlayTip('今日已提现,请明天再来!') } } else { //航海 //EffectNode.instance.PlayTip('购买武将次数不足') //西游 EffectNode.instance.PlayTip('购买武将增加任务进度') cc.tween(this.labCashCon.node).to(0.15, { scale: 1.3 }).to(0.15, { scale: 1 }).start() cc.tween(this.desNode).to(0.15, { scale: 1.3 }).to(0.15, { scale: 1 }).start() } this.coolTime = false } } clickCashHelp() { GameM.audioM.playEffect(AUDIO_TYPE.button) this.frontCashNode.active = false this.guideNode.active = true } checkOpen() { this.cashOpenAni.stop() this.cashOpenAni.currentClip = null cc.loader.loadRes('gift/tongbi', cc.SpriteFrame, (err, assets) => { if (err) { cc.error(err); return; } this.cashOpenAni.node.getComponent(cc.Sprite).spriteFrame = assets; }) this.cashOpenAni.node.active = true console.log("---------------3") this.iconOpen.active = true } onLabAdd() { if (this.labAddNum < DailyCashData.Instance.userDailyCashInfo.buyTime) { this.labAddNum++ } else { this.labAddNum = DailyCashData.Instance.userDailyCashInfo.buyTime this.unschedule(this.onLabAdd) this.labCashCon.node.color = cc.color(255, 255, 0, 255) this.labFade.string = DailyCashData.Instance.userDailyCashInfo.buyTime.toString() this.labFade.node.opacity = 255 this.labFade.node.scale = 3 this.labFade.node.active = true this.checkOpen() cc.tween(this.labFade.node) .to(0.6, { scale: 8, opacity: 0 }) .call(() => { this.labFade.node.active = false this.hongbaoAni.play('randomRed', 0) this.coolTime = true this.scheduleOnce(() => { this.scheduleOnce(() => { this.coolTime = false }, 1) this.spPro.fillRange = 0 this.labPro.string = `${GameM.commonData.roleData.dailyPro}/ ${DailyCashData.Instance.userDailyCashInfo.buyTime}` if (GuideMng.Ins.CurGuideId == 1) { GuideMng.Ins.ResumeGuide(); } if (GuideMng.Ins.CurGuideId == 13) { GuideMng.Ins.ResumeGuide(); } // UiM.Instance.guideNode.getComponent(Guide).hideMask11() }, 1) }) .start() } this.labCashCon.string = this.labAddNum.toString() } //xiyou xiyouOnLabAdd() { if (this.labAddNum < DailyCashData.Instance.userDailyCashInfo.buyTime) { this.labAddNum++ this.labPro.string = `${this.labAddNum}`; } else { this.labAddNum = DailyCashData.Instance.userDailyCashInfo.buyTime this.unschedule(this.xiyouOnLabAdd) this.labPro.string = `${this.labAddNum}`; cc.tween(this.labPro.node) .delay(0.5) .to(0.6, { x: 25, y: -35, scale: 1 }) .call(() => { this.fiveLuckNode.active = true this.labPro.node.x = 0 this.labPro.string = `${GameM.commonData.roleData.dailyPro}/ ${this.labAddNum}`; }) .start() } } onDailyCashVideoEnd() { this.iconOpen.active = false this.cashOpenAni.play('openAni', 0) this.scheduleOnce(this.schedueCashOpen, 0.9) } //每日提现红包打开动画 schedueCashOpen() { this.cashOpenAni.stop() this.cashOpenAni.node.active = false //航海 let toy = 473 + (cc.winSize.height - 1334) * 0.5 this.redRain.active = false cc.tween(this.cashHongbaoTop).to(0.3, { scale: 1, position: cc.v2(0, toy) }).start() cc.tween(this.cashHongbaoDown).to(0.3, { scale: 1, position: cc.v2(0, -1000) }).start() // //西游 // this.xiYou_Panel.active = false; this.scheduleOnce(() => { this.backNode.active = true }, 0.1) if (GameM.commonData.isAuth) { this.btnAuth.active = false this.btnTixian.active = true if (GuideMng.Ins.CurGuideId == 12) { GuideMng.Ins.FinishGuide() } } else { this.btnAuth.active = true this.btnTixian.active = false if (GuideMng.Ins.CurGuideId == 12) { this.scheduleOnce(() => { GuideMng.Ins.ResumeGuide(); }, 0.6); } } this.btnClose.active = true } private hasTap = false clickAuth() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (!this.hasTap) { console.log('clickGoAuth') this.hasTap = true AdM.WxLogin() this.scheduleOnce(() => { this.hasTap = false }, 1) } } /** 授权返回刷新 */ authBack() { this.btnAuth.active = false this.btnTixian.active = true EffectNode.instance.PlayTip('授权成功,点击提现') } /** 点击提现 */ clickCash() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (!DailyCashData.Instance.dailyCashApplyCfg) { return } LogUtil.logV('dailyCash ', { 'index': this.dailyCash.index }) GameM.httpM.sendDatas(HTTP_TYPE.dailyCash, { 'index': this.dailyCash.index }, DailyCashData.Instance.resultDailyCash.bind(DailyCashData.Instance), DailyCashData.Instance.resultDailyCashFail.bind(DailyCashData.Instance)) this.loadPart.active = true this.loadAni.play('load', 0) } tiXianSuccess(showPro) { GameM.commonData.roleData.dailyCashAniPlayed = 0 LogUtil.logV('tiXianSuccess ', GameM.commonData.roleData.dailyCashAniPlayed) GameM.commonData.updateDailyCash(1, 1, true) this.scheduleOnce(() => { this.loadPart.active = false this.showCashPro(showPro) }, 1.5) } tixianFail() { this.scheduleOnce(() => { this.loadPart.active = false this.btnClose.active = true }, 1.5) } showCashPro(showPro) { if (!DailyCashData.Instance.dailyCashApplyCfg) { return } // this.labMoney1.string = `¥${this.dailyCash.money}` if (showPro) { UiM.Instance.openPanel(this.cashPro) } } clickCloseCashPro() { GameM.audioM.playEffect(AUDIO_TYPE.button) UiM.Instance.closePanelM() this.backNode.active = false this.frontCashNode.active = false this.btnClose.active = false this.finishNode.active = true this.finishNode.x = 0 this.guideHand.active = true this.guideHand.setPosition(cc.v2(73, -287)) } clickClose() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (this.coolTime) { return } if (this.type == 0 && !this.backNode.active) { return } if (this.type == 0) { UiM.Instance.hallNode.getComponent(Main).checkNewUser() } else if (this.type == 1) { if (UiM.Instance.dailyNode) { UiM.Instance.dailyNode.getComponent(Daily).hasOpen() } } if (this.type == 4) { this.hideEff() //西游 GameController.Ins.SwitchAudio(1); this.xiYou_rb.active = false; } else { this.bgNode.active = false UiM.Instance.closePanelM() } if (GuideMng.Ins.CurGuideId == 12) { GuideMng.Ins.FinishGuide(); } } clickDoubleGet() { GameM.audioM.playEffect(AUDIO_TYPE.button) if (this.type == 0) { UiM.Instance.hallNode.getComponent(Main).checkNewUser() this.bgNode.active = false UiM.Instance.closePanelM() return } GameM.adM.watchVideo(VIDEO_TYPE.freshGet) } onDoubleGetVideoFail() { if (this.type == 0) { } } onDoubleGetVideoEnd() { // this.node.active = false this.bgNode.active = false UiM.Instance.closePanelM() if (this.type == 0) { UiM.Instance.hallNode.getComponent(Main).checkNewUser() EffectNode.instance.PlayTip("双倍领取成功"); GameM.commonData.updateRedMoney(this.redmoneyNum, RecordTYPE.newUser) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) } else if (this.type == 1) { GameM.commonData.updateRedMoney(300, RecordTYPE.signIn) GameM.commonData.updateChatRed(300) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放"); if (UiM.Instance.dailyNode) { UiM.Instance.dailyNode.getComponent(Daily).hasOpen() } } else if (this.type == 2) { GameM.commonData.updateRedMoney(300, RecordTYPE.online) GameM.commonData.updateChatRed(300) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放"); } else if (this.type == 3) { GameM.commonData.updateRedMoney(300, RecordTYPE.onlineGiftRed) EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300)); GameM.audioM.playEffect(AUDIO_TYPE.getGold, false) EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放"); if (this.carSp != null) { let s = this.carSp.getComponent(CarSpace) s.changeType(0) GameM.commonData.updateBagCarData(s.index.toString(), 0) UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece() } GameM.commonData.hasRedMoney-- if (GameM.commonData.hasRedMoney < 0) { GameM.commonData.hasRedMoney = 0 } EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放"); } } clickLabDouble() { if (this.type == 0) { this.clickDoubleGet() } else { GameM.audioM.playEffect(AUDIO_TYPE.button) // this.node.active = false this.bgNode.active = false UiM.Instance.closePanelM() // UiM.Instance.openPanel(UiM.Instance.cashNode) UiM.Instance.onPanel(PANEL_NAME.CashNode, true) } } clickGuideBtn() { GameM.audioM.playEffect(AUDIO_TYPE.button) this.hideEff() UiM.Instance.hallNode.getComponent(Main).showBuyCarHand() //西游 GameController.Ins.SwitchAudio(1); } clickGuideBack() { console.log("RedPackageNode clickGuideBack") GameM.audioM.playEffect(AUDIO_TYPE.button) this.frontCashNode.active = true this.guideNode.active = false } clickBg() { if (this.coolTime) { return } if (this.guideNode.active) { this.clickGuideBack() } else { this.clickClose() } console.log("RedPackageNode clickBg") } hideEff() { let pos = this.btnPos.position if (cc.winSize.height > 1500) { pos.y = pos.y + 45 } cc.tween(this.par).to(0.2, { scale: 0, position: pos }).call(() => { this.node.active = false this.par.scale = 1 this.par.setPosition(cc.v2(0, 0)) // this.node.hide = false if (GameM.commonData.richbank_noSave > 0) { UiM.Instance.hallNode.getComponent(Main).BankQipaoTip.creatPacketAnim(2) GameM.commonData.richbank_noSave = 0 } if (GuideMng.Ins.CurGuideId == 1) { GuideMng.Ins.ResumeGuide(); } }).start(); } //西游 Click_XiYouLuckBtn() { if (this.iconOpen.active) { if (GameM.commonData.roleData.canDailyCash == 0) { DailyCashData.Instance.getDailyCashMoney() } else { EffectNode.instance.PlayTip('明日五福第二天才能合成!') cc.tween(this.titleSprite.node) .to(0.25, { scale: 1.2 }) .to(0.25, { scale: 1 }) .start() } if (this.redHand.active) { this.redHand.active = false; } } else { this.clickCashOpen(); } } Click_XiYouLuckRbOpenBtn() { this.clickCashOpen(); } private deltadis = 240; /**停止播放开福动画*/ StopOpenLuckAni() { cc.Tween.stopAllByTarget(this.xiYou_lucks[0]); cc.Tween.stopAllByTarget(this.xiYou_lucks[1]); cc.Tween.stopAllByTarget(this.xiYou_lucks[2]); cc.Tween.stopAllByTarget(this.xiYou_lucks[3]); cc.Tween.stopAllByTarget(this.xiYou_lucks[4]); cc.Tween.stopAllByTarget(this.xiYou_rb); } /**播放开福动画*/ PlayOpenLuckAni() { this.StopOpenLuckAni(); cc.tween(this.xiYou_lucks[0]) .to(0.3, { scale: 1.1, position: cc.v2(this.deltadis, 0) }) .delay(0.15) .to(0.1, { position: cc.v2(this.deltadis - 50, 0) }) .to(0.15, { position: cc.v2(this.deltadis + 210, 0) }) .to(0.2, { position: cc.v2(0, 0) }) .start(); cc.tween(this.xiYou_lucks[1]) .to(0.3, { scale: 1.3, position: cc.v2(this.deltadis * 0.5, 0) }) .delay(0.15) .to(0.1, { position: cc.v2(this.deltadis * 0.5 - 40, 0) }) .to(0.15, { position: cc.v2(this.deltadis * 0.5 + 150, 0) }) .to(0.15, { position: cc.v2(0, 0) }) .start(); cc.tween(this.xiYou_lucks[2]) .to(0.3, { scale: 1.1, position: cc.v2(-this.deltadis, 0) }) .delay(0.15) .to(0.1, { position: cc.v2(-this.deltadis + 50, 0) }) .to(0.15, { position: cc.v2(-this.deltadis - 210, 0) }) .to(0.2, { position: cc.v2(0, 0) }) .start(); cc.tween(this.xiYou_lucks[3]) .to(0.3, { scale: 1.3, position: cc.v2(-110, 0) }) .delay(0.15) .to(0.1, { position: cc.v2(-this.deltadis * 0.5 + 40, 0) }) .to(0.15, { position: cc.v2(-this.deltadis * 0.5 - 150, 0) }) .to(0.15, { position: cc.v2(0, 0) }) .start(); cc.tween(this.xiYou_lucks[4]) .to(0.3, { scale: 1.7, position: cc.v2(0, 0) }) .to(0.15, { scale: 2.2 }) .to(0.15, { scale: 1.7 }) .to(0.15, { scale: 2.2 }) .to(0.15, { scale: 1.7 }) .call(() => { this.xiYou_ligth.node.active = true; this.xiYou_ligth.clearTrack(0); this.xiYou_ligth.setAnimation(0, "animation", false); this.xiYou_lucks[4].getChildByName("max").active = true; GameM.audioM.playEffect(AUDIO_TYPE.fiveluck); }) .delay(0.3) .to(0.15, { scale: 2 }) .to(0.4, { scale: 0, angle: 400 }) .call(() => { this.xiYou_rb.getChildByName("bg").active = false; this.xiYou_rb.scale = 0; this.xiYou_rb.angle = 0; this.xiYou_rb.active = true; //this.xiYou_rb.scaleX cc.tween(this.xiYou_rb) .to(0.15, { scaleX: -0.25, scaleY: 0.25 }) .to(0.15, { scaleX: 0.5, scaleY: 0.5 }) .to(0.15, { scaleX: -0.75, scaleY: 0.75 }) .to(0.15, { scaleX: 1, scaleY: 1 }) .call(() => { this.xiYou_rb.getChildByName("bg").active = true; }) .start(); }) .start(); //.to(0.2,{position:cc.v2(-110+30,0)}) //.to(0.4,{position:cc.v2(-110-50,0)}) //.to(0.5,{position:cc.v2(0,0)}); } freshDailyCashMoney(cashMoney) { let money = (cashMoney * 0.01).toFixed(2) this.labRedMoneyF.string = `¥ ${money}` this.xiYou_rbTxt.string = `¥ ${money}` this.labMoney2.string = `¥ ${money}` this.labMoney1.string = `¥ ${money}` // this.PlayOpenLuckAni(); this.onDailyCashVideoEnd() } /** 刷新需要购买次数 */ freshNeedBuyTimes() { //查看动画 this.redHand.active = false this.labCheck.active = false this.cashOpenAni.play('openAni', 0) // this.scheduleOnce(this.checkOpen, 0.9) this.schedule(this.onLabAdd, 0.03) if (GameM.commonData.roleData.canDailyCash != 0) { AdM.onSendEvent('nextcash_start', '开启明日提现', 'nextcash') } GameM.commonData.roleData.dailyCashAniPlayed = 1 GameM.commonData.updateRoleData() } }