class GameManager {
    static TYPE_NULL = 0;
    static TYPE_TXT = 1;
    static TYPE_IMG = 2;
    static TYPE_MP3 = 3;

    static instance;
    static getIns() {
        if (!GameManager.instance) GameManager.instance = new GameManager();
        return GameManager.instance;
    }//允许调用
    constructor() {
        this._list = [];
        this._stage = 0;//关卡
        this._state = 0;//状态
    }
    init() {
        console.log(`init`);
    }
    parseData(data) {
        console.log(data);
        let arr = data.contentObj.picArr;
        for (let i = 0; i < arr.length; i++) {
            let ar = arr[i];
            let obj = {};
            obj.word = ar.title;
            obj.sound = ar.wordAudio;
            obj.img = ar.bgImg;
            obj.cartoonSke = ar.imgAni.ske.url;
            obj.cartoonTex = ar.imgAni.tex.url;
            obj.cartoonPng = ar.imgAni.png.url;
            this._list.push(obj);
        }
        console.log(this._list);//原始数据转为数组
    }
    setState(num) {
        this._state = num;
    }
    getState() {
        return this._state;
    }
    getStageData() {
        return this._list[this._stage];
    }
    addStage() {
        this._stage++;
        return this._stage >= this._list.length;
    }
}

export default GameManager;