

//格子持久化数据结构
export interface DataBlock {
    index: number,
    show: number,
    score: number
    notes: Array<number>,
}

//撤回数据结构
export interface DataUndo {
    index: number,
    show: number,
    notes?: Array<number>,
}

//关卡数据
export interface DataStage {
    id: string,//关卡ID dc关卡格式为：年-月-日
    type: number,
    name: string,
    difficulty: string,
    index: number,
    mistake?: number,
    score?: number,
    duration?: number,
    last_hit_time?: number,//上一次填对计时
    note_open?: boolean,
    hint?: number,
    select_index?: number,
    blocks?: Array<DataBlock>,
    undos?: Array<DataUndo>,
}
export function createDataStage(id: string, type: number, name: string, difficulty: string, index: number): DataStage {
    var data: DataStage = {id: id, type: type, name: name, difficulty: difficulty, index: index}
    data.mistake = 0
    data.score = 0
    data.duration = 0
    data.last_hit_time = 0
    data.note_open = false
    data.hint = 2
    data.select_index = 0
    data.blocks = new Array()
    data.undos = new Array()
    return data
}


export interface StageProgress {//关卡完成进度
    stageID: string,//关卡ID dc关卡格式为：年-月-日
    progress: number,
}
export interface TrophyRecord {
    year: number,
    month: number,
    day: number,
    isNew: boolean,
    read: boolean,
}
export interface DataProgress {//关卡难度进度
    difficulty: string,
    index: number,
}
export interface DataUser {
    dones: Array<StageProgress>,//关卡完成进度
    trophy_records: Array<TrophyRecord>,//奖杯获得记录
    progresses: Array<DataProgress>,//主线各个难度进度
}
