class Item {
    type;
    txt;
    picUrl;
    audioUrl;
    public page;
    constructor({ type, txt, pic_url, audio_url }, page) {
        this.type = type;
        this.txt = txt;
        this.picUrl = pic_url;
        this.audioUrl = audio_url;
        this.page = page;
    }
}
export default class Game {
    private static ins: Game;
    public static getIns(): Game {
        if (!Game.ins) Game.ins = new Game();
        return Game.ins;
    }
    private data: any;
    private lists: Array<any>
    public score: number;
    constructor() {
        //
        this.start = false;
        this.lists = [];
    }
    get len() {
        return this.lists.length;
    }
    public aniEnter: any;
    public init(data) {
        this.start = false;
        this.lists = [];
        this.data = data;
        this.score = data.score;
        this.aniEnter = data.aniEnter;
        let id = 0;
        for (let i = 0; i < this.data.questions.length; i++) {
            let data = this.data.questions[i];
            data.page = id++;
            this.lists.push(data);
        }
    }
    public start: boolean;
    reset() {
        this.start = true;
        this.lists = [];
        let id = 0;
        // for (let i = 0; i < this.data.length; i++) {
        //     let data = this.data[i];
        //     this.lists.push(new Item(data, i + 1));
        // }
    }
    getDataByPage(page) {
        return this.lists.filter(li => li.page == page)[0]
    }
    get isOver() {
        let times = 0;
        // this.lists.forEach((li) => {
        //     times += li.stem.times;
        // })
        return times == 0;
    }
}

let win: any = window;
win.Game = Game;