public static void SaveBeatmapData(List <BeatmapData> beatmaps) { string jsonPath = string.Format("{0}/{1}", Application.streamingAssetsPath, "MapData.txt"); beatmaps.Sort((x, y) => x.folderName.CompareTo(y.folderName)); BeatmapDataWrapper bmWrapper = new BeatmapDataWrapper(beatmaps); //Create a Temp Wrapper so it can be stored as Json string json = JsonUtility.ToJson(bmWrapper, true); File.WriteAllText(jsonPath, json); }
public static List <BeatmapData> LoadBeatmapData() { string jsonPath = string.Format("{0}/{1}", Application.streamingAssetsPath, "MapData.txt"); if (File.Exists(jsonPath)) { string json = File.ReadAllText(jsonPath); BeatmapDataWrapper bmWrapper = JsonUtility.FromJson <BeatmapDataWrapper>(json); foreach (BeatmapData bmd in bmWrapper.beatmaps) { bmd.LoadAssets(); } bmWrapper.beatmaps.RemoveAll(item => item.RemoveFromJson()); return(bmWrapper.beatmaps); } else { return(new List <BeatmapData>()); } }