2024-11-05 18:15:49 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2024-11-08 18:21:41 +08:00
|
|
|
using System.IO;
|
2024-11-05 18:15:49 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public static class DataManager
|
|
|
|
{
|
|
|
|
public static int Level
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return PlayerPrefs.GetInt("Level");
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
PlayerPrefs.SetInt("Level",value);
|
|
|
|
}
|
|
|
|
}
|
2024-11-08 18:21:41 +08:00
|
|
|
|
|
|
|
public static int chapter
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return PlayerPrefs.GetInt("chapter");
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
PlayerPrefs.SetInt("chapter",value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static bool chapterLock(int id)
|
|
|
|
{
|
|
|
|
return PlayerPrefs.GetInt("chapterUnLock"+id)==1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void chapterLock(int id, bool bo)
|
|
|
|
{
|
|
|
|
PlayerPrefs.SetInt("chapterUnLock"+id,bo?1:0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static Dictionary<int, bool> _directory=new Dictionary<int, bool>();
|
|
|
|
public static bool LevelOpen(int id)
|
|
|
|
{
|
|
|
|
if (_directory.TryGetValue(id, out var open)) return open;
|
|
|
|
var bo = PlayerPrefs.GetInt(id.ToString())==1;
|
|
|
|
|
|
|
|
_directory.Add(id,bo);
|
|
|
|
|
|
|
|
return _directory[id];
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void SetLevelOpen(int id,bool bo)
|
|
|
|
{
|
|
|
|
_directory[id] = bo;
|
|
|
|
|
|
|
|
PlayerPrefs.SetInt(id.ToString(),bo?1:0);
|
|
|
|
}
|
2024-11-05 18:15:49 +08:00
|
|
|
}
|