32 lines
793 B
TypeScript
32 lines
793 B
TypeScript
import Config from "./Config";
|
|
import Model from "./Model";
|
|
import Core from "./Core";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class Loading extends cc.Component {
|
|
|
|
@property(cc.Label)
|
|
label: cc.Label = null;
|
|
|
|
@property(cc.Node)
|
|
progress: cc.Node = null;
|
|
|
|
onLoad() {
|
|
var urls = ['resources/textures/menu/menu.png'];
|
|
cc.loader.loadResDir('textures', this.onProgress.bind(this), this.onComplete.bind(this));
|
|
}
|
|
onProgress(loaded, total) {
|
|
this.label.getComponent(cc.Label).string = Math.ceil(loaded / total * 100) + '%';
|
|
this.progress.getComponent(cc.ProgressBar).progress = loaded / total;
|
|
}
|
|
onComplete(e) {
|
|
|
|
Config.init()
|
|
Core.init()
|
|
Model.loadData()
|
|
cc.director.loadScene('menu')
|
|
}
|
|
}
|