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;//状态
        this._cat = {};
        this._tryagain = {};
    }
    init() {
        console.log(`init`);
    }
    parseData(data) {
        this._list = [];
        this._stage = 0;//关卡
        this._state = 0;//状态
        this._cat = {};
        this._tryagain = {};
        console.log(data);
        this._cat = data.contentObj.picArr.cat;
        this._tryagain = data.contentObj.picArr.tryagain;
        let arr = data.contentObj.picArr.list;
        for (let i = 0; i < arr.length; i++) {
            let ar = arr[i];
            let obj = {};
            obj.word = ar.titleObj;
            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);//原始数据转为数组
    }
    get cat() {
        return this._cat;
    }
    get tryagain() {
        return this._tryagain;
    }
    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;