| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737 |
- // 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 CashOutData from "../datas/CashOutData";
- import { HTTP_TYPE } from "../datas/CommonData";
- import { FightData, FightResult } from "../datas/FightData";
- import { MateData } from "../datas/MateData";
- import { RichData } from "../datas/RichData";
- import AdM from "../manager/AdM";
- import GameM, { AUDIO_TYPE, VIDEO_TYPE } from "../manager/GameM";
- import GuideMng from "../manager/GuideMng";
- import HttpM from "../manager/HttpM";
- import UiM, { PANEL_NAME } from "../manager/UiM";
- import MyExtends from "../tools/MyExtends";
- import Time from "../tools/Time";
- import BasePanel from "../uiFrames/BasePanel";
- import UIMng, { PanelType } from "../uiFrames/UIMng";
- import Random from "../utils/Random";
- import Sciencen_M from "../utils/Sciencen_M";
- import CashOut from "./CashOut";
- import EffectNode from "./EffectNode";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class FightResultPanel extends BasePanel {
- @property(cc.Node)
- panelNode: cc.Node = null;
- @property(cc.Node)
- successNode: cc.Node = null;
- @property(cc.Node)
- title: cc.Node = null;
- @property(cc.Node)
- stars: cc.Node[] = [];
- @property(cc.Node)
- rectNode: cc.Node = null;
- @property(cc.Node)
- boxNode: cc.Node = null;
- @property(sp.Skeleton)
- boxs: sp.Skeleton[] = [];
- @property(cc.Node)
- box_qipao: cc.Node = null;
- @property(cc.Node)
- rds: cc.Node[] = [];
- @property(cc.Sprite)
- rds_imgs: cc.Sprite[] = [];
- @property(cc.Label)
- rds_txts: cc.Label[] = [];
- @property(cc.Label)
- rds_tipTxts: cc.Label[] = [];
- @property(cc.Node)
- rds_lightbox: cc.Node[] = [];
- @property(cc.Node)
- rd_tianfu: cc.Node = null;
- @property(cc.Label)
- rd_tianfu_txt: cc.Label = null;
- //@property(cc.Node)
- //btnOpen: cc.Node = null;
- @property(cc.Node)
- failNode: cc.Node = null;
- @property(cc.Sprite)
- failRoleImg: cc.Sprite = null;
- @property(cc.Node)
- cashNode: cc.Node = null;
- @property(cc.Sprite)
- cashImg: cc.Sprite = null;
- @property(cc.Label)
- cashTxt: cc.Label = null;
- @property(cc.Node)
- rewardNo: cc.Node = null;
- @property(cc.Node)
- rewardNode: cc.Node = null;
- @property(cc.Label)
- rewardRemaindeTxt: cc.Label = null;
- @property(cc.Node)
- btnCash: cc.Node = null;
- @property(cc.Node)
- btnSure: cc.Node = null;
- @property(cc.Node)
- btnAdSure: cc.Node = null;
- @property(cc.Node)
- btnAdRich: cc.Node = null;
- @property(cc.Node)
- btnBack: cc.Node = null;
- @property(cc.Node)
- btnNor: cc.Node = null;
- @property(cc.Node)
- btnClose: cc.Node = null;
- private result: FightResult = null;
- private boxInitPos: cc.Vec2 = cc.v2();
- private rewardCfg: any = null;
- private rewardList: any[] = null;
- private rewardCoin: string = '';
- private rewardBoxIndex: number = 0;
- private isDoubleReward: boolean = false;
- private isCanClickBtn: boolean = true;
- private isClickRichAd: boolean = false;
- private richDoubleIndex: number = -1;
- /**大富翁除了 双倍卡之外的奖励盒子索引数组*/
- private richBoxList: number[] = [];
- onLoad() {
- this.boxInitPos = this.boxNode.getPosition();
- /*
-
- GameM.commonData.updateGold(num)
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false)
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- */
- }
- OnEnter(param: any) {
- this.result = param;
- this.rewardCoin = "";
- this.isDoubleReward = false;
- this.isCanClickBtn = true;
- this.successNode.active = this.result.result == 1;
- this.failNode.active = this.result.result != 1;
- this.rewardRemaindeTxt.node.active = this.result.fightType == 2;
- this.rewardRemaindeTxt.string = this.result.reward_times > 0 ? "今日剩余奖励次数:" + this.result.reward_times : "";
- this.btnAdRich.active = false;
- this.btnNor.active = false;
- this.richDoubleIndex = -1;
- //this.rewardRemaindeTxt.string
- if (this.result.fightType == 2) {
- let haveRward = this.result.rewards != null && this.result.rewards.length > 0;
- this.rewardNode.active = haveRward;
- this.btnClose.active = haveRward;
- this.btnAdSure.active = haveRward;
- this.btnSure.active = !haveRward;
- this.rewardNo.active = !haveRward;
- }
- else if (this.result.fightType == 3) {
- //大富翁战斗
- let haveRward = this.result.rewards != null && this.result.rewards.length > 0;
- this.rewardNode.active = haveRward;
- this.btnClose.active = haveRward;
- this.btnAdSure.active = haveRward;
- this.btnSure.active = !haveRward;
- this.rewardNo.active = !haveRward;
- this.isClickRichAd = false;
- this.richBoxList = [];
- }
- else {
- //不显示宝箱奖励 改为提现
- this.rewardNode.active = false;
- //this.rewardNode.active = true;
- this.btnSure.active = false;
- this.btnAdSure.active = false;
- this.btnClose.active = true;
- this.rewardNo.active = false;
- }
- if (this.result.result == 1) {
- GameM.audioM.playEffect(AUDIO_TYPE.victory);
- for (let i = 0; i < this.boxs.length; i++) {
- cc.Tween.stopAllByTarget(this.stars[i]);
- this.stars[i].scale = 20;
- this.stars[i].active = false;
- if (i + 1 == this.result.star) {
- this.rewardBoxIndex = i;
- this.boxs[i].node.active = true;
- } else {
- this.boxs[i].node.active = false;
- }
- }
- if (this.result.fightType == 2) {
- //战斗二 正常领取奖励
- this.cashNode.active = false;
- this.btnCash.active = false;
- this.btnClose.active = false;
- this.btnAdSure.active = false;
- this.boxNode.scale = 1;
- this.box_qipao.active = true;
- //this.box.color = this.GetBoxColor();
- this.boxs[this.rewardBoxIndex].setAnimation(0, "idle", true);
- if (this.result.rewards != null) {
- this.rewardList = this.result.rewards;
- //this.rewardList = this.rewardList.sort((a, b) => { return a.reward_id - b.reward_id });
- console.log("----->rewardList:", this.rewardList);
- for (let n of this.rds) {
- n.setPosition(this.boxInitPos);
- n.active = false;
- }
- this.rd_tianfu.setPosition(this.boxInitPos);
- this.rd_tianfu.active = false;
- for (let i = 0; i < this.rewardList.length; i++) {
- cc.loader.loadRes("xiyou/icon/reward" + this.rewardList[i].code, cc.SpriteFrame, (err, res) => {
- if (err) { console.log("img load err:" + JSON.stringify(err)); }
- this.rds_imgs[i].spriteFrame = res;
- });
- this.rds_lightbox[i].active = false;
- if (this.rewardList[i].code == "10001") {
- let num = GameM.commonData.buyNumCfg[(GameM.commonData.buyTimeTotal + 1).toString()].gold;
- num = Sciencen_M.instance.accMul(num, this.rewardList[i].count.toString());
- this.rewardCoin = num;
- this.rds_txts[i].string = Sciencen_M.instance.format(num);
- } else {
- this.rds_txts[i].string = this.rewardList[i].count.toString();
- }
- this.rds_tipTxts[i].string = this.rewardList[i].name;
- this.rds[i].getChildByName("AdIcon").active = false;// this.rewardList[i].code == "30005";
- }
- this.rd_tianfu_txt.string = this.result.talent.toString();
- this.rectNode.height = this.rewardList.length + 1 > 3 ? 430 : 215;
- this.title.y = this.rewardList.length + 1 > 3 ? 390 : 460;
- this.InitRewardData();
- }
- // AdM.onSendEvent(`fight_old_win`, `旧怪触发战斗胜利`, 'fight_old_win');
- }
- else if (this.result.fightType == 3) {
- //战斗三 大富翁奖励
- this.cashNode.active = false;
- this.btnCash.active = false;
- this.btnClose.active = false;
- this.btnAdSure.active = false;
- this.boxNode.scale = 1;
- this.box_qipao.active = true;
- //this.box.color = this.GetBoxColor();
- this.boxs[this.rewardBoxIndex].setAnimation(0, "idle", true);
- if (this.result.rewards != null) {
- this.rewardList = this.result.rewards;
- //this.rewardList = this.rewardList.sort((a, b) => { return a.reward_id - b.reward_id });
- console.log("----->rewardList:", this.rewardList);
- for (let n of this.rds) {
- n.setPosition(this.boxInitPos);
- n.active = false;
- }
- this.rd_tianfu.setPosition(this.boxInitPos);
- this.rd_tianfu.active = false;
- for (let i = 0; i < this.rewardList.length; i++) {
- cc.loader.loadRes("xiyou/icon/reward" + this.rewardList[i].code, cc.SpriteFrame, (err, res) => {
- if (err) { console.log("img load err:" + JSON.stringify(err)); }
- this.rds_imgs[i].spriteFrame = res;
- });
- if (this.rewardList[i].code == "10001") {
- let num = GameM.commonData.buyNumCfg[(GameM.commonData.buyTimeTotal + 1).toString()].gold;
- num = Sciencen_M.instance.accMul(num, this.rewardList[i].count.toString());
- this.rewardCoin = num;
- this.rds_txts[i].string = Sciencen_M.instance.format(num);
- this.richBoxList.push(i);
- this.rds_lightbox[i].active = false;
- }
- else if (this.rewardList[i].code == "30005") {
- this.richDoubleIndex = i;
- this.rds_txts[i].string = this.rewardList[i].count.toString();
- this.rds_lightbox[i].active = true;
- }
- else {
- this.rds_txts[i].string = this.rewardList[i].count.toString();
- this.rds_lightbox[i].active = false;
- this.richBoxList.push(i);
- }
- this.rds[i].getChildByName("AdIcon").active = this.rewardList[i].code == "30005";
- this.rds_tipTxts[i].string = this.rewardList[i].name;
- }
- this.rd_tianfu_txt.string = this.result.talent.toString();
- this.rectNode.height = this.rewardList.length > 3 ? 430 : 215;
- this.title.y = this.rewardList.length + 1 > 3 ? 390 : 460;
- this.InitRewardData();
- }
- AdM.onSendEvent('Qujing_Fight_Win', '取经战斗胜利', "qujing");
- }
- else {
- //战斗一 提现
- this.cashNode.active = true;
- this.btnClose.active = false;
- this.btnCash.active = true;
- cc.loader.loadRes('carPic/side/side_' + this.result.lv, cc.SpriteFrame, (err, res) => {
- if (err) { console.log("img load err:" + JSON.stringify(err)); }
- this.cashImg.spriteFrame = res;
- });
- let cfg = CashOutData.Instance.cashCft;
- let len = cfg.length;
- for (var i = 0; i < len; i++) {
- if (cfg[i].type_value == this.result.lv) {
- this.cashTxt.string = cfg[i].moneyshow.split('~')[1];
- break;
- }
- }
- if (this.result.lv == 14) {
- GuideMng.Ins.CheckCashGuide14();
- }
- // AdM.onSendEvent(`fight_new_win_${this.result.lv}`, `${GameM.commonData.fightRoleCfg[this.result.lv.toString()].name}`, 'fight_new_win')
- }
- this.PlayStarAni();
- } else {
- GameM.audioM.playEffect(AUDIO_TYPE.fail);
- cc.loader.loadRes('carPic/side/side_' + this.result.lv, cc.SpriteFrame, (err, res) => {
- if (err) { console.log("img load err:" + JSON.stringify(err)); }
- this.failRoleImg.spriteFrame = res;
- });
- this.btnClose.active = false;
- if (this.result.fightType == 1) {
- // AdM.onSendEvent(`fight_new_fail_${this.result.lv}`, `${GameM.commonData.fightRoleCfg[this.result.lv.toString()].name}`, 'fight_new_fail')
- } else {
- // AdM.onSendEvent(`fight_old_fail`, `旧怪触发战斗失败`, 'fight_old_fail');
- }
- }
- this.panelNode.scale = 0;
- this.node.active = true;
- cc.tween(this.panelNode).to(0.2, { scale: 1 }, { easing: "backOut" }).start();
- this.node.setSiblingIndex(this.node.parent.childrenCount - 1);
- }
- OnExit() {
- this.node.active = false;
- //进行货币获取计算
- this.RewardCalculate();
- //解锁伙伴判断
- if (this.result.fightType == 1 && this.result.result == 1) {
- //if (this.result.unlock_mateid != null && this.result.unlock_mateid !== "") {
- // let mateid = Number(this.result.unlock_mateid);
- // //解锁伙伴
- // FightData.Ins.UnlockMate(mateid, this.result.lv);
- //}
- if (this.result.lv == 7) {
- //西游
- //提现引导 弃用
- // GuideMng.Ins.CheckCashGuide10();
- }
- //if (this.result.lv == 5 || this.result.lv == 12 || this.result.lv == 19 || this.result.lv == 21) {
- // let mateid = 2;
- // if (this.result.lv == 5)
- // mateid = 2;
- // else if (this.result.lv == 12)
- // mateid = 3;
- // else if (this.result.lv == 19)
- // mateid = 4;
- // else if (this.result.lv == 21)
- // mateid = 5;
- // FightData.Ins.UnlockMate(mateid, this.result.lv);
- //}
- }
- }
- async PlayStarAni() {
- let posAry: cc.Vec2[] = [];
- if (this.result.star < 1) { return; }
- else {
- if (this.result.star == 1) {
- posAry.push(cc.v2(0, 15));
- } else if (this.result.star == 2) {
- posAry.push(cc.v2(-40, 15));
- posAry.push(cc.v2(40, 15));
- } else if (this.result.star == 3) {
- posAry.push(cc.v2(-80, 3));
- posAry.push(cc.v2(0, 15));
- posAry.push(cc.v2(80, 3));
- }
- }
- let index = 0;
- for (let i = 0; i < this.stars.length; i++) {
- if (i + 1 <= this.result.star) {
- this.stars[i].scale = 20;
- this.stars[i].active = true;
- console.log("POS:" + posAry[index].y);
- this.stars[i].setPosition(posAry[index]);
- cc.tween(this.stars[i]).to(0.15, { scale: 1 }).start();
- index++;
- await Time.WaitForSeconds(0.2);
- }
- }
- }
- GetBoxColor() {
- switch (this.result.star) {
- case 1:
- return cc.color(100, 100, 100, 255);
- case 2:
- return cc.color(56, 150, 126, 255);
- case 3:
- return cc.color(255, 255, 0, 255);
- }
- /*
- [
- {1: 0.4},
- {2: 2},
- {3: 4}
- ]
-
- */
- }
- RewardCalculate() {
- if (this.result.result == 1) {
- if (this.result.fightType == 2) {
- let times = this.isDoubleReward ? 2 : 1;
- MateData.Ins.talentCoin += this.result.talent * times;
- //更新红点
- MateData.Ins.checkMateRedPoint()
- if (this.result.rewards != null) {
- for (let i = 0; i < this.rewardList.length; i++) {
- if (this.rewardList[i].code == "10001") {
- if (this.isDoubleReward)
- this.rewardCoin = Sciencen_M.instance.accMul(this.rewardCoin, "2");
- GameM.commonData.updateGold(this.rewardCoin);
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false);
- EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- } else if (this.rewardList[i].code == "10002") {
- GameM.commonData.updateRedMoney(this.rewardList[i].count * times)
- } else if (this.rewardList[i].code == "20002") {
- GameM.commonData.roleData.turntableCard += this.rewardList[i].count * times;
- } else if (this.rewardList[i].code == "20001") {
- GameM.commonData.roleData.speedCard += this.rewardList[i].count * times;
- } else if (this.rewardList[i].code == "20003") {
- GameM.commonData.roleData.ticket += this.rewardList[i].count * times;
- }
- }
- }
- GameM.commonData.updateRoleData();
- }
- else if (this.result.fightType == 3) {
- //return;
- //更新红点
- MateData.Ins.checkMateRedPoint()
- if (this.result.rewards != null) {
- let richDice: any = null;
- let rewardefts: number[] = [];
- for (let i = 0; i < this.rewardList.length; i++) {
- if (this.rewardList[i].code == "10001") {
- //if (this.isDoubleReward)
- // this.rewardCoin = Sciencen_M.instance.accMul(this.rewardCoin, "2");
- GameM.commonData.updateGold(this.rewardCoin);
- GameM.audioM.playEffect(AUDIO_TYPE.getGold, false);
- //EffectNode.instance.PlayCoinAnim(0, 20, cc.v2(0, -300));
- rewardefts.push(10001);
- } else if (this.rewardList[i].code == "10002") {
- GameM.commonData.updateRedMoney(this.rewardList[i].count)
- } else if (this.rewardList[i].code == "20002") {
- GameM.commonData.roleData.turntableCard += this.rewardList[i].count;
- } else if (this.rewardList[i].code == "20001") {
- GameM.commonData.roleData.speedCard += this.rewardList[i].count;
- } else if (this.rewardList[i].code == "20003") {
- GameM.commonData.roleData.ticket += this.rewardList[i].count;
- } else if (this.rewardList[i].code == "20006") {
- MateData.Ins.talentCoin += this.rewardList[i].count;
- } else if (this.rewardList[i].code == "30001") {
- if (richDice == null) richDice = {};
- richDice.diceAdNum = this.rewardList[i].count;
- } else if (this.rewardList[i].code == "30002") {
- if (richDice == null) richDice = {};
- richDice.remoteCtrlNum = this.rewardList[i].count;
- rewardefts.push(30002);
- } else if (this.rewardList[i].code == "30004") {
- if (richDice == null) richDice = {};
- richDice.scriptureNum = this.rewardList[i].count;
- } else if (this.rewardList[i].code == "30005") {
- if (this.isClickRichAd) {
- if (richDice == null) richDice = {};
- richDice.doubleNum = this.rewardList[i].count;
- rewardefts.push(30005);
- AdM.onSendEvent('Qujing_GetDouble', '取经获得双倍卡', "qujing");
- }
- }
- }
- if (richDice != null) {
- //进入取经战斗 前提就是满足奖励条件下
- richDice.rewardNum = 1;
- RichData.Ins.UpdateItemCard2(richDice, () => {
- for (let i = 0; i < rewardefts.length; i++) {
- if (rewardefts[i] == 10001) {
- RichData.Ins.PlayParticleEft(10001, 1, this.node);
- } else if (rewardefts[i] == 30002) {
- RichData.Ins.PlayParticleEft(30002, 3, this.node);
- } else if (rewardefts[i] == 30005) {
- RichData.Ins.PlayParticleEft(30005, 4, this.node);
- }
- }
- }, false);
- console.log("---->RichDice:", richDice);
- } else {
- for (let i = 0; i < rewardefts.length; i++) {
- if (rewardefts[i] == 10001) {
- RichData.Ins.PlayParticleEft(10001, 1, this.node);
- }
- }
- }
- console.log("---->RichDice End:", richDice);
- GameM.commonData.updateRoleData();
- }
- //引导取经 大富翁
- GuideMng.Ins.CheckRichGuide22();
- EffectNode.instance.PlayTip("恭喜获得奖励");
- }
- }
- }
- private num: number = 0;
- private totalNum: number = 0
- private curNumIndex: number = 0;
- private leftPosX: number = 0;
- private boxPosY1: number = -80;
- private boxPosY2: number = -290;
- private isCanClick: boolean = false;
- InitRewardData() {
- this.num = this.rewardList.length; //除了天赋点的奖品
- this.totalNum = this.num + (this.result.talent > 0 ? 1 : 0);
- this.curNumIndex = 0;
- if (this.totalNum >= 3) {
- this.leftPosX = -180;
- } else {
- this.leftPosX = -((this.totalNum - 1) * 180 / 2);
- }
- this.isCanClick = true;
- }
- async Click_Box() {
- if (this.curNumIndex < this.totalNum && this.isCanClick) {
- this.isCanClick = false;
- if (this.box_qipao.active) this.box_qipao.active = false;
- if (this.curNumIndex < this.totalNum - 1) {
- this.boxs[this.rewardBoxIndex].setAnimation(0, "open", false);
- await Time.WaitForSeconds(0.3);
- GameM.audioM.playEffect(AUDIO_TYPE.box_open);
- this.rds[this.curNumIndex].active = true;
- if (this.curNumIndex <= 2)
- this.rds[this.curNumIndex].runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * this.curNumIndex, this.boxPosY1), 200, 1));
- else
- this.rds[this.curNumIndex].runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * (this.curNumIndex - 3), this.boxPosY2), 200, 1));
- this.curNumIndex++;
- this.isCanClick = true;
- } else {
- //最后一个奖励 如果有天赋石就放最后一个显示
- if (this.result.talent > 0) {
- this.boxs[this.rewardBoxIndex].setAnimation(0, "turn on", false);
- await Time.WaitForSeconds(0.3);
- GameM.audioM.playEffect(AUDIO_TYPE.box_open);
- this.rd_tianfu.active = true;
- if (this.totalNum <= 3)
- this.rd_tianfu.runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * this.curNumIndex, this.boxPosY1), 200, 1));
- else
- this.rd_tianfu.runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * (this.totalNum - 4), this.boxPosY2), 200, 1));
- } else {
- this.boxs[this.rewardBoxIndex].setAnimation(0, "turn on", false);
- await Time.WaitForSeconds(0.3);
- GameM.audioM.playEffect(AUDIO_TYPE.box_open);
- this.rds[this.curNumIndex].active = true;
- if (this.curNumIndex <= 2)
- this.rds[this.curNumIndex].runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * this.curNumIndex, this.boxPosY1), 200, 1));
- else
- this.rds[this.curNumIndex].runAction(cc.jumpTo(0.2, cc.v2(this.leftPosX + 180 * (this.curNumIndex - 3), this.boxPosY2), 200, 1));
- }
- await Time.WaitForSeconds(1);
- if (this.result.fightType == 2) {
- this.btnClose.active = true;
- this.btnAdSure.active = true;
- }
- else if (this.result.fightType == 3) {
- if (this.richDoubleIndex != -1) {
- this.btnClose.active = true;
- this.btnAdRich.active = true;
- }
- else {
- this.btnNor.active = true;
- }
- }
- }
- }
- }
- Click_CashBtn() {
- this.OnExit();
- //AdM.onSendEvent('click7', '提现点击')
- GameM.audioM.playEffect(AUDIO_TYPE.button)
- if (!GameM.commonData.redSwitch) {
- EffectNode.instance.PlayTip('敬请期待')
- return
- }
- if (GameM.commonData.maxCarLevel < GameM.commonData.cashOpenLevel) {
- EffectNode.instance.PlayTip(`首次合成${GameM.commonData.cashOpenLevel}级武将可查看`)
- return
- }
- UiM.Instance.onPanel(PANEL_NAME.CashNode, true, () => {
- UiM.Instance.cashNode.getComponent(CashOut).showGuide()
- })
- }
- //双倍领取
- Click_AdSureBtn() {
- if (!this.isCanClickBtn) return;
- this.isCanClickBtn = false;
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- //this.AdDoubleEnd();
- GameM.adM.watchVideo(VIDEO_TYPE.fight2Double);
- GameM.audioM.playEffect(AUDIO_TYPE.button);
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- }
- AdDoubleEnd() {
- HttpM.Instance.SendData(HTTP_TYPE.battleDoubleAward, { battleId: this.result.fightId, getType: 2 }, (res) => {
- console.log("-->double:", res);
- if (res.errcode == 0) {
- this.isDoubleReward = true;
- this.OnExit();
- }
- this.isCanClickBtn = true;
- });
- // AdM.onSendEvent(`fight_award_double`, `战斗2双倍奖励`, 'fight_award_double');
- }
- /**大富翁 我全都要*/
- Click_AdRichBtn() {
- if (!this.isCanClickBtn) return;
- this.isCanClickBtn = false;
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- //this.AdDoubleEnd();
- GameM.adM.watchVideo(VIDEO_TYPE.richFightAd);
- GameM.audioM.playEffect(AUDIO_TYPE.button);
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- AdM.onSendEvent(`video_init_16`, `取经战斗-全部奖励视频拉起`, 'video_init');
- }
- /**大富翁 我全都要视频结束*/
- AdRichEnd() {
- //if (res.errcode == 0) {
- this.isClickRichAd = true;
- this.OnExit();
- //}
- this.isCanClickBtn = true;
- //AdM.onSendEvent(`fight_award_double`, `战斗2双倍奖励`, 'fight_award_double');
- }
- Click_CloseBtn() {
- if (!this.isCanClickBtn) return;
- this.isCanClickBtn = false;
- //UIMng.Ins.GetPanel(PanelType.FightUpPanel).OnEnter();
- if (this.result.fightType == 3) {
- if (this.richDoubleIndex != -1) {
- cc.tween(this.rds[this.richDoubleIndex])
- .to(0.5, { opacity: 0 })
- .call(() => {
- this.rds[this.richDoubleIndex].active = false; this.rds[this.richDoubleIndex].opacity = 255;
- for (let i = 0; i < this.richBoxList.length; i++) {
- this.rds[this.richBoxList[i]].runAction(cc.moveBy(0.5, cc.v2(90, 0)));
- }
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- this.OnExit();
- if (this.result.result != 1) {
- //UIMng.Ins.GetPanel(PanelType.FightUpPanel).OnEnter();
- }
- }, 1);
- })
- .start();
- } else {
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- this.OnExit();
- if (this.result.result != 1) {
- //UIMng.Ins.GetPanel(PanelType.FightUpPanel).OnEnter();
- }
- }
- AdM.onSendEvent('Qujing_Fight_CommonReward', '取经战斗-普通奖励领取', "qujing");
- } else {
- this.scheduleOnce(() => {
- this.isCanClickBtn = true;
- }, 3);
- this.OnExit();
- if (this.result.result != 1) {
- //UIMng.Ins.GetPanel(PanelType.FightUpPanel).OnEnter();
- }
- }
- GameM.audioM.playEffect(AUDIO_TYPE.button);
- }
- }
|