| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501 |
- // 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, { VIDEO_TYPE, AUDIO_TYPE } from "../manager/GameM";
- import CarSpace from "../prefabs/CarSpace";
- import { HTTP_TYPE, MONEY_TYPE, RecordTYPE } from "../datas/CommonData";
- import EffectNode from "./EffectNode";
- import UiM, { PANEL_NAME } from "../manager/UiM";
- import Main from "../Main";
- import AdM from "../manager/AdM";
- import Sciencen_M from "../utils/Sciencen_M";
- import GlobalStorage, { STORAGE_KEY } from "../datas/GlobalStorage";
- import GuideManager from "../manager/GuideManager";
- import LogUtil from "../utils/LogUtil";
- import Treasure from "./Treasure";
- import RoleManageData from "../datas/RoleManageData";
- import Turntable from "./Turntable";
- import SwitchM from "../manager/SwitchM";
- import GuideMng from "../manager/GuideMng";
- import { FightData } from "../datas/FightData";
- import { MateData } from "../datas/MateData";
- import { Utils } from "../utils/Utils";
- import NativeAdAwardData from "../manager/NativeAdAwardData";
- import NativeADAwardNode from "./NativeAdAwardNode";
- import DailyData from "../datas/DailyData";
- import { RichData } from "../datas/RichData";
- import { PlayerPrefs } from "../tools/MyExtends";
- import MoreGameData from "../datas/MoreGameData";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class Gift extends cc.Component {
- @property(cc.Node)
- light: cc.Node = null;
- @property(cc.Node)
- xing: cc.Node = null;
- @property(cc.Node)
- goldIcons: cc.Node = null;
- @property(cc.Node)
- redMoneyIcons: cc.Node = null;
- @property(cc.Node)
- offlineIcons: cc.Node = null;
- @property(cc.Node)
- boxIcons: cc.Node = null;
- @property(cc.Node)
- lvupcarIcons: cc.Node = null;
- @property(cc.Node)
- popVideoIcons: cc.Node = null;
- @property(cc.Node)
- icon: cc.Node = null;
- @property(cc.Label)
- labNum: cc.Label = null;
- @property(cc.Node)
- btnGetGold: cc.Node = null;
- @property(cc.RichText)
- labDayLeft: cc.RichText = null;
- @property(cc.Node)
- btnGetOffline: cc.Node = null;
- @property(cc.Node)
- lyGold: cc.Node = null;
- @property(cc.Node)
- newcarIcons: cc.Node = null;
- @property(cc.Sprite)
- car: cc.Sprite = null;
- //被动视频
- @property(cc.Node)
- popVideoIcon: cc.Node = null;
- //znh
- @property(cc.Label)
- maxCarLvTxt: cc.Label = null;
- @property(cc.Node)
- btn_close: cc.Node = null;
- @property(cc.Node)
- btn_offlineSingle: cc.Node = null;
- //new car
- @property(cc.Label)
- labCarNum: cc.Label = null;
- @property(cc.Label)
- labCarMoney: cc.Label = null;
- @property(cc.Node)
- newCarBg: cc.Node = null;
- @property(cc.Node)
- btnCarGet: cc.Node = null;
- @property(cc.Node)
- btnCarDouble: cc.Node = null;
- @property(cc.Node)
- btnCarSingle: cc.Node = null;
- @property(cc.Node)
- videoIcon: cc.Node = null;
- @property(cc.Label)
- labGoldBtnDes: cc.Label = null;
- @property(cc.Node)
- btnGet: cc.Node = null;
- @property(cc.Sprite)
- btnBanner: cc.Sprite = null;
- @property(cc.Node)
- newCarVideoIcon: cc.Node = null;
- //lvup
- @property(cc.Sprite)
- carTo: cc.Sprite = null;
- @property(cc.Sprite)
- carN: cc.Sprite = null;
- @property(cc.Label)
- labCarTo: cc.Label = null;
- @property(cc.Label)
- labCarN: cc.Label = null;
- @property(cc.RichText)
- labPercent: cc.RichText = null;
- @property(cc.Node)
- videoGetGold: cc.Node = null;
- @property(cc.RichText)
- videoLabPercent: cc.RichText = null;
- @property(cc.Label)
- labVideoGold: cc.Label = null;
- @property(cc.Label)
- labCurGold: cc.Label = null;
- //新增加底
- @property(cc.Node)
- giftBg: cc.Node = null;
- @property(cc.Node)
- titleBg: cc.Node = null;
- @property(cc.Node)
- treasureTicket: cc.Node = null;
- @property(cc.Node)
- propNode: cc.Node = null;
- @property(cc.Sprite)
- spriteProp: cc.Sprite = null;
- @property(cc.Label)
- treasureGold: cc.Label = null;
- @property(cc.Label)
- propNum: cc.Label = null;
- @property(cc.Node)
- labDrop: cc.Node = null;
- @property(cc.Node)
- clearCoolNode: cc.Node = null;
- @property(cc.Node)
- clearBtnNode: cc.Node = null;
- @property(cc.Node)
- clearCloseNode: cc.Node = null;
- /** 类型 10001:金币
- 10002:红包币
- 10003:时间段收益(当前的每秒收益*时间段)
- 10004:惊喜礼包(打开后获得对应等级的汽车)
- 10005:离线收益*/
- type = 0
- /** 数量 */
- num = '0'
- /** 车位 */
- carSp = null
- /** 是飞船 */
- isAirship = false
- isVideo = false //是否观看视频
- adType: VIDEO_TYPE = null; //视频类型
- countDown = 0
- turntable = false
- streamData = null
- onEnable() {
- }
- onDisable() {
- if (this.type == MONEY_TYPE.box) {
- AdM.createInter(2);
- }
- else if (this.type == MONEY_TYPE.offlineGold) {
- AdM.createInter(4);
- UiM.Instance.hallNode.getComponent(Main).checkPopSecretary()
- }
- else if (this.type == MONEY_TYPE.getNewCar) {
- AdM.createInter(9);
- }
- else if (this.type == MONEY_TYPE.gold) {
- AdM.createInter(11);
- }
- else if (this.type == MONEY_TYPE.carLvUp) {
- AdM.createInter(12);
- }
- AdM.destroyNative()
- AdM.destroyBanner()
- if (this.isAirship) {
- UiM.Instance.hallNode.getComponent(Main).resumeAirShip()
- }
- UiM.Instance.hallNode.getComponent(Main).CheckNormalGuide();
- }
- init(type, num, carSp = null, isAirship = false, isvideo = 0, adType: VIDEO_TYPE = null, percent = -1, turntable = false) {
- this.type = type
- this.num = num
- this.carSp = carSp
- this.isAirship = isAirship
- this.isVideo = (isvideo == 1)
- this.adType = adType
- this.turntable = turntable
- this.labNum.node.parent.scale = 1
- if (this.isAirship) {
- this.changeAir = false
- if (NativeAdAwardData.Instance.canGetAward(2)) {
- this.labDrop.active = true
- }
- else {
- this.labDrop.active = false
- this.labNum.node.parent.scale = 0
- cc.tween(this.labNum.node.parent)
- .to(0.6, { scale: 1 })
- .start()
- }
- }
- else {
- this.labDrop.active = false
- }
- this.labNum.string = Sciencen_M.instance.format(this.num)
- if (percent == -1) {
- this.labPercent.string = ''
- }
- else {
- let add
- if (GameM.commonData.loginDays <= 7) {
- add = GameM.commonData.loginDays * 10
- }
- else {
- add = 70
- }
- percent += add
- //航海
- //this.labPercent.string = `<color=#885A00>视频收益 ${percent}%</c><color=#028AC5>(登录${GameM.commonData.loginDays}天+${add}%)</color>`
- }
- this.light.active = true
- this.xing.active = true
- this.goldIcons.active = false
- this.redMoneyIcons.active = false
- this.offlineIcons.active = false
- this.lvupcarIcons.active = false
- this.popVideoIcons.active = false
- this.treasureTicket.active = false
- this.clearCoolNode.active = false
- this.icon.active = false
- this.lyGold.active = false
- this.newcarIcons.active = false
- this.boxIcons.active = false
- this.videoIcon.active = false
- this.btnGetGold.active = false
- this.btn_close.active = true
- // this.btn_close.y = 311
- // this.light.y = 149
- this.giftBg.active = false
- this.titleBg.active = false
- this.btnGet.active = false
- this.btnBanner.node.active = false
- this.videoGetGold.active = false
- this.labGoldBtnDes.string = '领取奖励'
- this.propNode.active = false
- GameM.audioM.playEffect(AUDIO_TYPE.open_interface)
- let self = this
- switch (this.type) {
- case MONEY_TYPE.gold: //金币
- this.giftBg.active = true
- this.btnGetGold.active = true
- if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn) {
- this.labDayLeft.string = `<b>今日剩余次数:<color=#FF0000>${GameM.commonData.dayBuyCarVideoLimitTimes - 1}</color></b>`
- //西游
- //唐僧天赋3
- if (MateData.Ins.Mate1Talent3 > 0) {
- this.videoLabPercent.string = `<b><color=#885A00>金币加成</c> <size=60><color=red>${MateData.Ins.Mate1Talent3}%</c></size></b>`
- } else {
- this.videoLabPercent.string = "";
- }
- this.labVideoGold.string = Sciencen_M.instance.format(this.num);
- this.videoGetGold.active = true
- }
- else {
- this.labDayLeft.string = ''
- this.labNum.string = Sciencen_M.instance.format(this.num);
- this.goldIcons.active = true
- this.lyGold.active = true
- if (this.isVideo) {
- this.videoIcon.active = true;
- }
- }
- if (this.carSp != null) {
- NativeAdAwardData.Instance.setGetAward(3)
- if (NativeAdAwardData.Instance.canGetAward(3)) {
- this.labGoldBtnDes.string = `${NativeAdAwardData.Instance.nativeAwardTimes}倍领取`
- this.btnGet.active = true
- this.streamData = MoreGameData.Instance.getRandomSteam()
- if (this.streamData) {
- cc.loader.load(this.streamData.stream, (err, res) => {
- if (err) {
- console.log('err:', err);
- return;
- }
- if (this.btnBanner) {
- let tex: cc.Texture2D = res as cc.Texture2D;
- this.btnBanner.spriteFrame = new cc.SpriteFrame(tex);
- this.btnBanner.node.active = true
- }
- })
- }
- }
- else {
- this.labGoldBtnDes.string = '领取奖励'
- this.btnGet.active = false
- }
- }
- else {
- this.labGoldBtnDes.string = '领取奖励'
- this.btnGet.active = false
- }
- break
- case MONEY_TYPE.redMoney: //红包币 含飞船奖励
- this.giftBg.active = true
- this.btnGetGold.active = true
- this.redMoneyIcons.active = true
- this.lyGold.active = true
- if (this.isVideo) {
- this.videoIcon.active = true;
- }
- break
- case MONEY_TYPE.timespanGold:
- break
- case MONEY_TYPE.box: //含飞船奖励
- this.giftBg.active = true
- this.boxIcons.active = true
- this.lyGold.active = true
- this.icon.active = false
- if (isvideo) {
- this.videoIcon.active = true
- }
- this.btnGetGold.active = true
- this.labNum.string = '惊喜宝箱 x' + this.num.toString()
- break
- case MONEY_TYPE.turnTableCard:
- this.propNode.active = true
- this.btnGetGold.active = true
- this.giftBg.active = true
- this.propNum.string = "x" + this.num
- cc.loader.loadRes('gift/spriteZhuanpanka', cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- this.spriteProp.spriteFrame = assets;
- this.spriteProp.node.scale = 0.8
- })
- if (this.isVideo) {
- this.videoIcon.active = true;
- }
- this.propNode.getChildByName("propName").getComponent(cc.Label).string = "转盘卡"
- // if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn) {
- // this.labDayLeft.string = `今日剩余次数:<color=#0189C5>${GameM.commonData.dayBuyCarVideoLimitTimes - 1}</color>`
- // }
- // else {
- // this.labDayLeft.string = ''
- // }
- break
- case MONEY_TYPE.treasureCard:
- this.propNode.active = true
- this.btnGetGold.active = true
- this.giftBg.active = true
- this.propNum.string = "x" + this.num
- cc.loader.loadRes('gift/spriteDuobaoquan', cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- this.spriteProp.spriteFrame = assets;
- this.spriteProp.node.scale = 0.8
- })
- if (this.isVideo) {
- this.videoIcon.active = true;
- }
- this.propNode.getChildByName("propName").getComponent(cc.Label).string = "夺宝券"
- break
- case MONEY_TYPE.speedCard:
- this.propNode.active = true
- this.btnGetGold.active = true
- this.giftBg.active = true
- this.propNum.string = "x" + this.num
- cc.loader.loadRes('gift/spriteJiasuka', cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- this.spriteProp.spriteFrame = assets;
- this.spriteProp.node.scale = 0.8
- })
- if (this.isVideo) {
- this.videoIcon.active = true;
- }
- this.propNode.getChildByName("propName").getComponent(cc.Label).string = "加速券"
- break
- case MONEY_TYPE.talentCoin:
- this.propNode.active = true
- this.btnGetGold.active = true
- this.giftBg.active = true
- this.propNum.string = "x" + this.num
- LogUtil.logV("HTTP_TYPE.updateBattleStoneCount show", MateData.Ins.talentCoin)
- cc.loader.loadRes('xiyou/icon/1003', cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- this.spriteProp.spriteFrame = assets;
- this.spriteProp.node.scale = 2
- })
- this.propNode.getChildByName("propName").getComponent(cc.Label).string = "天赋石"
- break
- case MONEY_TYPE.offlineGold: //离线收益
- this.giftBg.active = false
- this.titleBg.active = true
- this.btnGetGold.active = false
- this.offlineIcons.active = true
- this.icon.active = true
- this.btn_close.active = false
- this.lyGold.active = false
- this.btn_offlineSingle.active = false;
- this.light.active = false
- this.offlineIcons.getChildByName("offlineNumLab").getComponent(cc.Label).string = Sciencen_M.instance.format(this.num)
- //白龙马天赋2
- if (MateData.Ins.Mate3Talent2 > 0) {
- this.labPercent.string = `<outline color=#68310b width=2><color=#885A00>天赋加成 ${MateData.Ins.Mate3Talent2}%</c></outline>`
- } else {
- this.labPercent.string = "";
- }
- this.scheduleOnce(() => {
- // this.offlineIcons.getChildByName("offlineClose").active = true;
- // this.btn_offlineSingle.active = true;
- // this.btn_offlineSingle.opacity = 0;
- // cc.tween(this.btn_offlineSingle).to(0.5, { opacity: 255 }).start();
- }, 0);
- break
- case MONEY_TYPE.getNewCar:
- this.titleBg.active = false
- this.btn_close.active = false
- this.light.active = false
- this.xing.active = false
- this.btnCarDouble.active = true
- this.btnCarGet.active = false
- self.car.node.active = false
- cc.loader.loadRes('carPic/side/side_' + GameM.commonData.maxCarLevel, cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- self.car.spriteFrame = assets;
- self.car.node.active = true
- })
- this.unschedule(this.getNewCarDelayCall);
- this.btn_close.active = false;
- this.btnCarSingle.active = false;
- this.maxCarLvTxt.string = GameM.commonData.maxCarLevel.toString();
- if (GameM.commonData.maxCarLevel <= 4) {
- this.btnCarDouble.active = false
- this.btnCarGet.active = true
- }
- else {
- this.btnCarDouble.active = true
- this.btnCarGet.active = false
- }
- this.newcarIcons.active = true
- this.labCarNum.string = this.num
- if (GameM.commonData.redSwitch) {
- this.labCarMoney.string = `可兑换${(Number(this.num) * 0.0001).toFixed(2)}元`
- }
- else {
- this.labCarMoney.string = ''
- }
- this.newCarBg.y = -90
- cc.tween(this.newCarBg)
- .delay(0.2)
- .to(0.5, { y: 100 }).start()
- let delayTime = 0
- if (SwitchM.forceMakeMoney) {
- // delayTime = 2
- }
- this.scheduleOnce(this.getNewCarDelayCall, delayTime);
- break
- case MONEY_TYPE.carLvUp:
- this.titleBg.active = true
- this.btn_close.active = false
- this.lvupcarIcons.active = true
- self.carTo.node.active = false
- this.light.active = false
- this.giftBg.active = false
- this.labCarTo.string = this.num.toString()
- this.labCarN.string = this.carSp.toString()
- cc.loader.loadRes('carPic/side/side_' + this.num, cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- self.carTo.spriteFrame = assets;
- self.carTo.node.active = true
- })
- self.carN.node.active = false
- cc.loader.loadRes('carPic/side/side_' + this.carSp, cc.SpriteFrame, (err, assets) => {
- if (err) {
- cc.error(err);
- return;
- }
- self.carN.spriteFrame = assets;
- self.carN.node.active = true
- })
- // this.btn_close.active = false
- // this.scheduleOnce(() => {
- // this.btn_close.active = true;
- // }, 0);
- break
- case MONEY_TYPE.popVideo: //主动拉视频
- this.giftBg.active = true
- this.btnGetGold.active = false
- this.popVideoIcons.active = true
- // if (GameM.commonData.roleData.hangVideoFree == 0) {
- // this.popVideoIcon.active = false
- // }
- // else {
- // this.popVideoIcon.active = true
- // }
- this.popVideoIcon.active = true
- this.icon.active = true
- this.lyGold.active = true
- this.labCurGold.string = Sciencen_M.instance.format(GameM.commonData.gold)
- this.scheduleOnce(() => {
- this.btn_close.active = true;
- }, 0);
- break
- case MONEY_TYPE.buyCarGold: //点击购买汽车按钮,金币不足
- case MONEY_TYPE.mainBuyCarGold: //主界面点击购买汽车按钮,金币不足
- this.giftBg.active = true
- this.btnGetGold.active = true
- this.videoIcon.active = true
- // this.goldIcons.active = true
- // this.lyGold.active = true
- this.labVideoGold.string = Sciencen_M.instance.format(this.num);
- this.videoGetGold.active = true
- this.labDayLeft.string = `<b>今日剩余次数:<color=#FF0000>${GameM.commonData.dayBuyCarVideoLimitTimes}</color></b>`
- //西游
- //唐僧天赋3
- if (MateData.Ins.Mate1Talent3 > 0) {
- // this.labPercent.string = `<color=#885A00>天赋加成 ${MateData.Ins.Mate1Talent3}%</c>`
- this.videoLabPercent.string = `<b><color=#885A00>金币加成</c> <size=60><color=red>${MateData.Ins.Mate1Talent3}%</c></size></b>`
- } else {
- // this.labPercent.string = ""
- this.videoLabPercent.string = `<b><color=#885A00>金币加成</c> <size=60><color=red>${0}%</c></size></b>`
- }
- break
- case MONEY_TYPE.treasureTicket: //视频获得兑奖券
- this.titleBg.active = false
- this.treasureTicket.active = true
- this.giftBg.active = true
- this.light.active = false
- this.treasureGold.string = Sciencen_M.instance.format(this.num)
- break
- case MONEY_TYPE.clearCooltime: //清除所有罢工时间
- this.giftBg.active = false
- this.titleBg.active = false
- this.btn_close.active = false
- this.clearCoolNode.active = true
- this.light.active = false
- this.unschedule(this.showCleartime)
- this.clearBtnNode.active = false
- this.clearCloseNode.active = false
- let closeTime = 1//显示关闭时间
- if (GameM.commonData.adShowConfig && GameM.commonData.adShowConfig.is_show_banner == 1) {
- closeTime = 0
- }
- this.scheduleOnce(this.showCleartime, closeTime)
- break
- }
- AdM.destroyNative()
- if (this.adType != VIDEO_TYPE.hangUp) {
- this.node.x = 0
- }
- if (this.giftBg.active) {
- // if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn
- // || this.type == MONEY_TYPE.buyCarGold || this.type == MONEY_TYPE.mainBuyCarGold
- // || this.btnGet.active) {
- if (this.btnGet.active || (this.type == MONEY_TYPE.gold && this.adType == VIDEO_TYPE.buyCarMainBtn)) {
- // if (GameM.commonData.checkShowMainPop()) {
- // AdM.showNative(0)
- // }
- }
- else {
- AdM.showNative(0)
- }
- }
- if (!this.btnGet.active) {
- AdM.showBanner()
- }
- }
- getNewCarDelayCall() {
- // this.btn_close.active = true;
- this.btnCarSingle.active = true;
- this.btnCarSingle.opacity = 0;
- cc.tween(this.btnCarSingle).to(0.5, { opacity: 255 }).start();
- }
- clickLvUp() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.adM.watchVideo(this.adType);
- }
- showCleartime() {
- this.clearBtnNode.active = true
- this.clearCloseNode.active = true
- }
- clickClearCoolTime() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (GameM.commonData.isVideoTest) {
- this.clearCoolTime()
- } else {
- GameM.adM.watchVideo(this.adType);
- }
- }
- //清除所有罢工
- clearCoolTime() {
- this.node.active = false
- EffectNode.instance.PlayTip(`成功清除所有武将罢工`)
- UiM.Instance.hallNode.getComponent(Main).clearAllCoolTime()
- }
- clickGetGold() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (this.turntable) {
- UiM.Instance.turntableNode.getComponent(Turntable).updateCurrentNum()
- }
- switch (this.type) {
- case MONEY_TYPE.gold:
- if (this.carSp != null) {
- if (!NativeAdAwardData.Instance.canGetAward(3)) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- }
- if (this.isVideo) {
- if (this.isAirship) {
- GameM.adM.watchVideo(VIDEO_TYPE.gift_gold);
- }
- }
- else {
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- }
- if (this.carSp != null) {
- if (!NativeAdAwardData.Instance.canGetAward(3)) {
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- }
- else {
- UiM.Instance.onPanel(PANEL_NAME.NativeAdAwardNode, false, () => {
- UiM.Instance.nativeAdAwardNode.getComponent(NativeADAwardNode).init(3, this.num, this.carSp)
- })
- }
- }
- else {
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- }
- this.node.active = false
- }
- if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn) {
- this.adType = null
- let key = 'dddddddddddddddddddddddddddddddd'
- GameM.commonData.dayBuyCarVideoLimitTimes--
- let d = Utils.Encrypt(GameM.commonData.dayBuyCarVideoLimitTimes, key, GameM.commonData.appid)
- GameM.globalStorage.setStorage(STORAGE_KEY.dayBuyCarVideoLimitTimes, d, 1)
- EffectNode.instance.PlayTip(`今日剩余次数:${GameM.commonData.dayBuyCarVideoLimitTimes}`)
- }
- break
- case MONEY_TYPE.redMoney: //含飞船奖励
- this.node.active = false
- //if (this.isAirship) {
- if (this.isVideo) {
- if (this.isAirship) {
- //飞船奖励400元宝看广告获取
- GameM.adM.watchVideo(VIDEO_TYPE.gift_redMoney);
- } else {
- //车位元宝视频
- //最高等级车奖励视频
- GameM.adM.watchVideo(this.adType);
- }
- } else {
- GameM.commonData.updateRedMoney(Number(this.num), RecordTYPE.onlineGiftRed)
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- }
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300));
- }
- break
- case MONEY_TYPE.offlineGold:
- GameM.commonData.updateGold(this.num)
- this.node.active = false
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- break
- case MONEY_TYPE.box: //含飞船奖励
- if (this.isVideo) {
- GameM.adM.watchVideo(VIDEO_TYPE.gift_box)
- }
- else {
- this.node.active = false
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- }
- //立刻生成
- for (let i = 0; i < Number(this.num); i++) {
- UiM.Instance.hallNode.getComponent(Main).addBoxGiftNow();
- }
- }
- break
- case MONEY_TYPE.buyCarGold:
- GameM.adM.watchVideo(VIDEO_TYPE.shopBuyCarBtn);
- break
- case MONEY_TYPE.mainBuyCarGold:
- GameM.adM.watchVideo(VIDEO_TYPE.buyCarMainBtn);
- break
- case MONEY_TYPE.turnTableCard:
- if (this.isVideo) {
- if (GameM.commonData.isVideoTest) {
- this.onPropADEnd()
- } else {
- GameM.adM.watchVideo(VIDEO_TYPE.gift_Prop);
- }
- // return
- } else {
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- GameM.commonData.roleData.airshipTurntableCard++
- }
- this.node.active = false
- RoleManageData.Instance.addTurntableCardCount(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`转盘卡+${this.num}`)
- }
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- break
- case MONEY_TYPE.treasureCard:
- if (this.isVideo) {
- if (GameM.commonData.isVideoTest) {
- this.onPropADEnd()
- } else {
- GameM.adM.watchVideo(VIDEO_TYPE.gift_Prop);
- }
- // return
- } else {
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- GameM.commonData.roleData.airshipTicket++
- }
- this.node.active = false
- RoleManageData.Instance.addTreasureCard(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`夺宝券+${this.num}`)
- }
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- break
- case MONEY_TYPE.speedCard:
- if (this.isVideo) {
- if (GameM.commonData.isVideoTest) {
- this.onPropADEnd()
- } else {
- GameM.adM.watchVideo(VIDEO_TYPE.gift_Prop);
- }
- // return
- } else {
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- GameM.commonData.roleData.airshipSpeedCard++
- }
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- this.node.active = false
- RoleManageData.Instance.addInvestCard(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`加速券+${this.num}`)
- }
- break
- case MONEY_TYPE.talentCoin:
- if (this.isVideo) {
- // if (GameM.commonData.isVideoTest) {
- // this.onPropADEnd()
- // } else {
- // GameM.adM.watchVideo(VIDEO_TYPE.gift_Prop);
- // }
- // return
- } else {
- if (this.isAirship) {
- // GameM.commonData.updateAirShipTimes()
- // GameM.commonData.roleData.airshipSpeedCard++
- }
- // if (this.carSp != null) {
- // let s = this.carSp.getComponent(CarSpace)
- // s.changeType(0)
- // GameM.commonData.updateBagCarData(s.index.toString(), 0)
- // this.scheduleOnce(() => {
- // UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- // }, 0.1)
- // }
- this.node.active = false
- MateData.Ins.talentCoin += Number(this.num)
- LogUtil.logV("HTTP_TYPE.updateBattleStoneCount one", MateData.Ins.talentCoin)
- GameM.httpM.SendData(HTTP_TYPE.updateBattleStoneCount, { "count": MateData.Ins.talentCoin })
- //更新红点
- MateData.Ins.checkMateRedPoint()
- EffectNode.instance.PlayTip(`天赋石+${this.num}`)
- }
- break
- }
- //显示界面
- UiM.Instance.displayPanel();
- }
- // /**购买按钮视频广告回调*/
- // onBuyCarAdEnd() {
- // EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放");
- // // this.type = MONEY_TYPE.gold
- // // this.videoIcon.active = false
- // GameM.commonData.updateClickVideoTimes()
- // GameM.commonData.updateGold(this.num)
- // UiM.Instance.hallNode.getComponent(Main).updateBuyBtnState();
- // this.node.active = false
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- // }
- //飞船看广告后得宝箱
- onGiftBoxWatchEnd() {
- GameM.commonData.updateGiftCacheNum(this.num)
- this.node.active = false
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- }
- EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放");
- //显示界面
- UiM.Instance.displayPanel();
- }
- //飞船看广告后奖励元宝
- onGiftRedMoneyAdEnd() {
- GameM.commonData.updateRedMoney(Number(this.num), RecordTYPE.airship)
- GameM.commonData.updateAirShipTimes()
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300));
- EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放");
- }
- //飞船看广告后得金币
- onGiftGoldADEnd() {
- GameM.commonData.updateAirShipTimes()
- this.node.active = false
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- }
- /** 双倍领取离线收益 */
- clickGetOffline() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.adM.watchVideo(VIDEO_TYPE.offLineDouble)
- }
- onOfflineWatchEnd() {
- this.num = Sciencen_M.instance.accMul(this.num, '2')
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300))
- this.node.active = false
- EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放");
- //显示界面
- UiM.Instance.displayPanel();
- }
- //飞船看广告后获得物品 //夺宝券,加速卡,转盘卡
- onPropADEnd() {
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- switch (this.type) {
- case MONEY_TYPE.turnTableCard:
- GameM.commonData.roleData.airshipTurntableCard++
- break;
- case MONEY_TYPE.treasureCard:
- GameM.commonData.roleData.airshipTicket++
- break;
- case MONEY_TYPE.speedCard:
- GameM.commonData.roleData.airshipSpeedCard++
- break;
- }
- }
- EffectNode.instance.PlayTip("感谢您的观看,额外奖励已发放");
- switch (this.type) {
- case MONEY_TYPE.turnTableCard:
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- RoleManageData.Instance.addTurntableCardCount(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`转盘卡+${this.num}`)
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- break
- case MONEY_TYPE.treasureCard:
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- RoleManageData.Instance.addTreasureCard(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`夺宝券+${this.num}`)
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- break
- case MONEY_TYPE.speedCard:
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- RoleManageData.Instance.addInvestCard(Number(this.num).valueOf())
- EffectNode.instance.PlayTip(`加速券+${this.num}`)
- break
- }
- this.node.active = false
- }
- //直接领取
- clickGetCarSingle() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.commonData.updateRedMoney(Number(this.num), RecordTYPE.carLevelup)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300));
- this.node.active = false
- console.log("----> clickGetCarSingle")
- this.checkShowGuide()
- UiM.Instance.hallNode.getComponent(Main).playCarProEff()
- }
- checkShowGuide() {
- // if (GameM.commonData.maxCarLevel == GameM.commonData.cashCft[0].type_value && UiM.Instance.hallNode) {
- // UiM.Instance.hallNode.getComponent(Main).checkNewUser()
- // }
- let setColor = false
- if (GameM.commonData.maxCarLevel == 2) {
- if (GameM.commonData.redSwitch) {
- // UiM.Instance.guideNode.getComponent(Guide).showMask4();
- setColor = true
- }
- }
- else if (GameM.commonData.maxCarLevel == 3) {
- if (GameM.commonData.redSwitch) {
- // UiM.Instance.guideNode.getComponent(Guide).showGuide10();
- setColor = true
- }
- }
- else if (GameM.commonData.maxCarLevel == GameM.commonData.dailyCashOpenLevel) {
- setColor = true
- if (GameM.commonData.redSwitch) {
- GuideManager.Instance.createFullGuide(cc.find("Canvas"), 2, () => {
- // UiM.Instance.guideNode.getComponent(Guide).showGuide9(0)
- })
- }
- }
- // else if (GameM.commonData.maxCarLevel == GameM.commonData.investOpenLevel) {
- // //投资引导
- // UiM.Instance.hallNode.getComponent(Main).showInvestHand()
- // setColor = true
- // }
- //else if (GameM.commonData.maxCarLevel == GameM.commonData.factoryOpenLevel) {
- else if (GameM.commonData.maxCarLevel == GameM.commonData.unlockStrikeLv) {
- //工厂开启 改为 开启西游点击生成金币
- //西游 点击武将生成金币引导 放到最新引导模块
- if (!GuideMng.Ins.IsUnlockStrike()) {
- let name = UiM.Instance.hallNode.getComponent(Main).GetRoleSpaceIndex();
- console.log("-->StrikeGuideName:" + name);
- GuideMng.Ins.UpdateGuideStrikeFile(name);
- GuideMng.Ins.CheckUnlockStrike();
- }
- //航海
- //UiM.Instance.guideNode.getComponent(Guide).showFacGuide()
- //setColor = true
- }
- else if (GameM.commonData.maxCarLevel == GameM.commonData.loginRewardOpenLevel) {
- if (GameM.commonData.redSwitch) {
- // UiM.Instance.guideNode.getComponent(Guide).showDailyGuide()
- setColor = true
- }
- }
- else if (GameM.commonData.maxCarLevel == GameM.commonData.trerasureOpenLevel) {
- setColor = true
- if (GameM.commonData.redSwitch) {
- // GuideManager.Instance.createFullGuide(cc.find("Canvas"), 3, () => {
- // UiM.Instance.guideNode.getComponent(Guide).showTreasureStep1();
- // })
- }
- }
- // else if (GameM.commonData.maxCarLevel == GameM.commonData.richBankUnLockLevel) {
- // setColor = true
- // if (GameM.commonData.redSwitch) {
- // LogUtil.logV("HTTP_TYPE.bankCashRecord", "")
- // GameM.httpM.sendDatas(HTTP_TYPE.backIsOpenRichBank, {})
- // // UiM.Instance.guideNode.getComponent(Guide).bankGuideStep1();
- // // to do
- // // GuideManager.Instance.createFullGuide(cc.find("Canvas"), 3, () => {
- // // UiM.Instance.guideNode.getComponent(Guide).showTreasureStep1();
- // // })
- // }
- // }
- else if (GameM.commonData.maxCarLevel == GameM.commonData.taskOpenLevel) {
- setColor = true
- // UiM.Instance.guideNode.getComponent(Guide).showTask1();
- }
- else {
- //显示界面
- UiM.Instance.displayPanel();
- }
- if (setColor) {
- UiM.Instance.setPanelCool()
- UiM.Instance.hallNode.getComponent(Main).setUnlockBtnColor()
- }
- //西游
- //若解锁新车不进入该界面 getNewCar 此处不会被执行
- //第一次合成战斗判断
- FightData.Ins.CheckComposeFight();
- }
- //双倍奖励 黄色按钮
- clickGetCarDouble() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.adM.watchVideo(VIDEO_TYPE.newCarAward)
- }
- clickGetTreasureCard() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (GameM.commonData.isVideoTest) {
- UiM.Instance.giftNode.getComponent(Gift).onGetTicketAdEnd()
- } else {
- GameM.adM.watchVideo(VIDEO_TYPE.getTicket)
- }
- }
- onGetTicketAdEnd() {
- LogUtil.logV(" onGetTicketAdEndt", "start")
- GameM.commonData.roleData.ticket++
- GameM.commonData.updateRoleData()
- GameM.commonData.updateGold(this.num)
- GameM.commonData.updateClickVideoTimes()
- let str = Sciencen_M.instance.format(this.num)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- EffectNode.instance.PlayTip(`获得金币${str},夺宝券+1`)
- UiM.Instance.treasureNode.getComponent(Treasure).onGetTicketAdEnd()
- this.node.active = false
- }
- onGetCarDoubleWatchEnd() {
- this.btnCarGet.active = true
- this.btnCarDouble.active = false
- this.btnCarSingle.active = false
- this.num = Sciencen_M.instance.addition(this.num, this.num)
- this.labCarNum.string = this.num
- if (GameM.commonData.redSwitch) {
- this.labCarMoney.string = `可兑换${(Number(this.num) * 0.0001).toFixed(2)}元`
- }
- else {
- this.labCarMoney.string = ''
- }
- cc.tween(this.labCarNum.node)
- .delay(0.3)
- .to(0.2, { scale: 1.5 })
- .to(0.2, { scale: 1 })
- .start()
- }
- //领取奖励 黄色按钮 双倍奖励广告后 出现
- clickCarGet() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- GameM.commonData.updateRedMoney(Number(this.num), RecordTYPE.carLevelup)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(1, 20, cc.v2(0, -300));
- this.node.active = false
- console.log("----> clickCarGet")
- this.checkShowGuide()
- UiM.Instance.hallNode.getComponent(Main).playCarProEff()
- }
- clickBg() {
- if (this.type == MONEY_TYPE.offlineGold) {
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- this.node.active = false
- }
- else if (this.type == MONEY_TYPE.gold) {
- if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn) {
- this.adType = null
- let key = 'dddddddddddddddddddddddddddddddd'
- GameM.commonData.dayBuyCarVideoLimitTimes--
- let d = Utils.Encrypt(GameM.commonData.dayBuyCarVideoLimitTimes, key, GameM.commonData.appid)
- GameM.globalStorage.setStorage(STORAGE_KEY.dayBuyCarVideoLimitTimes, d, 1)
- EffectNode.instance.PlayTip(`今日剩余次数:${GameM.commonData.dayBuyCarVideoLimitTimes}`)
- }
- }
- //显示界面
- UiM.Instance.displayPanel();
- }
- clickBgClose() {
- //车辆升级 解锁新车时 无效
- if (this.type == MONEY_TYPE.carLvUp || this.type == MONEY_TYPE.getNewCar) {
- return
- }
- this.clickClose()
- }
- //关闭按钮
- clickClose() {
- // // test
- // this.checkShowGuide()
- LogUtil.logV("gift", "clickClose")
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (this.type == MONEY_TYPE.offlineGold) {
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- if (DailyData.Instance.checkHasGet() && GameM.commonData.maxCarLevel >= GameM.commonData.loginRewardOpenLevel) {
- UiM.Instance.onPanel(PANEL_NAME.DailyNode)
- } else {
- if (GameM.commonData.loginDays >= 2) {
- UiM.Instance.hallNode.getComponent(Main).checkShowClubGuideNode()
- }
- }
- }
- if (this.turntable) {
- UiM.Instance.turntableNode.getComponent(Turntable).updateCurrentNum()
- this.clickGetGold()
- } else if (this.type == MONEY_TYPE.gold) {
- if (!this.isVideo) {
- if (this.isAirship) {
- GameM.commonData.updateAirShipTimes()
- }
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- }
- if (this.carSp != null) {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- }
- if (this.adType == VIDEO_TYPE.buyCarMainBtn || this.adType == VIDEO_TYPE.shopBuyCarBtn) {
- this.adType = null
- let key = 'dddddddddddddddddddddddddddddddd'
- GameM.commonData.dayBuyCarVideoLimitTimes--
- let d = Utils.Encrypt(GameM.commonData.dayBuyCarVideoLimitTimes, key, GameM.commonData.appid)
- GameM.globalStorage.setStorage(STORAGE_KEY.dayBuyCarVideoLimitTimes, d, 1)
- EffectNode.instance.PlayTip(`今日剩余次数:${GameM.commonData.dayBuyCarVideoLimitTimes}`)
- }
- }
- else if (this.type == MONEY_TYPE.popVideo) {
- GameM.commonData.hasPopVideo = false
- }
- else if (this.type == MONEY_TYPE.getNewCar) {
- //若新车解锁 不进入该界面 则该处不会被执行到
- console.log("----> clickClose")
- this.checkShowGuide()
- this.node.active = false
- UiM.Instance.hallNode.getComponent(Main).playCarProEff()
- return
- }
- else if (this.type == MONEY_TYPE.treasureTicket) {
- LogUtil.logV("gift", "MONEY_TYPE.treasureTicket one")
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- } else if (this.type == MONEY_TYPE.clearCooltime) {
- LogUtil.logV("gift", "MONEY_TYPE.clearCooltime one")
- if (this.clearCloseNode.active == false) {
- return
- }
- }
- else if (this.type == MONEY_TYPE.mainBuyCarGold) {
- // //引导取经 大富翁
- // if (RichData.Ins.richCfg.richmanopen == 1) {
- // let hasGuide = PlayerPrefs.GetInt("GGuide20", 0) == 1
- // if (!hasGuide) {
- // GuideMng.Ins.CheckRichGuide20();
- // }
- // else {
- // this.ifPopCoinTipNode()
- // }
- // }
- // else {
- // this.ifPopCoinTipNode()
- // }
- this.ifPopCoinTipNode()
- }
- this.node.active = false
- //显示界面
- UiM.Instance.displayPanel();
- }
- ifPopCoinTipNode() {
- let hasShow = GlobalStorage.Instance.getStorage(STORAGE_KEY.CoinTipTotay, 0)
- if (!hasShow) {
- UiM.Instance.onPanel(PANEL_NAME.CoinTipNode)
- GlobalStorage.Instance.setStorage(STORAGE_KEY.CoinTipTotay, 1, 0)
- }
- }
- // update (dt) {}
- clickOfflineSingle() {
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300))
- this.node.active = false
- //显示界面
- UiM.Instance.displayPanel();
- }
- clickPopVideo() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- // if (GameM.commonData.roleData.hangVideoFree == 0) {
- // GameM.commonData.updateHangVideoFree()
- // GameM.commonData.updateGold(this.num)
- // this.node.active = false
- // GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- // EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- // GameM.commonData.hasPopVideo = false
- // }
- // else {
- // let percent = 1 / (1 + Math.max(0, GameM.commonData.roleData.hangupVideoTimes * 0.4 - 2))
- // let gift = UiM.Instance.giftNode.getComponent(Gift)
- // let num = GameM.commonData.buyNumCfg[(GameM.commonData.buyTimeTotal + 1).toString()].gold
- // num = Sciencen_M.instance.accMul(num, percent.toString())
- // percent = Math.floor(percent * 100)
- // gift.init(MONEY_TYPE.gold, num, null, false, 0, null, percent)
- // UiM.Instance.giftNode.active = true
- // UiM.Instance.giftNode.x = 1000
- GameM.commonData.hasTouch = true
- if (GameM.commonData.isVideoTest) {
- UiM.Instance.hallNode.getComponent(Main).onHangUpAdEnd()
- }
- else {
- GameM.adM.watchVideo(VIDEO_TYPE.hangUp)
- }
- // }
- }
- /** 放弃热气球 */
- clickDropAirShip() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.node.active = false
- UiM.Instance.hallNode.getComponent(Main).dropAirShip()
- }
- /** 工厂过热冷却时间减半 */
- clickFacReduceTime() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.node.active = false
- UiM.Instance.onPanel(PANEL_NAME.NativeAdAwardNode, false, () => {
- UiM.Instance.nativeAdAwardNode.getComponent(NativeADAwardNode).init(1)
- })
- }
- changeAir = false
- /** 换一个热气球奖励 */
- clickChangeAirShip() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- this.changeAir = true
- this.node.active = false
- UiM.Instance.onPanel(PANEL_NAME.NativeAdAwardNode, false, () => {
- UiM.Instance.nativeAdAwardNode.getComponent(NativeADAwardNode).init(2)
- })
- }
- /** 车位金币普通领取 */
- clickGet() {
- let s = this.carSp.getComponent(CarSpace)
- s.changeType(0)
- GameM.commonData.updateBagCarData(s.index.toString(), 0)
- this.scheduleOnce(() => {
- UiM.Instance.hallNode.getComponent(Main).checkGiftByQucece()
- }, 0.1)
- this.node.active = false
- GameM.commonData.updateGold(this.num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- }
- cool = false
- clickBanner() {
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (this.cool) {
- return
- }
- this.cool = true
- this.scheduleOnce(() => {
- this.cool = false
- }, 3)
- MoreGameData.Instance.createNewTask(this.streamData)
- }
- }
|