class LocalStorage {
    static instance: LocalStorage = null;
    //保存关卡
    saveLvDt(curLv: number) {
        localStorage.setItem("curLv", JSON.stringify(curLv));
    }
    //获取关卡
    getLvDt(): number {
        const jsonStr = localStorage.getItem("curLv")
        return JSON.parse(jsonStr);
    }
    //保存玩家名字
    savePlayerName(name: string) {
        localStorage.setItem(`PlayerName`, JSON.stringify(name));
    }
    //获取玩家名字
    getPlayerName(): string {
        const jsonStr = localStorage.getItem(`PlayerName`)
        return JSON.parse(jsonStr);
    }
    //金币
    saveGold(num: number) {
        localStorage.setItem(`Gold`, JSON.stringify(num));
    }
    getGold(): number {
        const jsonStr = localStorage.getItem(`Gold`)
        return JSON.parse(jsonStr);
    }
    //钻石
    saveDiamond(num: number) {
        localStorage.setItem(`Diamond`, JSON.stringify(num));
    }
    getDiamond(): number {
        const jsonStr = localStorage.getItem(`Diamond`)
        return JSON.parse(jsonStr);
    }


}
export const localDt: LocalStorage = LocalStorage.instance = new LocalStorage();

