1255 lines
37 KiB
JavaScript
1255 lines
37 KiB
JavaScript
let Config = require('config');
|
||
let Global = require('global');
|
||
let gameStartState = Global.gameStartState;
|
||
let Res = require('res');
|
||
let Util = require('util');
|
||
let Module_Share = require('Module_Share');
|
||
let openDataUtil = require('openDataUtil');
|
||
let customerUtil = require('customerUtil_m');
|
||
let traderUtil = require('traderUtil');
|
||
let cakeUtil = require('cakeUtil');
|
||
let jcAdPanel = require('jcAdPanel');
|
||
let crazyNode = require('crazyNode');
|
||
|
||
cc.Class({
|
||
extends: cc.Component,
|
||
|
||
properties: {
|
||
lblMaxScore: cc.Label,
|
||
nodeGameContent: cc.Node,
|
||
aniExtra: cc.Animation,
|
||
nodeStrip: cc.Node,
|
||
btnItemArr:
|
||
{
|
||
type: [cc.Button],
|
||
default: []
|
||
},
|
||
nodePanel: cc.Node,
|
||
mainPanel: cc.Node,
|
||
nodeTime: cc.Node,
|
||
nodeRank: cc.Node,
|
||
aniRecord: cc.Node,
|
||
aniRevive: cc.Animation,
|
||
nodeRevive: cc.Node,
|
||
nodeLizi: cc.Node,
|
||
nodeTimeout: cc.Node,
|
||
aniTimeout: cc.Animation,
|
||
nodeFail: cc.Node,
|
||
nodeWarningItem: cc.Node,
|
||
|
||
|
||
circleProgressNode: cc.Node,
|
||
topLevelNode: cc.Node,
|
||
stageResultPreb: cc.Prefab,
|
||
helpSkillNode: cc.Node,
|
||
helpHammerNode: cc.Node,
|
||
helpBreadNode: cc.Node,
|
||
voodooNode: cc.Node,
|
||
battleRank: cc.Node,
|
||
daySignPreb: cc.Prefab,
|
||
bookmarkPreb: cc.Prefab,
|
||
customerPreb: cc.Prefab,
|
||
welfareNds: [cc.Node],
|
||
// 连击进度条
|
||
comboProgress: cc.Node,
|
||
stageTargetNd: cc.Node,
|
||
selfScoreNd: cc.Node,
|
||
nodeUserItem: cc.Node,
|
||
moneyInfoNode: cc.Node,
|
||
screenRecordPanel: require('screenRecord_tt'),
|
||
traderBtnNd: cc.Node,
|
||
traderBtnPreb: cc.Prefab,
|
||
bgs: [cc.SpriteFrame],
|
||
bgImg: cc.Sprite,
|
||
crazyNode: cc.Node,
|
||
crazyComp: crazyNode,
|
||
crazyBg: cc.Node,
|
||
cakeLight: cc.Node,
|
||
noActNode: cc.Node,
|
||
appBoxIcon: cc.Node,
|
||
shopBtn: cc.Node,
|
||
sliderHelpNode: cc.Node,
|
||
nextHelpNode: cc.Node,
|
||
cakeHelpNode: cc.Node,
|
||
beginTipNode: cc.Node,
|
||
traderBtn: cc.Node,
|
||
btnRedpack: cc.Node,
|
||
adPanel: jcAdPanel,
|
||
testBtn: cc.Node,
|
||
},
|
||
|
||
onLoad() {
|
||
this.levelItems = {0: 0, 1: 0};
|
||
this.shareCount = {};
|
||
cc.UIManage.init(this);
|
||
cc.UIManage.logined = true;
|
||
if (Global.isPlayMusic) {
|
||
cc.SoundMgr.setMusicVolume(1);
|
||
} else {
|
||
cc.SoundMgr.setMusicVolume(0);
|
||
}
|
||
this.bgImg.spriteFrame = this.bgs[Util.getRandom(5, 0)];
|
||
|
||
Res.initExtraAni(this.aniExtra);
|
||
Res.initReviveAni(this.aniRevive);
|
||
|
||
this.aniExtra.node.zIndex = Config.aniZIndex;
|
||
this.aniRecord.zIndex = Config.aniZIndex;
|
||
|
||
this.updateItemBtnState();
|
||
|
||
this.aniRevive.on('stop', this.onAniStop, this);
|
||
|
||
this.tex = null;
|
||
this.isRun = false;
|
||
this.nodeTime.active = false;
|
||
this.nodeRevive.active = false;
|
||
this.nodeTimeout.active = false;
|
||
this.nodeFail.active = false;
|
||
this.updateBtnState();
|
||
this.initData();
|
||
this.skillComp = this.circleProgressNode.getComponent('circleProgress');
|
||
this.topLevelComp = this.topLevelNode.getComponent('topLevel');
|
||
// this.voodooNode.active = (cc.jc.channelID === cc.jc.channel.WECHAT);
|
||
cc.jc.bindController(this);
|
||
this.appBoxIcon.active = (cc.jc.channelID === cc.jc.channel.QQ_MINI);
|
||
this.checkAppBox();
|
||
this.panel = this.nodePanel.getComponent('gamePanel');
|
||
this.panel.isMyPanel = true;
|
||
this.curShowPanel = 0;
|
||
this.scheduleOnce(function () {
|
||
this.shopBtn.getComponent(cc.Animation).play();
|
||
}.bind(this), 1);
|
||
this.scheduleOnce(function () {
|
||
this.btnRedpack.getComponent(cc.Animation).play();
|
||
}.bind(this), 2);
|
||
},
|
||
// onPlatShow(res){
|
||
// if (cc.jc.channelID === cc.jc.channel.WECHAT) {
|
||
// bookmarkUtil.onLoginReward();
|
||
// }
|
||
//
|
||
// console.log('onPlatShow', res);
|
||
// },
|
||
updateBtnState() {
|
||
this.btnItemArr[2].node.active = CC_DEBUG;
|
||
this.testBtn.active = CC_DEBUG;
|
||
},
|
||
|
||
|
||
onDestroy() {
|
||
// cc.SoundMgr.stopMusic();
|
||
// this.traderBtnNd.stopAllActions();
|
||
cc.jc.event.remove(cc.jc.event.Events.RECEIVE_WXKF_AWARD, this);
|
||
cc.jc.event.remove(cc.jc.event.Events.GOTO_APP_RESULT, this);
|
||
cc.jc.event.remove(cc.jc.event.Events.BANNER_SHOWED, this);
|
||
},
|
||
initData() {
|
||
this.level = 1;//当前关卡
|
||
this.score = 0;//当前分数
|
||
this.maxScore = Global.lastScore;//最大分数
|
||
this.curGuideIndex = 1;//引导步骤
|
||
this.selectItemIndex = 0;//选中道具
|
||
},
|
||
|
||
start() {
|
||
if (Util.isIphoneX()) {
|
||
let cvs = this.node.getComponent(cc.Canvas);
|
||
cvs.fitHeight = true;
|
||
cvs.fitWidth = true;
|
||
}
|
||
this.startGame();
|
||
this._time = 0;
|
||
this.addShadowNode();
|
||
// if (!this.traderBtn) {
|
||
// this.traderBtn = cc.instantiate(this.traderBtnPreb);
|
||
// this.traderBtn.setScale(0.75);
|
||
// this.traderBtnNd.addChild(this.traderBtn);
|
||
// }
|
||
this.traderBtn.getComponent('traderBtn').init(this);
|
||
this.beginTime = Date.now();
|
||
cc.jc.event.on(cc.jc.event.Events.BANNER_SHOWED, this, function(obj) {
|
||
let time = Date.now() - this.beginTime;
|
||
if (time < 10000 && cc.jc.channelID === cc.jc.channel.TT) {
|
||
cc.jc.ad.hideAD(obj);
|
||
this.bannerHided = true;
|
||
}
|
||
}.bind(this));
|
||
cc.jc.event.on(cc.jc.event.Events.RECEIVE_WXKF_AWARD, this, function(data) {
|
||
/*
|
||
data:{id: itemid, cnt: itemcnt}
|
||
itemid:道具id
|
||
itemcnt:道具count
|
||
*/
|
||
//this.bt_fuli.node.active = customerUtil_m.isBtnActive();
|
||
console.log('receive wxcustomer award', data);
|
||
cc.jc.gamelog.logButtonClick('customerreward', {});
|
||
let id = data.id - 100;
|
||
this.getSpecialItems([{id: id, count: data.cnt}], 'customer');
|
||
this.welfareNds[1].active = customerUtil.isBtnActive();
|
||
}.bind(this));
|
||
// cc.jc.event.on(cc.jc.event.Events.RECEIVE_BOOKMARK_AWARD, this, function(data) {
|
||
// /*
|
||
// data:{id: itemid, cnt: itemcnt}
|
||
// itemid:道具id
|
||
// itemcnt:道具count
|
||
// */
|
||
// //this.bt_bookmark.node.active = bookmarkUtil.isBtnActive();
|
||
// console.log('receive bookmark award', data);
|
||
// let id = data.id - 100;
|
||
// this.getSpecialItems([{id: id, count: data.cnt}]);
|
||
// this.welfareNds[0].active = bookmarkUtil.isBtnActive();
|
||
//
|
||
// }.bind(this));
|
||
// bookmarkUtil.onLoginReward();
|
||
// this.welfareNds[0].active = bookmarkUtil.isBtnActive();
|
||
cc.jc.event.on(cc.jc.event.Events.GOTO_APP_RESULT, this, function(data) {
|
||
console.log('receive app jump event', data);
|
||
if (data.type === 'simjump') {
|
||
this.simJump = false;
|
||
this._time = 0;
|
||
}
|
||
}.bind(this));
|
||
this.welfareNds[1].active = customerUtil.isBtnActive();
|
||
cc.UIManage.showMoneyInfoNode(this.moneyInfoNode, 'game');
|
||
},
|
||
|
||
startGame(reborn) {
|
||
this.isHelp = (!Global.getHelpStatus(6) && !this.slideHelp);
|
||
this.start_game_time = (new Date()).getTime();
|
||
cc.SoundMgr.playMusic(cc.SoundMgr.music);
|
||
if (!reborn) {
|
||
Global.resetLevelData();
|
||
}
|
||
cc.EffectMgr.init(this);
|
||
let self = this;
|
||
this.isRun = true;
|
||
Global.startState = gameStartState.NONE;
|
||
Global.isShowMaxScoreTips = false;
|
||
Util.setTimeSeed(Util.getCurTime());
|
||
|
||
this.topLevelComp.init({level: this.level});
|
||
this.lvlTarget = this.topLevelComp.lvlTarget;
|
||
this.skillComp.init(this, 0);
|
||
this.lblMaxScore.string = this.maxScore;
|
||
this.updateItemBtnState();
|
||
this.panel.level = this.level;
|
||
this.panel.startGame();
|
||
// this.battleRankNd = this.battleRank.getComponent('battleRank');
|
||
// this.battleRankNd.init(this, this.score, this.level);
|
||
this.comboProgressComp = this.comboProgress.getComponent('comboProgress');
|
||
this.comboProgressComp.init(this);
|
||
if (!Global.getHelpStatus(6) && !this.slideHelp) {
|
||
this.onStageTargetClose();
|
||
} else {
|
||
// this.showStageTarget();
|
||
this.showDayGift();
|
||
}
|
||
// if (this.level === 3 && !Global.getHelpStatus(8)){ //第一次进入第三关, 引导点击神秘商人按钮
|
||
// cc.UIManage.showGuide({type: 8, target: this.traderBtnNd, autoShow: true});
|
||
// } else {
|
||
// this.showStageTarget();
|
||
// if (!this.isHelp) {
|
||
// this.showDayGift();
|
||
// }
|
||
// this.traderBtnNd.stopAllActions();
|
||
// this.moveTraderBtn();
|
||
// this.checkShowCakeLight();
|
||
// }
|
||
cc.jc.plat.PTLog && cc.jc.plat.PTLog("level_start", {level: this.level, reborn: reborn})
|
||
},
|
||
|
||
playExtra(act) {
|
||
this.aniExtra.play(act);
|
||
},
|
||
|
||
playRecord() {
|
||
if (this.curShowPanel === 0) {
|
||
cc.EffectMgr.createNewRecordEffect(this.aniRecord);
|
||
}
|
||
},
|
||
|
||
switchShakeItem(bshake) {
|
||
// if (bshake && this.nodeWarningItem) {
|
||
// Util.playSwapAnim(this.nodeWarningItem, 20, 0.15);
|
||
// } else {
|
||
// Util.stopSwapAnim(this.nodeWarningItem);
|
||
// }
|
||
},
|
||
|
||
onAniStop(event, state) {
|
||
if (state.name === 'revive') {
|
||
this.nodeRevive.active = false;
|
||
if (!this.aniRevive || (this.aniRevive && !this.aniRevive.isValid)) {
|
||
return;
|
||
}
|
||
this.aniRevive.node.active = false;
|
||
}
|
||
},
|
||
|
||
showUseItemUI(id) {
|
||
let self = this;
|
||
this.nodeUserItem.active = true;
|
||
this.nodeUserItem.getComponent('nodeUseItem').init(this, {nd: self.nodeGameContent});
|
||
this.nodeUserItem.getComponent('nodeUseItem').showUseItemUI(id);
|
||
// cc.UIManage.showPanel({
|
||
// name: 'userItem', extparam: {nd: self.nodeGameContent}, cb: function (nd, comp) {
|
||
// self.nodeUserItem = nd;
|
||
// comp.showUseItemUI(id);
|
||
// }
|
||
// })
|
||
cc.EffectMgr.hideFingerEffect();
|
||
this.selectItemIndex = id;
|
||
this.panel.useItemIndex = id;
|
||
},
|
||
showItemHelp(source, target, itemIdx) {
|
||
let self = this;
|
||
this.nodeUserItem.active = true;
|
||
this.nodeUserItem.getComponent('nodeUseItem').showGuide(source, target.node, function () {
|
||
console.log('道具引导结束');
|
||
self.selectItemIndex = itemIdx;
|
||
self.panel.useItemIndex = itemIdx;
|
||
Global.addItem(itemIdx, 1, true);
|
||
Global.saveItem();
|
||
target.onTouchEnd();
|
||
self.toggleNoAct(false);
|
||
if (itemIdx === 1) {
|
||
Global.updateHelpStatus(13);
|
||
} else {
|
||
Global.updateHelpStatus(14);
|
||
}
|
||
});
|
||
},
|
||
shareToGet(id) {
|
||
if (cc.jc.channelID === cc.jc.channel.TEST) {
|
||
(this.noItemPanel) && (this.noItemPanel.active = false)
|
||
this.getSpecialItem(id);
|
||
this.showUseItemUI(id);
|
||
return;
|
||
}
|
||
let self = this;
|
||
cc.jc.ADShare('gift', 'aditemreward', (result, errcode, flag, isaderr, isdiff) => {
|
||
if (result) {
|
||
(this.noItemPanel) && (this.noItemPanel.active = false)
|
||
this.getSpecialItem(id);
|
||
this.showUseItemUI(id);
|
||
} else {
|
||
if (errcode === -100) {
|
||
Util.showTips(self.node, Config.share_fail_txt);
|
||
} else {
|
||
if (isaderr) {
|
||
Util.showTips(self.node, Config.ad_fail_txt);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
// 显示没有道具的panel
|
||
showNoItemPanel(id) {
|
||
let self = this;
|
||
cc.UIManage.showPanel({
|
||
name: 'noItem',
|
||
extparam: {
|
||
itemId: id,
|
||
closeFun: function() {
|
||
self.showUseItemUI(id);
|
||
}
|
||
}
|
||
})
|
||
},
|
||
onTouchUseItem(event) {
|
||
|
||
let id = -1;
|
||
for (let i = 0; i < 3; i++) {
|
||
if (event.currentTarget === this.btnItemArr[i].node) {
|
||
id = i;
|
||
break;
|
||
}
|
||
}
|
||
cc.jc.gamelog.logButtonClick('clickitembtn', {}, id);
|
||
if (id < 0) {
|
||
return;
|
||
}
|
||
// if (CC_DEBUG && id === 2) { // 用于测试的时候显示特定的界面
|
||
// // this.showResultPanel(1);
|
||
// this.saveScore(0);
|
||
// // this.showCubeReward()
|
||
// return ;
|
||
// }
|
||
let tempItemCount = this.levelItems[id];
|
||
if (Global.item[id] <= 0 && tempItemCount <= 0) {
|
||
//Util.showTips(this.node, "点击左上宝箱\r\n分享获得道具");
|
||
this.showNoItemPanel(id);
|
||
} else {
|
||
this.showUseItemUI(id);
|
||
}
|
||
|
||
},
|
||
|
||
|
||
onTouchRestart() {
|
||
Global.startState = gameStartState.RESTART;
|
||
Global.isFirstDead = true;
|
||
Global.resetSaveData();
|
||
for (let i = 0; i < this.panel.container.length; i++) {
|
||
for (let j = 0; j < this.panel.container[i].length; j++) {
|
||
this.panel.container[i][j].destroy();
|
||
}
|
||
this.panel.container[i].length = 0;
|
||
}
|
||
this.panel.length = 0;
|
||
cc.jc.gameStart(1)
|
||
cc.director.loadScene('Game');
|
||
},
|
||
exitGame() {
|
||
cc.director.loadScene('Main', (err, scene) => {
|
||
let main = scene.getChildByName('Canvas').getComponent('mainScene');
|
||
main.checkShowInsertAd();
|
||
});
|
||
},
|
||
onTouchExit() {
|
||
Global.resetSaveData();
|
||
let self = this;
|
||
cc.UIManage.showPanel({
|
||
name: 'existConfirm',
|
||
extparam: {
|
||
rightBtnFun: function () {
|
||
cc.director.loadScene('Main', (err, scene) => {
|
||
let main = scene.getChildByName('Canvas').getComponent('mainScene');
|
||
main.checkShowInsertAd();
|
||
});
|
||
},
|
||
mainTxt: '当前还有金币未使用,去商店看看吗?',
|
||
title: '提示',
|
||
},
|
||
cb: function (nd, comp) {
|
||
nd.zIndex = 110;
|
||
}});
|
||
|
||
},
|
||
onTouchPause() {
|
||
let self = this;
|
||
cc.UIManage.showPanel({
|
||
name: 'setting', extparam: this.score, cb: function (nd, comp) {
|
||
comp.updateScore(self.score);
|
||
}
|
||
})
|
||
cc.jc.gamelog.logButtonClick('settingbtn', {}, 'game');
|
||
},
|
||
|
||
|
||
addScore(score) {
|
||
this.score += score;
|
||
// (this.battleRankNd) && (this.battleRankNd.updateSelf(this.score));
|
||
Global.saveData.score = this.score;
|
||
Global.save();
|
||
this.updateLevelInfo();
|
||
//if (this.score > Global.lastScore && Global.isShowMaxScoreTips === false) {
|
||
// this.showMaxScoreTips();
|
||
//}
|
||
},
|
||
|
||
showMaxScoreTips() {
|
||
Global.isShowMaxScoreTips = true;
|
||
this.playRecord();
|
||
},
|
||
|
||
levelUp() {
|
||
this.level++;
|
||
this.topLevelComp.updateLevel(this.level);
|
||
Global.saveData.level = this.level;
|
||
Global.save();
|
||
},
|
||
// 检查是否升级
|
||
checkLevelUp() {
|
||
return this.topLevelComp.checkLevelUp();
|
||
},
|
||
|
||
updateItemBtnState() {
|
||
for (let i = 0; i < 3; i++) {
|
||
let nd = this.btnItemArr[i].node.getChildByName('num');
|
||
if (nd) {
|
||
let spr = nd.getChildByName('spr_add').getComponent(cc.Sprite);
|
||
let lbl = nd.getChildByName('lbl_num').getComponent(cc.Label);
|
||
let tempCount = this.levelItems[i] || 0;
|
||
if (Global.item[i] > 0 || tempCount > 0) {
|
||
spr.spriteFrame = Res.getSpriteFrame('add_bg');
|
||
lbl.node.active = true;
|
||
lbl.string = String(Global.item[i] + tempCount);
|
||
} else {
|
||
lbl.node.active = false;
|
||
spr.spriteFrame = Res.getSpriteFrame('add');
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
gameOver() {
|
||
// cc.SoundMgr.playMusic(cc.SoundMgr.settle);
|
||
for (let i = 0; i < this.panel.container.length; i++) {
|
||
for (let j = 0; j < this.panel.container[i].length; j++) {
|
||
this.panel.container[i][j].destroy();
|
||
}
|
||
this.panel.container[i].length = 0;
|
||
}
|
||
Global.isGaming = false;
|
||
this.isRun = false;
|
||
cc.jc.gameOver(this.score, true, {level: this.level});
|
||
this.saveScore(2);
|
||
Global.resetSaveData();
|
||
},
|
||
|
||
onTouchRank(e, closeFun) {
|
||
cc.UIManage.showPanel({name: 'rank', extparam: Global.lastScore, cb: (nd, comp) => {
|
||
if (closeFun) {
|
||
comp.registerCloseFun(closeFun);
|
||
}
|
||
this.nodeRank = nd;
|
||
cc.jc.gamelog.logButtonClick('gamerankbtn', {});
|
||
switch (cc.jc.channelID) {
|
||
case cc.jc.channel.WECHAT:
|
||
case cc.jc.channel.QQ_MINI:
|
||
openDataUtil.showAllRank();
|
||
comp.setUP();
|
||
break;
|
||
case cc.jc.channel.QQ_PLAY:
|
||
case cc.jc.channel.TT:
|
||
case cc.jc.channel.TEST:
|
||
case cc.jc.channel.ANDROID:
|
||
comp.setUP();
|
||
break;
|
||
}
|
||
}})
|
||
},
|
||
|
||
onTouchRankClose() {
|
||
if (this.tex) {
|
||
this.tex.destroy();
|
||
this.tex = null;
|
||
}
|
||
this.nodeRank.active = false;
|
||
},
|
||
|
||
onTouchNormalShare() {
|
||
Module_Share.ConfigShare(Global.account_id, Module_Share.ShareConfig.Comment, 'overnormal');
|
||
},
|
||
|
||
onTouchItemShare(event, customdata) {
|
||
if (Global.get_item_num_today < Config.share_item_num) {
|
||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||
let startTime = (new Date()).getTime();
|
||
Module_Share.ConfigShare(Global.account_id, Module_Share.ShareConfig.Comment, customdata);
|
||
this.scheduleOnce(() => {
|
||
if (this.shareCount[customdata] === undefined) {
|
||
this.shareCount[customdata] = false;
|
||
}
|
||
if (this.shareCount[customdata] === false && Math.random() * 100 > 40) {
|
||
this.shareCount[customdata] = true;
|
||
try {
|
||
Util.showTips(this.node, '请分享到不同的群');
|
||
} catch (err) {}
|
||
return;
|
||
}
|
||
|
||
let endTime = (new Date()).getTime();
|
||
console.log(endTime - startTime);
|
||
if (endTime - startTime > 3000) {
|
||
try {
|
||
this.getRandomItem();
|
||
} catch (err) {}
|
||
} else {
|
||
try {
|
||
Util.showTips(this.node, '请分享到不同的群');
|
||
} catch (err) {}
|
||
}
|
||
}, 0.5);
|
||
} else {
|
||
Module_Share.ConfigShare(Global.account_id, Module_Share.ShareConfig.Comment, null, this.getRandomItem.bind(this));
|
||
}
|
||
} else {
|
||
Util.showTips(this.node, Config.share_finish_normal_desc);
|
||
}
|
||
},
|
||
saveScore(type) {
|
||
if (cc.sys.platform === cc.sys.WECHAT_GAME && cc.jc.channelID !== cc.jc.channel.TT) {
|
||
openDataUtil.updateOpenScore(this.score);
|
||
}
|
||
this.showOverRank();
|
||
let self = this;
|
||
if (type === 1) { //上报关卡结束数据
|
||
cc.jc.gamelog.logButtonClick('stageover',{}, this.level);
|
||
cc.jc.plat.PTLog && cc.jc.plat.PTLog("level_win", {level: this.level})
|
||
}
|
||
if (type === 2) {
|
||
self.showFailPanel();
|
||
cc.jc.plat.PTLog && cc.jc.plat.PTLog("level_fail", {level: this.level})
|
||
} else {
|
||
// self.showResultPanel(type || 0);
|
||
self.showStageOverPanel(type || 0);
|
||
}
|
||
Global.saveScore(this.score);
|
||
},
|
||
// 显示好友挑战宝箱
|
||
showChallengeCube(options) {
|
||
let self = this;
|
||
cc.UIManage.showPanel({
|
||
name: 'challengeCube',
|
||
extparam: options,
|
||
cb: function (nd, comp) {
|
||
nd.zIndex = 110;
|
||
}
|
||
})
|
||
},
|
||
showResultPanel(type) {
|
||
cc.UIManage.showPanel({
|
||
name: 'result',
|
||
extparam: {
|
||
type: type || 0,
|
||
levelData: this.topLevelComp.levelData,
|
||
}
|
||
});
|
||
},
|
||
showFailPanel() {
|
||
cc.UIManage.showPanel({
|
||
name: 'fail',
|
||
extparam: {
|
||
type: 0,
|
||
levelData: this.topLevelComp.levelData,
|
||
}
|
||
});
|
||
},
|
||
showStageOverPanel(type) {
|
||
let self = this;
|
||
cc.UIManage.showPanel({
|
||
name: 'over',
|
||
extparam: type ||0,
|
||
cb: function (nd, comp) {
|
||
self._nodeOver = nd;
|
||
comp.showScore({score: self.score, maxScore: self.maxScore, level: self.level});
|
||
if (!Global.reachMaxLevel()){
|
||
let score = type === 1? 6 : 2;
|
||
self.showAchieveGet({}, score);
|
||
}
|
||
if (cc.sys.platform === cc.sys.WECHAT_GAME || cc.jc.channelID === cc.jc.channel.TEST || cc.jc.channelID === cc.jc.channel.ANDROID) {
|
||
if (cc.jc.channelID === cc.jc.channel.TT || cc.jc.channelID === cc.jc.channel.TEST || cc.jc.channelID === cc.jc.channel.ANDROID) {
|
||
cc.jc.rank.updateRank(self.score, function (datas) {
|
||
console.log('[jcrank] update score success', JSON.stringify(datas));
|
||
comp.showRank(datas);
|
||
}, function () {
|
||
console.log('[jcrank] update score error');
|
||
});
|
||
} else {
|
||
cc.jc.rank.updateRank(self.score, function (datas) {
|
||
console.log('[jcrank] update score success');
|
||
}, function () {
|
||
console.log('[jcrank] update score error');
|
||
});
|
||
}
|
||
}
|
||
return nd;
|
||
}
|
||
});
|
||
},
|
||
// 显示关卡完成面板
|
||
stageOver() {
|
||
// cc.SoundMgr.playMusic(cc.SoundMgr.settle);
|
||
cc.SoundMgr.playSound(cc.SoundMgr['levelClear']);
|
||
this.isRun = false;
|
||
this.saveScore(1);
|
||
},
|
||
|
||
showOverRank() {
|
||
|
||
},
|
||
|
||
showBattleRank() {
|
||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||
openDataUtil.showRankBattle();
|
||
}
|
||
},
|
||
|
||
update(dt) {
|
||
if (!cc.jc.isVerify && !this.simJump && !cc.jc.isWatchAd) {
|
||
this.checkTime(dt);
|
||
}
|
||
},
|
||
/**
|
||
* @param {number} id 0: 贪吃娃, 1: 锤子
|
||
* @param {number} count
|
||
* */
|
||
getSpecialItem(id, count) {
|
||
count = count || 1;
|
||
let item = {id, count};
|
||
this.getSpecialItems([item], 'share');
|
||
},
|
||
/*, closeFun*
|
||
* 获取特定的道具
|
||
* @param {[object]} itemArr {id: id, count: data.cnt}
|
||
* id: 道具id 0: 贪吃娃 1: 锤子 50:金币 ,100+: 材料
|
||
* count: 数量
|
||
* */
|
||
getSpecialItems(itemArr, reason, closeFun) {
|
||
reason = reason || '';
|
||
Global.isAddItem = false;
|
||
let title = cc.i18n.t('tips.get_item');
|
||
for (let item of itemArr) {
|
||
if(item.id === 50) {
|
||
item.img = Res.getSpriteFrame('gold');
|
||
Global.archiveData.gold += item.count;
|
||
Global.saveArchiveData();
|
||
cc.jc.event.emit(Global.EVENTS.USER_MONEY_UPDATE, this);
|
||
title = cc.i18n.t('tips.get_gold');
|
||
cc.jc.gamelog.logButtonClick('goldchange', {key: item.count}, reason);
|
||
cc.jc.gamelog.userAdd({gold: Number(item.count)});
|
||
} else if (item.id < 100) {
|
||
item.img = Res.getSpriteFrame(Global.itemImgs[item.id]);
|
||
Global.addItem(item.id, item.count, true);
|
||
Global.saveItem();
|
||
title = cc.i18n.t('tips.get_item');
|
||
cc.jc.gamelog.logProductItem(item.id, item.count, reason, '');
|
||
} else {
|
||
item.img = Res.getSpriteFrame(`1_${item.id}`, true);
|
||
Global.addOneCookie(item.id, item.count);
|
||
Global.saveArchiveData();
|
||
title = cc.i18n.t('tips.get_materials');
|
||
cc.jc.gamelog.logProductItem(item.id, item.count, reason, '');
|
||
}
|
||
}
|
||
|
||
cc.UIManage.showAwardItems(itemArr, title, closeFun);
|
||
this.updateItemBtnState();
|
||
},
|
||
// 获得随机道具
|
||
getRandomItem() {
|
||
let id = Util.getRandom(2, 0);
|
||
let item = {id: id, count: 1};
|
||
this.getSpecialItems([item], 'share');
|
||
},
|
||
|
||
|
||
playNextLevel() {
|
||
console.log('playNextLevel');
|
||
if (this.stageOverNode) {
|
||
this.stageOverNode.active = false;
|
||
}
|
||
this.levelUp();
|
||
cc.director.loadScene('Game', function (err, scene) {
|
||
let game = scene.getChildByName('Canvas').getComponent('gameScene');
|
||
game.score = Global.saveData.score;
|
||
game.level = Global.saveData.level;
|
||
});
|
||
},
|
||
|
||
|
||
showRedpackPanel() {
|
||
|
||
},
|
||
showRedpack() {
|
||
let self = this;
|
||
traderUtil.requestTask()
|
||
.then(result => {
|
||
let id = result.current.id;
|
||
return traderUtil.reqUserList(id)
|
||
})
|
||
.then(userList => {
|
||
cc.UIManage.showPanel({
|
||
name: 'redpack', extparam: {userList: userList}, cb: (nd, comp) => {
|
||
}
|
||
})
|
||
})
|
||
.catch((isErr, errCode, errMsg) => {
|
||
console.log(isErr, errCode, errMsg);
|
||
})
|
||
cc.jc.gamelog.logButtonClick('redpackbtn', {}, 'game');
|
||
},
|
||
|
||
// 重新开始
|
||
onTouchRevive(cb) {
|
||
let self = this;
|
||
let revieCb = function () {
|
||
Global.isFirstDead = false;
|
||
Global.startState = gameStartState.REVIVE;
|
||
(self._nodeOver) && (self._nodeOver.active = false);
|
||
self.startGame(true);
|
||
self.nodeRevive.active = true;
|
||
self.aniRevive.node.active = true;
|
||
self.aniRevive.play('revive');
|
||
cb && cb();
|
||
}
|
||
if (cc.sys.platform === cc.sys.WECHAT_GAME || (cc.sys.isNative && cc.sys.os === cc.sys.OS_ANDROID)) {
|
||
cc.jc.ADShare('revive', '', function (result, errcode, flag, isaderr, isdiff) {
|
||
if (result) {
|
||
revieCb();
|
||
} else {
|
||
if (errcode === -100) {
|
||
Util.showTips(self.node, Config.share_fail_txt);
|
||
} else {
|
||
if (isaderr) {
|
||
Util.showTips(self.node, Config.ad_fail_txt);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
} else {
|
||
revieCb();
|
||
}
|
||
|
||
|
||
},
|
||
adShareCommon(type, cb, fcb) {
|
||
let self = this;
|
||
cc.jc.ADShare(type, '', function (result, errcode, flag, isaderr, isdiff) {
|
||
if (result) {
|
||
console.log('ad shareCommon success');
|
||
(cb) && cb();
|
||
} else {
|
||
console.log('ad shareCommon error');
|
||
if (fcb) {
|
||
fcb(errcode);
|
||
} else {
|
||
if (errcode === -100) {
|
||
Util.showTips(self.node, Config.share_fail_txt);
|
||
} else {
|
||
if (isaderr) {
|
||
Util.showTips(self.node, Config.ad_fail_txt);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
})
|
||
},
|
||
openRedpack(cb) {
|
||
let self = this;
|
||
cc.jc.ADShare('gift', '', function (result, errcode, flag, isaderr, isdiff) {
|
||
if (result) {
|
||
console.log('redpack share success');
|
||
cb && cb();
|
||
} else {
|
||
console.log('redpack share error');
|
||
if (errcode === -100) {
|
||
Util.showTips(self.node, Config.share_fail_txt);
|
||
} else {
|
||
if (isaderr) {
|
||
Util.showTips(self.node, Config.ad_fail_txt);
|
||
}
|
||
}
|
||
}
|
||
|
||
})
|
||
},
|
||
eliminateAll(cb) {
|
||
this.panel.eliminateAll(true, cb);
|
||
},
|
||
|
||
|
||
showTipLight(node) {
|
||
cc.EffectMgr.createCircleEffect(node);
|
||
},
|
||
removeTipLight() {
|
||
cc.EffectMgr.hideCircleEffect();
|
||
},
|
||
cancelUseItem() {
|
||
this.panel.useItemIndex = -1;
|
||
this.nodeUserItem.active = false;
|
||
cc.EffectMgr.hideFingerEffect();
|
||
},
|
||
// 显示每日签到奖励面板
|
||
openDaySign() {
|
||
this.daySignPanel = cc.instantiate(this.daySignPreb);
|
||
this.node.addChild(this.daySignPanel);
|
||
},
|
||
// 收藏奖励
|
||
showWelfare() {
|
||
this.bookmarkPanel = cc.instantiate(this.bookmarkPreb);
|
||
this.node.addChild(this.bookmarkPanel);
|
||
cc.jc.gamelog.logButtonClick('bookmarkbtn', {}, 'game');
|
||
},
|
||
// 显示客服奖励界面
|
||
showWelfare2() {
|
||
this.customerPanel = cc.instantiate(this.customerPreb);
|
||
this.node.addChild(this.customerPanel);
|
||
cc.jc.gamelog.logButtonClick('customerbtn',{},'game');
|
||
},
|
||
addShadowNode() {
|
||
// this.getComponent('BaseLayer').bannerHide();
|
||
let node = new cc.Node();
|
||
// cc.game.addPersistRootNode(node);
|
||
this.node.addChild(node);
|
||
node.zIndex = 150;
|
||
node.setContentSize(cc.winSize);
|
||
node.on(cc.Node.EventType.TOUCH_START, this.shadowTouchMove, this);
|
||
node._touchListener.setSwallowTouches(false);
|
||
},
|
||
shadowTouchMove() {
|
||
this._time = 0;
|
||
if (this.brickShock) {
|
||
this.brickShock = false;
|
||
this.panel.removeBrickShock();
|
||
}
|
||
},
|
||
|
||
checkTime(dt) {
|
||
this._time += dt;
|
||
if (this._time >= Config.sim_jump_seconds && cc.jc.channelID === cc.jc.channel.WECHAT) {
|
||
this.showSimJump();
|
||
//this.shockOneBrick();
|
||
// if (!this.bannerShow) {
|
||
// this.bannerShow = true;
|
||
// this.getComponent('BaseLayer').bannerShow();
|
||
// }
|
||
} else {
|
||
// this.bannerShow = false;
|
||
// this.getComponent('BaseLayer').bannerHide();
|
||
}
|
||
},
|
||
|
||
showSimJump() {
|
||
let cfg = cc.jc.maincfg.info['sim_jump_cfg'];
|
||
if (!this.simJump && cfg){
|
||
try {
|
||
this.simJump = true;
|
||
let objs = JSON.parse(cfg);
|
||
if (objs.length === 0) {
|
||
return;
|
||
}
|
||
let num = 0;
|
||
for (let obj of objs) {
|
||
obj.min = num;
|
||
num += obj.weight;
|
||
obj.max = num;
|
||
}
|
||
let random = Util.getRandom(num, 0);
|
||
let target = objs[0];
|
||
for (let obj of objs) {
|
||
if (random >= obj.min && random < obj.max) {
|
||
target = obj;
|
||
break;
|
||
}
|
||
}
|
||
cc.jc.gamelog.logButtonClick('simjump', {}, target.id);
|
||
cc.jc.plat.PTGotoApp(target.id, '', null, (code, res) => {
|
||
|
||
}, {type: 'simjump'}, null, {type: 'simjump'});
|
||
} catch (err){}
|
||
}
|
||
},
|
||
shockOneBrick() {
|
||
if (!this.brickShock) {
|
||
this.brickShock = true;
|
||
this.panel.shockOneBrick();
|
||
}
|
||
|
||
},
|
||
// 显示每日获取道具
|
||
showDayGift() {
|
||
Global.getDayGiftStatus(function (result) {
|
||
if (!result) {
|
||
cc.UIManage.showPanel({name: 'dayGift', extparam: Global.lastScore, cb: (nd, comp) => {
|
||
|
||
}})
|
||
}
|
||
})
|
||
},
|
||
updateComboProgress(count) {
|
||
if (this.comboProgressComp) {
|
||
return this.comboProgressComp.updateCount(count);
|
||
} else {
|
||
return 1;
|
||
}
|
||
},
|
||
updateSkillProgress(score) {
|
||
// (this.skillComp) && this.skillComp.addScore(score);
|
||
},
|
||
// 进入疯狂模式
|
||
beginCrazyMode() {
|
||
this.panel.crazyMode = true;
|
||
this.panel.baseRate = 2;
|
||
//this.panel.fetchCrazyRows();
|
||
this.showCrazyNode();
|
||
// this.schedule(this.addRandomBrick, 1);
|
||
},
|
||
crazyNodeHide(val) {
|
||
console.log('[gameScene] crazy node hide, val is:', val);
|
||
let self = this;
|
||
if (val >= 1) {
|
||
cc.SoundMgr.playSound(cc.SoundMgr['record']);
|
||
this.eliminateAll(function(){
|
||
self.panel.settle(function(){
|
||
self.endCrazyMode();
|
||
self.panel.checkLevelUp();
|
||
});
|
||
});
|
||
} else {
|
||
self.panel.settle(function(){
|
||
self.endCrazyMode();
|
||
self.panel.checkLevelUp();
|
||
});
|
||
Util.showTips(this.node, '很遗憾, 时间到了.');
|
||
}
|
||
},
|
||
// 结束疯狂模式
|
||
endCrazyMode() {
|
||
this.panel.baseRate = 1;
|
||
this.panel.crazyMode = false;
|
||
(this.skillComp) && this.skillComp.stopCrazyMode();
|
||
// this.unschedule(this.addRandomBrick);
|
||
},
|
||
addRandomBrick() {
|
||
this.panel.addRandomBrick();
|
||
},
|
||
updateLevelInfo() {
|
||
this.topLevelComp.updateScore(this.score);
|
||
},
|
||
shakeSelf() {
|
||
this.mainPanel.getComponent('shake').shake();
|
||
},
|
||
showStageTarget() {
|
||
this.stageTargetNd.active = true;
|
||
this.stageTargetNd.getComponent('stargetTarget').showMe(this, this.level, this.lvlTarget);
|
||
let self = this;
|
||
this.scheduleOnce(function () {
|
||
self.stageTargetNd.active = false;
|
||
}, 1.5)
|
||
},
|
||
// 显示宝箱获取界面
|
||
showCubeReward() {
|
||
cc.UIManage.showPanel({name: 'cubeReward', extparam: {}, cb: (nd, comp) => {
|
||
}})
|
||
},
|
||
/**
|
||
* 显示蛋糕房
|
||
* @param {number} targetCake 如果有该值, 则如果蛋糕id等于targetCode且材料足够的蛋糕会闪光,
|
||
* 否则所有满足制作条件的蛋糕都会闪光
|
||
* */
|
||
showCakeHouse(e, targetCake) {
|
||
if (this.slideHelp && !Global.getHelpStatus(6)) {
|
||
cc.UIManage.hideGuide(6);
|
||
}
|
||
cc.UIManage.showPanel({
|
||
name: 'cakeHouse', extparam: {type: 'house', targetCake: targetCake, isGame: true}, cb: (nd, comp) => {
|
||
}
|
||
})
|
||
cc.jc.gamelog.logButtonClick('cakehousebtn', {}, 'game');
|
||
},
|
||
|
||
moveTraderBtn() {
|
||
let locs = [-294, -85, 294, -208]; // x1, y1, x2, y2
|
||
let targetX = Util.getRandom(locs[2] - locs[0], 0) + locs[0];
|
||
let targetY = -Util.getRandom(-locs[3] , - locs[1]) ;
|
||
let moveEnd = function() {
|
||
this.moveTraderBtn();
|
||
}
|
||
let action = cc.sequence(cc.moveTo(5, cc.v2(targetX, targetY)), cc.callFunc(moveEnd, this));
|
||
this.traderBtnNd.runAction(action);
|
||
},
|
||
// 显示神秘商人
|
||
showTrader() {
|
||
let isGuide = false;
|
||
// if (this.level === 3 && !Global.getHelpStatus(8)){ //第一次进入第三关, 引导点击神秘商人按钮
|
||
// cc.UIManage.hideGuide(8);
|
||
// isGuide = true;
|
||
// }
|
||
cc.UIManage.showPanel({
|
||
name: 'trader', extparam: {isGuide: isGuide}, cb: (nd, comp) => {
|
||
}
|
||
})
|
||
cc.jc.gamelog.logButtonClick('traderbtn', {},'game');
|
||
},
|
||
showCrazyNode() {
|
||
this.crazyNode.active = true;
|
||
this.crazyComp.init(this);
|
||
//this.crazyBg.active = true;
|
||
//this.scheduleOnce(function () {
|
||
// this.crazyNode.active = false;
|
||
//}, 1.5)
|
||
},
|
||
//this.schedule(this.checkDanmu, 60);
|
||
// 显示弹幕
|
||
showBullet(record) {
|
||
let self = this;
|
||
traderUtil.reqUserList(record.id)
|
||
.then(userList => {
|
||
let results = [];
|
||
this.userList = userList;
|
||
for (let user of userList) {
|
||
let rondamNum = Util.getRandom(record.countPreTask + 1, 1);
|
||
let str1 = `抢先获得现金奖励`;
|
||
let str0 = '出售大量蛋糕';
|
||
results.push({
|
||
icon: user.avatar_url,
|
||
texts: [user.nickname, str0, str1],
|
||
self: false
|
||
})
|
||
}
|
||
cc.UIManage.showPanel({name: 'bulletScreen',
|
||
extparam: {records: results,
|
||
repeat: true, hideBg: true,
|
||
maxTime: 20,
|
||
minTime: 5},
|
||
cb: (nd, comp) => {
|
||
nd.zIndex = 103;
|
||
self.danmuComp = comp;
|
||
}})
|
||
})
|
||
.catch(() => {
|
||
console.log('req challenge list error');
|
||
})
|
||
},
|
||
|
||
endShowDanmu() {
|
||
(this.danmuComp) && (this.danmuComp.stopDanmu());
|
||
},
|
||
|
||
checkShowCakeLight() {
|
||
//this.cakeLight.active = false;
|
||
//this.cakeLight.active = cakeUtil.checkAnyCakeCanMake();
|
||
},
|
||
showAchieveGet(e, score) {
|
||
//let item = Config.achieveCfgs[0];
|
||
cc.UIManage.showPanel({
|
||
name: 'achieveGet', extparam: {score: score}, cb: function (nd, comp) {}
|
||
})
|
||
},
|
||
showAchieveList() {
|
||
cc.UIManage.showPanel({
|
||
name: 'achieveList', extparam: {}, cb: function (nd, comp) {}
|
||
})
|
||
},
|
||
// 显示商城
|
||
showShop() {
|
||
cc.UIManage.showPanel({
|
||
name: 'shop', extparam: {}, cb: (nd, comp) => {
|
||
}
|
||
})
|
||
cc.jc.gamelog.logButtonClick('shopbtn', {}, 'game');
|
||
},
|
||
toggleNoAct(isShow){
|
||
this.noActNode.active = isShow;
|
||
},
|
||
checkAppBox() {
|
||
if (cc.jc.channelID === cc.jc.channel.QQ_MINI && cc.gg.basecfg.appbox_id) {
|
||
this.appBoxAd = qq.createAppBox({adUnitId: cc.gg.basecfg.appbox_id});
|
||
this.appBoxAd.onClose = function() {
|
||
cc.jc.gamelog.logButtonClick('appboxclose', {});
|
||
}
|
||
this.appBoxAd.load()
|
||
.then(() => {
|
||
console.log('[appbox] load success');
|
||
})
|
||
.catch(err => {
|
||
console.log('[appbox] load error:', err);
|
||
this.appBoxIcon.active = false;
|
||
})
|
||
}
|
||
},
|
||
showAppBox() {
|
||
if (this.appBoxAd) {
|
||
cc.jc.gamelog.logButtonClick('appboxbtn', {});
|
||
this.appBoxAd.show()
|
||
.then(() => {
|
||
console.log('[appbox] show success');
|
||
})
|
||
.catch(err=> {
|
||
console.log('[appbox] show error:', err);
|
||
})
|
||
}
|
||
},
|
||
onStageTargetClose() {
|
||
if (!Global.getHelpStatus(6) && !this.slideHelp) {
|
||
this.showSlideGuide();
|
||
//cc.UIManage.showGuide({type: 5, target: this.sliderHelpNode, autoShow: true});
|
||
}
|
||
},
|
||
showSlideGuide() {
|
||
this.sliderHelpNode.active = true;
|
||
this.toggleNoAct(true);
|
||
let self = this;
|
||
this.scheduleOnce(function() {
|
||
self.sliderHelpNode.getChildByName('arrow').active = true;
|
||
self.sliderHelpNode.getChildByName('hand').active = true;
|
||
self.sliderHelpNode.getComponent(cc.Animation).play('guide_slide');
|
||
}, 0.5);
|
||
this.scheduleOnce(function() {
|
||
self.guideMoveCookie();
|
||
}, 2);
|
||
},
|
||
guideMoveCookie() {
|
||
let targetRow = this.panel.container[0];
|
||
let cookie = targetRow[targetRow.length - 1];
|
||
let position = cookie.node.position;
|
||
let position2 = cc.v2(position.x + Config.singleSize, position.y);
|
||
let act = cc.moveTo(Config.rise_time, position2);
|
||
cookie.node.runAction(cc.sequence(act, cc.callFunc(function () {
|
||
cookie.canMoveing = true;
|
||
cookie.onTouchEnd();
|
||
})));
|
||
},
|
||
showNextLineHelp() {
|
||
this.sliderHelpNode.active = false;
|
||
this.nextHelpNode.active = true;
|
||
//cc.UIManage.showGuide({type: 5, target: this.nextHelpNode, autoShow: true});
|
||
let self = this;
|
||
this.scheduleOnce(function() {
|
||
self.toggleNoAct(false);
|
||
self.nextHelpNode.active = false;
|
||
//cc.UIManage.hideGuide(6);
|
||
Global.updateHelpStatus(6);
|
||
self.slideHelp = true;
|
||
// self.showBeginTip();
|
||
// self.showStageTarget();
|
||
self.showDayGift();
|
||
}, 2);
|
||
},
|
||
showCakeMakeTip() {
|
||
if (cakeUtil.checkGuideCake()){
|
||
this.cakeHelpNode.active = true;
|
||
cc.UIManage.showGuide({type: 6, target: this.cakeHelpNode, autoShow: true});
|
||
}
|
||
},
|
||
showBeginTip() {
|
||
this.beginTipNode.active = true;
|
||
let self = this;
|
||
this.scheduleOnce(function(){
|
||
self.beginTipNode.active = false;
|
||
}, 2);
|
||
},
|
||
hideGuideMake() {
|
||
this.cakeHelpNode.active = false;
|
||
// 20191029 与唐商量后决定, 不管新手引导时, 点击继续游戏还是去制作, 都把临时材料保存进用户存档
|
||
cakeUtil.saveCookie(false);
|
||
cc.UIManage.hideGuide(6);
|
||
},
|
||
guideToHouse() {
|
||
this.cakeHelpNode.active = false;
|
||
cakeUtil.saveCookie(false);
|
||
cc.UIManage.hideGuide(6);
|
||
this.showCakeHouse();
|
||
},
|
||
guideEnd() {
|
||
Global.startState = gameStartState.RESTART;
|
||
Global.isFirstDead = true;
|
||
Global.resetSaveData();
|
||
Global.saveData.level = this.level;
|
||
for (let i = 0; i < this.panel.container.length; i++) {
|
||
for (let j = 0; j < this.panel.container[i].length; j++) {
|
||
this.panel.container[i][j].destroy();
|
||
}
|
||
this.panel.container[i].length = 0;
|
||
}
|
||
|
||
this.panel.length = 0;
|
||
|
||
cc.director.loadScene('Game', function(err, scene) {
|
||
let game = scene.getChildByName('Canvas').getComponent('gameScene');
|
||
game.level = 3;
|
||
});
|
||
},
|
||
testFun() {
|
||
//this.updateSkillProgress(100);
|
||
//this.beginCrazyMode();
|
||
//this.eliminateAll();
|
||
this.stageOver();
|
||
},
|
||
});
|