"use strict"; cc._RF.push(module, '85fc2T3ty9J/6atKLIZyKD5', 'FailPanel'); // Script/view/failPanel/FailPanel.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var BaseView_1 = require("../../../lightMVC/core/base/BaseView"); var SDK_1 = require("../../sdk/SDK"); var gameScene_1 = require("../../gameScene"); var App_1 = require("../../Manager/App"); var SoundManager_1 = require("../../Manager/SoundManager"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var FailPanel = /** @class */ (function (_super) { __extends(FailPanel, _super); function FailPanel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.passTime = 0; return _this; } FailPanel.prototype.drawView = function () { SDK_1.default.Instance.showInterstitial(); this.onLoadAll(); this.btnReplay(); this.BackMain(); this.btnVideo(); }; FailPanel.prototype.onLoadAll = function () { this.ui.getNode("labelCoin").getComponent(cc.Label).string = App_1.App.DataManager.UserCoin + ""; this.ui.getNode("labelDiamond").getComponent(cc.Label).string = App_1.App.DataManager.UserDiamond + ""; this.ui.getNode("labelAwardCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin + ""; this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 3 + ""; App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin; App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin); }; /** * 点击回到主页 */ FailPanel.prototype.BackMain = function () { var backMainBtn = this.ui.getNode("main"); backMainBtn.on(cc.Node.EventType.TOUCH_END, function () { gameScene_1.default.instance.ClickBackMain(); }, this); }; FailPanel.prototype.btnReplay = function () { var _this = this; var backMainBtn = this.ui.getNode("restart"); backMainBtn.on(cc.Node.EventType.TOUCH_END, function () { gameScene_1.default.instance.LoadLevel(); _this.closeView(); }, this); }; /** * 点击游戏重新开始 */ FailPanel.prototype.btnVideo = function () { var _this = this; console.log('抽奖-观看视频~'); var btnVideo = this.ui.getNode("btnVideo"); btnVideo.active = true; btnVideo.on(cc.Node.EventType.TOUCH_END, function () { SoundManager_1.SoundManager.getInstance().VideoStartStop(); if (2 > 1) { if (_this.ui.getNode("jiantou").angle >= 42) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 2; } else if (_this.ui.getNode("jiantou").angle >= -34 && _this.ui.getNode("jiantou").angle < 42) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 3; } else if (_this.ui.getNode("jiantou").angle >= -69 && _this.ui.getNode("jiantou").angle < -34) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 4; } else if (_this.ui.getNode("jiantou").angle < -69) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 5; } App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin); SoundManager_1.SoundManager.getInstance().VideoEndOpen(); gameScene_1.default.instance.replay(); return; } SDK_1.default.Instance.showRewardVideo(function () { console.log('111'); if (_this.ui.getNode("jiantou").angle >= 42) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 2; } else if (_this.ui.getNode("jiantou").angle >= -34 && _this.ui.getNode("jiantou").angle < 42) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 3; } else if (_this.ui.getNode("jiantou").angle >= -69 && _this.ui.getNode("jiantou").angle < -34) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 4; } else if (_this.ui.getNode("jiantou").angle < -69) { App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 5; } App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin); SoundManager_1.SoundManager.getInstance().VideoEndOpen(); gameScene_1.default.instance.replay(); }, function () { console.log('222'); SoundManager_1.SoundManager.getInstance().VideoEndOpen(); }, function () { console.log('333'); SoundManager_1.SoundManager.getInstance().VideoEndOpen(); }); }, this); }; FailPanel.path = function () { return "gameScene/prefabs/FailPanel"; }; FailPanel.prototype.update = function (dt) { this.passTime += dt; if (this.passTime > 0.1) { this.passTime -= 0.1; if (this.ui.getNode("jiantou").angle >= 42) { this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 2 + ""; } else if (this.ui.getNode("jiantou").angle >= -34 && this.ui.getNode("jiantou").angle < 42) { this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 3 + ""; } else if (this.ui.getNode("jiantou").angle >= -69 && this.ui.getNode("jiantou").angle < -34) { this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 4 + ""; } else if (this.ui.getNode("jiantou").angle < -69) { this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 5 + ""; } } }; FailPanel = __decorate([ ccclass ], FailPanel); return FailPanel; }(BaseView_1.BaseView)); exports.default = FailPanel; cc._RF.pop();