0863d0cc-7025-4417-8bd5-af874c53b873.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. "use strict";
  2. cc._RF.push(module, '0863dDMcCVEF4vVr4dMU7hz', 'LoadScene');
  3. // Script/LoadScene.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 SDK_1 = require("./sdk/SDK");
  26. var App_1 = require("./Manager/App");
  27. var hallModel_1 = require("./model/hallModel");
  28. var NotifyModel_1 = require("./model/NotifyModel");
  29. var TimeControl_1 = require("./TimeControl");
  30. var EncryptUtil_1 = require("./sdk/tools/EncryptUtil");
  31. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  32. var loadScene = /** @class */ (function (_super) {
  33. __extends(loadScene, _super);
  34. function loadScene() {
  35. var _this = _super !== null && _super.apply(this, arguments) || this;
  36. _this.percentLabel = null;
  37. _this.loadingBar = null;
  38. _this.loadSceneName = "hallScene";
  39. return _this;
  40. // update (dt) {}
  41. }
  42. // LIFE-CYCLE CALLBACKS:
  43. loadScene.prototype.onLoad = function () {
  44. App_1.App.Facade.init(false, cc.size(720, 1280), false, true);
  45. App_1.App.startUp();
  46. App_1.App.DataManager.init();
  47. TimeControl_1.default.instance.OfflineTime();
  48. this.initModel();
  49. var gameId = "richestMan";
  50. SDK_1.default.Instance.init(gameId, EncryptUtil_1.EncryptType.ED_CM);
  51. this.LoadOther();
  52. };
  53. loadScene.prototype.initModel = function () {
  54. App_1.App.Facade.registerModel(hallModel_1.default);
  55. App_1.App.Facade.registerModel(NotifyModel_1.default);
  56. };
  57. loadScene.prototype.LoadOther = function () {
  58. // this.loadConfigs(() => { App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) });
  59. // App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) ;
  60. this.loadScene();
  61. };
  62. // private loadConfig() {
  63. // App.ConfigMgr.loadConfigs(this.loadScene.bind(this));
  64. // }
  65. loadScene.prototype.loadScene = function () {
  66. App_1.App.Facade.runBundleScene(this.loadSceneName, this.loadSceneName, this.loadHallProgress.bind(this));
  67. };
  68. /** 导入配置文件 */
  69. loadScene.prototype.loadConfigs = function (cb) {
  70. console.log("读取配置文件");
  71. var url = "configs";
  72. var self = this;
  73. cc.loader.loadResDir(url, cc.Asset, function (err, res) {
  74. App_1.App.DataManager.Configs = res;
  75. App_1.App.DataManager.LevelCount = res.length;
  76. res.sort(function (a, b) { return Number(a._name) - Number(b._name); });
  77. console.log("配置文件解析完成", res);
  78. cb();
  79. });
  80. };
  81. /**加载大厅界面进度*/
  82. loadScene.prototype.loadHallProgress = function (completedCount, totalCount, item) {
  83. var progress = completedCount / totalCount;
  84. this.setProgress(Math.round(progress * 100));
  85. };
  86. /**加载进度 */
  87. loadScene.prototype.setProgress = function (value) {
  88. this.loadingBar.progress = value / 100;
  89. this.percentLabel.getComponent(cc.Label).string = value + "%";
  90. };
  91. __decorate([
  92. property(cc.Label)
  93. ], loadScene.prototype, "percentLabel", void 0);
  94. __decorate([
  95. property(cc.ProgressBar)
  96. ], loadScene.prototype, "loadingBar", void 0);
  97. loadScene = __decorate([
  98. ccclass
  99. ], loadScene);
  100. return loadScene;
  101. }(cc.Component));
  102. exports.default = loadScene;
  103. cc._RF.pop();