"use strict"; cc._RF.push(module, '0863dDMcCVEF4vVr4dMU7hz', 'LoadScene'); // Script/LoadScene.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 SDK_1 = require("./sdk/SDK"); var App_1 = require("./Manager/App"); var hallModel_1 = require("./model/hallModel"); var NotifyModel_1 = require("./model/NotifyModel"); var TimeControl_1 = require("./TimeControl"); var EncryptUtil_1 = require("./sdk/tools/EncryptUtil"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var loadScene = /** @class */ (function (_super) { __extends(loadScene, _super); function loadScene() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.percentLabel = null; _this.loadingBar = null; _this.loadSceneName = "hallScene"; return _this; // update (dt) {} } // LIFE-CYCLE CALLBACKS: loadScene.prototype.onLoad = function () { App_1.App.Facade.init(false, cc.size(720, 1280), false, true); App_1.App.startUp(); App_1.App.DataManager.init(); TimeControl_1.default.instance.OfflineTime(); this.initModel(); var gameId = "richestMan"; SDK_1.default.Instance.init(gameId, EncryptUtil_1.EncryptType.ED_CM); this.LoadOther(); }; loadScene.prototype.initModel = function () { App_1.App.Facade.registerModel(hallModel_1.default); App_1.App.Facade.registerModel(NotifyModel_1.default); }; loadScene.prototype.LoadOther = function () { // this.loadConfigs(() => { App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) }); // App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) ; this.loadScene(); }; // private loadConfig() { // App.ConfigMgr.loadConfigs(this.loadScene.bind(this)); // } loadScene.prototype.loadScene = function () { App_1.App.Facade.runBundleScene(this.loadSceneName, this.loadSceneName, this.loadHallProgress.bind(this)); }; /** 导入配置文件 */ loadScene.prototype.loadConfigs = function (cb) { console.log("读取配置文件"); var url = "configs"; var self = this; cc.loader.loadResDir(url, cc.Asset, function (err, res) { App_1.App.DataManager.Configs = res; App_1.App.DataManager.LevelCount = res.length; res.sort(function (a, b) { return Number(a._name) - Number(b._name); }); console.log("配置文件解析完成", res); cb(); }); }; /**加载大厅界面进度*/ loadScene.prototype.loadHallProgress = function (completedCount, totalCount, item) { var progress = completedCount / totalCount; this.setProgress(Math.round(progress * 100)); }; /**加载进度 */ loadScene.prototype.setProgress = function (value) { this.loadingBar.progress = value / 100; this.percentLabel.getComponent(cc.Label).string = value + "%"; }; __decorate([ property(cc.Label) ], loadScene.prototype, "percentLabel", void 0); __decorate([ property(cc.ProgressBar) ], loadScene.prototype, "loadingBar", void 0); loadScene = __decorate([ ccclass ], loadScene); return loadScene; }(cc.Component)); exports.default = loadScene; cc._RF.pop();