加入用户最近100场战绩记录并实现展示
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
public class SongDataManager : MonoBehaviour
|
||||
{
|
||||
private const string SecureCategory = "song_export";
|
||||
private string jsonDirectory;
|
||||
|
||||
[Header("Settings")]
|
||||
@@ -12,12 +13,6 @@ public class SongDataManager : MonoBehaviour
|
||||
{
|
||||
jsonDirectory = Path.Combine(Application.persistentDataPath, "song_json_export");
|
||||
|
||||
if (!Directory.Exists(jsonDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(jsonDirectory);
|
||||
Debug.Log("Created song JSON directory: " + jsonDirectory);
|
||||
}
|
||||
|
||||
if (autoSaveOnStart)
|
||||
{
|
||||
StartCoroutine(SaveAllSongDataToJsonRoutine());
|
||||
@@ -39,7 +34,7 @@ public class SongDataManager : MonoBehaviour
|
||||
yield break;
|
||||
}
|
||||
|
||||
Debug.Log($"Start exporting {allSongData.Length} songs to JSON...");
|
||||
Debug.Log($"Start exporting {allSongData.Length} songs to secure vault...");
|
||||
|
||||
for (int i = 0; i < allSongData.Length; i++)
|
||||
{
|
||||
@@ -47,14 +42,13 @@ public class SongDataManager : MonoBehaviour
|
||||
if (song == null) continue;
|
||||
|
||||
SongDataSerializable jsonData = new SongDataSerializable(song);
|
||||
string json = JsonUtility.ToJson(jsonData, true);
|
||||
|
||||
string filePath = Path.Combine(jsonDirectory, song.songID + ".json");
|
||||
File.WriteAllText(filePath, json);
|
||||
string json = JsonUtility.ToJson(jsonData, false);
|
||||
string legacyPath = Path.Combine(jsonDirectory, song.songID + ".json");
|
||||
SecureSaveVault.SaveRawJson(SecureCategory, song.songID.ToString(), json, legacyPath);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
Debug.Log("All song JSON files exported.");
|
||||
|
||||
Debug.Log("All song JSON files exported to secure vault.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user