import SystemBase from "../../extensions/ngame/assets/ngame/system/SystemBase";
import { app } from "./App";
import BaseData from "./data/BaseData";
import ChatData from "./data/ChatData";
import DungeonData from "./data/DungeonData";
import GBattleData from "./data/GBattleData";
import GOnHookData from "./data/GOnHookData";
import GiftData from "./data/GiftData";
import PetEquipData from "./data/PetEquipData";
import PlayerData from "./data/PlayerData";
import PlayerPetData from "./data/PlayerPetData";
import PlayerTacticalData from "./data/PlayerTacticalData";
import ResourceData from "./data/ResourceData";

//数据类 (用于初始化游戏信息)
export class AppData extends SystemBase{

    static loading = "AppData";

    loadings:BaseData[] = [
        PlayerData.getIns(), //玩家信息
        PetEquipData.getIns(),   //宠物装备数据类
        GiftData.getIns(), //玩家礼包信息
        PlayerPetData.getIns(), //玩家宠物信息
        ChatData.getIns(), //聊天
        PlayerTacticalData.getIns(), //阵法
        ResourceData.getIns(), //玩家资源
        GOnHookData.getIns(),   //无限模式信息类 (无限模式是游戏基础模式玩法 需要默认信息)
        DungeonData.getIns(),   //副本数据类
        GBattleData.getIns(),   //战斗数据(永远最后)
    ];
    
    async onInit(): Promise<any> {
        
        app.loading.setCurrent(AppData.loading);

        //初始化所有数据类
        for (let index = 0; index < this.loadings.length; index++) {
            const data = this.loadings[index];
            await data.onInit();
        }

        app.loading.ok(AppData.loading);

    }

}

