import BuglySDK from "../sdk/BuglySDK";
import FileUtil from "../utils/FileUtil";
import TimeUtil from "../utils/TimeUtil";
import AudioSystem from "./AudioSystem";
import DataSystem from "./DataSystem";
import HttpSystem from "./HttpSystem";
import LoadResUtil from "../utils/LoadResUtil";
import LogUtil from "../utils/LogUtil";
import { EncryptUtil } from "../utils/EncryptUtil";
import GameUtil from "../utils/GameUtil";
import UISystem from "./UISystem";
import StorageUtil from "../utils/StorageUtil";
import TimerSystem from "./TimerSystem";
import EventSystem from "./EventSystem";
import MathUtil from "../utils/MathUtil";

/**
 * @description mk系统
 * @author 邹勇，冯聪，薛鸿潇，kaka
 */
class MKSystem {
    constructor() {
        this.init();
    }

    /** 工具 */
    time: TimeUtil;
    file: FileUtil;
    encrypt: EncryptUtil;
    console: LogUtil;
    game: GameUtil;
    loader: LoadResUtil;
    storage: StorageUtil;
    math: MathUtil;

    /** SDK */
    bugly: BuglySDK;


    /** 系统管理 */
    data: DataSystem;
    http: HttpSystem;
    audio: AudioSystem;
    /** 挂载在MainScene的界面上，不需要new */
    ui: UISystem;
    timer: TimerSystem;
    event: EventSystem;

    init() {
        //工具
        this.time = new TimeUtil();
        this.file = new FileUtil();
        this.encrypt = new EncryptUtil();
        this.console = new LogUtil();
        this.game = new GameUtil();
        this.loader = new LoadResUtil();
        this.storage = new StorageUtil();
        this.math = new MathUtil();

        //sdk
        this.bugly = new BuglySDK();

        //system
        this.data = new DataSystem();
        this.http = new HttpSystem();
        this.audio = new AudioSystem();

        this.timer = new TimerSystem();
        this.event = new EventSystem();

    }
}

declare global {
    const mk: MKSystem;
}
window['mk'] = new MKSystem();

