
import { _decorator, Component, director} from 'cc';
import Utils from '../../../core/utils/Utils';
import PoolMgr from '../../../core/manager/PoolMgr';
import Data from '../../../core/manager/Data';
import BusyLoadingManager from '../../../core/manager/BusyLoadingManager';
import audioManager from 'db://assets/manager/audioManager';
import { localConfig } from 'db://assets/manager/localConfig';
import platformSystem from 'db://assets/platform/platformSystem';
import settingData from 'db://assets/data/settingData';
import { utils } from 'db://assets/data/utils';
const { ccclass, property } = _decorator;

@ccclass('Loading')
export class Loading extends Component {
    async start() {
        //加载音效
        await audioManager.initialize();
        //设置
        settingData.loadFromCache();
        //初始化平台接口
        platformSystem.initialize();
        //加载CSV相关配置
        localConfig.instance.loadConfig(() => {
            this.subpackagecomplete();
        })
    }

    async subpackagecomplete() {
        Data.loadData();
        await Utils.loadBundler("item_bundle");
        await Utils.loadBundler("prefabs");
        await Utils.loadBundler("spine");
        await PoolMgr.Instance().loadPrefabs();
        BusyLoadingManager.ins;
        director.loadScene("main")
    }
}

