cc.Class({ extends: cc.Component, properties: { _UIManage: null, contentNode: { default: null, type: cc.Node, displayName: "主要内容节点" }, toolContainer: { default: null, type: cc.Node, displayName: "游戏工具存放容器" }, liziNode: { default: [], type: cc.ParticleSystem, displayName: "成功粒子效果" } }, onLoad: function () { this.loseNum = 0; this.yesNum = 0; this.mouseAgility = 2; this.isSnipeGunMode = true; this.levelNode = null; this.quanEffect = null; this.isTouch = false; this.isManual = false; this.manualTime = 0; this.mistakeNum = 0; cc.global._gameManage = this; cc.global.clearManage = null; }, start: function () { cc.global.gamewin = false; this.clickfaillnum = 0; cc.PlatformTools.executeVideoRecorder(); cc.PlatformTools.executeShowVIVOInGame(); cc.PlatformTools.executeShowInterstitial(); this.game = cc.global.gameModel; this.duihaoNode = this.toolContainer.getChildByName("duihao"); this.cuochaNode = this.toolContainer.getChildByName("cuocha"); this.handNode = this.toolContainer.getChildByName("hand"); this.creatorLevel(); }, onUpdataOpen: function () { this.open = this.toolContainer.getChildByName("huabi"); GlobData.updateSprite(this.open, "game2/shop/player/b_" + cc.playerData.handeType); }, onMistake: function () {}, creatorLevel: function () { this.onUpdataOpen(); var e = cc.global.level; console.log("当前关卡:" + e); this.contentNode.removeAllChildren(); cc.loader.loadRes("".concat(this.game, "/prefab/level/level_").concat(cc.global.levellist[cc.global.level - 1]), function (e, o) { if (!e && o instanceof cc.Prefab) { var t = cc.instantiate(o); t.parent = this.contentNode; t.position = cc.v2(0, 0); this.levelNode = t; } }.bind(this)); }, oonBtnClickEvent: function (e) { var o = this; cc.global.Source.onPlayBtnEffect("buttonClick"); switch (e.target.name) { case "back": if (cc.global.gamewin) { return; } cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () { cc.global.LoadPreFtabData("".concat(o.game, "/prefab/gameui/").concat(o.game, "_xuanguan"), function () {}.bind(o)); }); break; case "btn_jbts": if (cc.playerData.coin >= 100) { cc.playerData.coin -= 100; cc.global.savePlayerData(); cc.global.LoadPreFtabData("".concat(this.game, "/prefab/gameui/").concat(this.game, "_TiShi"), function () {}.bind(this)); } else { cc.global.LoadPreFtabData("prefab/ui/pushCoins_UI", function () {}.bind(this)); } break; case "btn_ts2": cc.PlatformTools.executeShowAwardVideo(function () { cc.global.LoadPreFtabData("".concat(o.game, "/prefab/gameui/").concat(o.game, "_TiShi"), function () {}.bind(o)); }); break; case "btn_tg2": if (cc.global.gamewin) { return; } cc.PlatformTools.executeShowAwardVideo(function () { if (cc.global.level < cc.global.levellist.length && cc.global.level + 1 > cc.global.levelDate) { cc.global.levelDate += 1; if (cc.global.levelDataScript) { cc.global.levelDataScript.updateData(cc.global.levelDate); } else { console.log("没有找到cc.global.levelDataScript"); } } if (cc.global.level < cc.global.levellist.length) { cc.global.level++; cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () { cc.director.loadScene("GameScense"); }); } else { cc.global.zhiyinNode && cc.global.zhiyinNode.showZhuanchang(function () { cc.director.loadScene("GameMain"); }); } }); } }, successLiZi: function () { cc.global.Source.onPlayGameEffect("winsound"); for (var e = 0; e < this.liziNode.length; e++) { this.liziNode[e].resetSystem(); } }, onDuiHaoEffect: function (e) { var o = this; if (this.duihaoNode) { this.successLiZi(); cc.global.isShowTiaoGuan = true; var t = null; if (15 == cc.global.levelid) { t = cc.v2(200, 100); } else { t = cc.v2(0, 0); e && (t = cc.global.onTransitionPosition(e.parent, this.duihaoNode.parent, e.position.clone())); } this.duihaoNode.position = t; this.duihaoNode.scale = 0; this.duihaoNode.stopAllActions(); cc.tween(this.duihaoNode).to(.1, { scale: 1, easing: "elasticOut" }).delay(2).call(function () { o.duihaoNode.scale = 0; }).start(); cc.global.Source.onPlayGameEffect("chenggong"); } else { console.log("未找到对号节点"); } }, onChaHao: function (e) { var o = this; if (this.cuochaNode) { this.showTostWindow(); var t = cc.v2(0, 0); this.cuochaNode.position = t; this.cuochaNode.scale = 0; this.cuochaNode.stopAllActions(); cc.tween(this.cuochaNode).to(.05, { scale: 1, easing: "elasticOut" }).delay(.4).call(function () { o.cuochaNode.scale = 0; }).start(); cc.global.Source.onPlayGameEffect("mistake"); } else { console.log("未找到错叉节点"); } }, onGameWin: function () { this.scheduleOnce(function () { console.log("弹出成功界面----"); cc.global.LoadPreFtabData("".concat(this.game, "/prefab/gameui/").concat(this.game, "_victory"), function () {}.bind(this)); }.bind(this), .8); }, onGameLose: function () { this.scheduleOnce(function () { console.log("弹出失败界面----"); cc.global.LoadPreFtabData("".concat(this.game, "/prefab/gameui/").concat(this.game, "_lost"), function () {}.bind(this)); }.bind(this), .8); }, showTostWindow: function () { this.clickfaillnum++; console.log("谈提示框"); this.clickfaillnum % 3 == 0 && cc.global.LoadPreFtabData("".concat(this.game, "/prefab/gameui/").concat(this.game, "_getTiShivideo"), function () {}.bind(this)); } });