c5a1d088-5ff5-404c-98db-68be4e8af173.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. "use strict";
  2. cc._RF.push(module, 'c5a1dCIX/VATJjbaL5OivFz', 'UIGameLoadingPage');
  3. // scripts/UI/UIGameLoadingPage.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 (b.hasOwnProperty(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 UIPage_1 = require("../Framework/UIPage");
  26. var Constant_1 = require("../Framework/Constant");
  27. var CocosZ_1 = require("../Framework/CocosZ");
  28. var GuideLayer_1 = require("./GuideLayer");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. var UIGameLoadingPage = /** @class */ (function (_super) {
  31. __extends(UIGameLoadingPage, _super);
  32. function UIGameLoadingPage() {
  33. var _this = _super.call(this, Constant_1.PageName.UIGameLoadingPage) || this;
  34. _this._startTime = 0;
  35. _this.isValid() && _this.onLoad();
  36. return _this;
  37. }
  38. UIGameLoadingPage.prototype.onOpen = function () {
  39. cc.game.on(Constant_1.default.E_GAME_LOGIC, this._onGameMessageHandler, this);
  40. this._startTime = new Date().getTime();
  41. CocosZ_1.cocosz.scheduleOnce(function () {
  42. CocosZ_1.cocosz.audioMgr.playEffect("fj", true, 1);
  43. }, 0.1);
  44. };
  45. UIGameLoadingPage.prototype.onClose = function () {
  46. cc.game.targetOff(this);
  47. GuideLayer_1.guideLayer.hideFjAni();
  48. GuideLayer_1.guideLayer.node.zIndex = cc.macro.MIN_ZINDEX;
  49. CocosZ_1.cocosz.audioMgr.stopEffect("fj");
  50. };
  51. UIGameLoadingPage.prototype._onGameMessageHandler = function (event) {
  52. switch (event.type) {
  53. case Constant_1.default.E_UPDATE_PROGRESS: {
  54. this._updateProgress(event.data);
  55. break;
  56. }
  57. }
  58. };
  59. UIGameLoadingPage.prototype._updateProgress = function (pro) {
  60. if (pro >= 1) {
  61. var difTime = new Date().getTime() - this._startTime;
  62. if (difTime >= 6000) {
  63. CocosZ_1.cocosz.uiMgr.openPage(Constant_1.PageName.UIGamePage);
  64. }
  65. else {
  66. setTimeout(function () {
  67. CocosZ_1.cocosz.uiMgr.openPage(Constant_1.PageName.UIGamePage);
  68. }, 6000 - difTime);
  69. }
  70. }
  71. };
  72. UIGameLoadingPage = __decorate([
  73. ccclass
  74. ], UIGameLoadingPage);
  75. return UIGameLoadingPage;
  76. }(UIPage_1.default));
  77. exports.default = UIGameLoadingPage;
  78. cc._RF.pop();