85fc24f7-b72f-49ff-a6ad-28b219c8a0f9.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. "use strict";
  2. cc._RF.push(module, '85fc2T3ty9J/6atKLIZyKD5', 'FailPanel');
  3. // Script/view/failPanel/FailPanel.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. 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;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var BaseView_1 = require("../../../lightMVC/core/base/BaseView");
  26. var SDK_1 = require("../../sdk/SDK");
  27. var gameScene_1 = require("../../gameScene");
  28. var App_1 = require("../../Manager/App");
  29. var SoundManager_1 = require("../../Manager/SoundManager");
  30. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  31. var FailPanel = /** @class */ (function (_super) {
  32. __extends(FailPanel, _super);
  33. function FailPanel() {
  34. var _this = _super !== null && _super.apply(this, arguments) || this;
  35. _this.passTime = 0;
  36. return _this;
  37. }
  38. FailPanel.prototype.drawView = function () {
  39. SDK_1.default.Instance.showInterstitial();
  40. this.onLoadAll();
  41. this.btnReplay();
  42. this.BackMain();
  43. this.btnVideo();
  44. };
  45. FailPanel.prototype.onLoadAll = function () {
  46. this.ui.getNode("labelCoin").getComponent(cc.Label).string = App_1.App.DataManager.UserCoin + "";
  47. this.ui.getNode("labelDiamond").getComponent(cc.Label).string = App_1.App.DataManager.UserDiamond + "";
  48. this.ui.getNode("labelAwardCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin + "";
  49. this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 3 + "";
  50. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin;
  51. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin);
  52. };
  53. /**
  54. * 点击回到主页
  55. */
  56. FailPanel.prototype.BackMain = function () {
  57. var backMainBtn = this.ui.getNode("main");
  58. backMainBtn.on(cc.Node.EventType.TOUCH_END, function () {
  59. gameScene_1.default.instance.ClickBackMain();
  60. }, this);
  61. };
  62. FailPanel.prototype.btnReplay = function () {
  63. var _this = this;
  64. var backMainBtn = this.ui.getNode("restart");
  65. backMainBtn.on(cc.Node.EventType.TOUCH_END, function () {
  66. gameScene_1.default.instance.LoadLevel();
  67. _this.closeView();
  68. }, this);
  69. };
  70. /**
  71. * 点击游戏重新开始
  72. */
  73. FailPanel.prototype.btnVideo = function () {
  74. var _this = this;
  75. console.log('抽奖-观看视频~');
  76. var btnVideo = this.ui.getNode("btnVideo");
  77. btnVideo.active = true;
  78. btnVideo.on(cc.Node.EventType.TOUCH_END, function () {
  79. SoundManager_1.SoundManager.getInstance().VideoStartStop();
  80. if (2 > 1) {
  81. if (_this.ui.getNode("jiantou").angle >= 42) {
  82. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 2;
  83. }
  84. else if (_this.ui.getNode("jiantou").angle >= -34 && _this.ui.getNode("jiantou").angle < 42) {
  85. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 3;
  86. }
  87. else if (_this.ui.getNode("jiantou").angle >= -69 && _this.ui.getNode("jiantou").angle < -34) {
  88. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 4;
  89. }
  90. else if (_this.ui.getNode("jiantou").angle < -69) {
  91. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 5;
  92. }
  93. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin);
  94. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  95. gameScene_1.default.instance.replay();
  96. return;
  97. }
  98. SDK_1.default.Instance.showRewardVideo(function () {
  99. console.log('111');
  100. if (_this.ui.getNode("jiantou").angle >= 42) {
  101. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 2;
  102. }
  103. else if (_this.ui.getNode("jiantou").angle >= -34 && _this.ui.getNode("jiantou").angle < 42) {
  104. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 3;
  105. }
  106. else if (_this.ui.getNode("jiantou").angle >= -69 && _this.ui.getNode("jiantou").angle < -34) {
  107. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 4;
  108. }
  109. else if (_this.ui.getNode("jiantou").angle < -69) {
  110. App_1.App.DataManager.UserCoin += gameScene_1.default.instance.curLevelWinCoin * 5;
  111. }
  112. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin);
  113. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  114. gameScene_1.default.instance.replay();
  115. }, function () {
  116. console.log('222');
  117. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  118. }, function () {
  119. console.log('333');
  120. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  121. });
  122. }, this);
  123. };
  124. FailPanel.path = function () {
  125. return "gameScene/prefabs/FailPanel";
  126. };
  127. FailPanel.prototype.update = function (dt) {
  128. this.passTime += dt;
  129. if (this.passTime > 0.1) {
  130. this.passTime -= 0.1;
  131. if (this.ui.getNode("jiantou").angle >= 42) {
  132. this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 2 + "";
  133. }
  134. else if (this.ui.getNode("jiantou").angle >= -34 && this.ui.getNode("jiantou").angle < 42) {
  135. this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 3 + "";
  136. }
  137. else if (this.ui.getNode("jiantou").angle >= -69 && this.ui.getNode("jiantou").angle < -34) {
  138. this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 4 + "";
  139. }
  140. else if (this.ui.getNode("jiantou").angle < -69) {
  141. this.ui.getNode("labelVideoCoin").getComponent(cc.Label).string = gameScene_1.default.instance.curLevelWinCoin * 5 + "";
  142. }
  143. }
  144. };
  145. FailPanel = __decorate([
  146. ccclass
  147. ], FailPanel);
  148. return FailPanel;
  149. }(BaseView_1.BaseView));
  150. exports.default = FailPanel;
  151. cc._RF.pop();