64 lines
2.9 KiB
JavaScript
64 lines
2.9 KiB
JavaScript
|
"use strict";
|
|||
|
cc._RF.push(module, 'bb980aY9HpA1KtpCphriQ/r', 'load');
|
|||
|
// scripts/load.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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
|
|||
|
var LoadingScene = /** @class */ (function (_super) {
|
|||
|
__extends(LoadingScene, _super);
|
|||
|
function LoadingScene() {
|
|||
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|||
|
_this.progressBar = null; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
_this.progressLabel = null; // <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>
|
|||
|
return _this;
|
|||
|
}
|
|||
|
LoadingScene.prototype.onLoad = function () {
|
|||
|
var _this = this;
|
|||
|
setTimeout(function () {
|
|||
|
cc.director.preloadScene("StartUI", _this.updateProgress.bind(_this), _this.switchScene.bind(_this));
|
|||
|
cc.director.preloadScene("game", _this.updateProgress.bind(_this), _this.onLoadComplete.bind(_this));
|
|||
|
}, 2000);
|
|||
|
};
|
|||
|
LoadingScene.prototype.updateProgress = function (completedCount, totalCount, item) {
|
|||
|
var progress = completedCount / totalCount;
|
|||
|
this.progressBar.progress = progress;
|
|||
|
this.progressLabel.string = Math.floor(progress * 100) + "%";
|
|||
|
};
|
|||
|
LoadingScene.prototype.switchScene = function () {
|
|||
|
cc.director.loadScene("StartUI");
|
|||
|
};
|
|||
|
LoadingScene.prototype.onLoadComplete = function () { };
|
|||
|
__decorate([
|
|||
|
property(cc.ProgressBar)
|
|||
|
], LoadingScene.prototype, "progressBar", void 0);
|
|||
|
__decorate([
|
|||
|
property(cc.Label)
|
|||
|
], LoadingScene.prototype, "progressLabel", void 0);
|
|||
|
LoadingScene = __decorate([
|
|||
|
ccclass
|
|||
|
], LoadingScene);
|
|||
|
return LoadingScene;
|
|||
|
}(cc.Component));
|
|||
|
exports.default = LoadingScene;
|
|||
|
|
|||
|
cc._RF.pop();
|