12345678910111213141516171819202122232425262728293031 |
- import { _decorator, Component } from 'cc';
- import { resMgr } from '../Frames/ResourcesMgr';
- import { dataMgr } from '../Frames/DataManager';
- import { LoadingUI } from './UI/LoadingUI';
- const { ccclass, property } = _decorator;
- @ccclass('MyApp')
- export class MyApp extends Component {
- protected async start(){
- // await UIMgr.openUI("LoadingUI",UIType.PAGE);
- // const loadingUI = UIMgr.getUI(LoadingUI);
- const loadingUI = this.node.getChildByName("LoadingUI").getComponent(LoadingUI)
- await dataMgr.loadDataDir("Data");
- await resMgr.loadAllRes("Res", (finish, total)=>{
- if(loadingUI){
- loadingUI.updateProgress(finish / total);
- loadingUI.updateWhichRes(1);
- }
- });
- await resMgr.loadAllRes("UI", (finish, total)=>{
- if(loadingUI){
- loadingUI.updateProgress(finish / total);
- loadingUI.updateWhichRes(2);
- }
- });
-
- this.node.getChildByName("LoadingUI").active = false;
- // UIMgr.closeUI("LoadingUI");
- // UIMgr.openUI("Start",UIType.PAGE);
- }
- }
|