拼ui 一些业务逻辑x实现
This commit is contained in:
@@ -371,7 +371,10 @@ public class SongData : ScriptableObject
|
||||
isUnlocked = value;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -403,7 +406,7 @@ public class SongData : ScriptableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果不存在存档文件,也标记为已加载,防止重复检查
|
||||
ResetRuntimeProgressStateWithoutSaving();
|
||||
_isPersistentDataLoaded = true;
|
||||
}
|
||||
}
|
||||
@@ -468,7 +471,10 @@ public class SongData : ScriptableObject
|
||||
SavePersistent();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -511,6 +517,48 @@ public class SongData : ScriptableObject
|
||||
Debug.LogWarning($"[SongData] {songName} has been fully reset to zero due to data integrity failure.");
|
||||
}
|
||||
|
||||
private void ResetRuntimeProgressStateWithoutSaving()
|
||||
{
|
||||
if (difficultyNumberMap == null) difficultyNumberMap = new Dictionary<int, int>();
|
||||
else difficultyNumberMap.Clear();
|
||||
|
||||
if (personalRecordMap == null) personalRecordMap = new Dictionary<int, int>();
|
||||
else personalRecordMap.Clear();
|
||||
|
||||
if (idolRecordMap == null) idolRecordMap = new Dictionary<int, int>();
|
||||
else idolRecordMap.Clear();
|
||||
|
||||
if (chartScoreMap == null) chartScoreMap = new Dictionary<int, int>();
|
||||
else chartScoreMap.Clear();
|
||||
|
||||
if (levelProgressMap == null) levelProgressMap = new Dictionary<int, float>();
|
||||
else levelProgressMap.Clear();
|
||||
|
||||
if (chartFiles != null)
|
||||
{
|
||||
for (int i = 0; i < chartFiles.Count; i++)
|
||||
{
|
||||
ChartFileEntry entry = chartFiles[i];
|
||||
if (entry == null) continue;
|
||||
|
||||
entry.lastScoreForThisDifficulty = 0;
|
||||
entry.chartPersonalRecordForThisDifficulty = 0;
|
||||
entry.idolPersonalRecordForThisDifficulty = 0;
|
||||
entry.totalPersonalRecordForThisDifficulty = 0;
|
||||
entry.levelProgressForThisDifficulty = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
game_enterTimes = 0;
|
||||
time_totalPlayingTime = 0f;
|
||||
current_levelProgress = 0f;
|
||||
_if_level_is_EASE = false;
|
||||
max_comboRecord = 0;
|
||||
personalRecord = 0;
|
||||
|
||||
UpdateOverallRecordsFromEntries();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 闈欐€佹牎楠屾柟娉曪紝鍙湪寮傛绾跨▼璋冪敤锛屽垽鏂?JSON 鍐呭鏄惁鍚堟硶銆? /// </summary>
|
||||
public static bool VerifyJsonIntegrity(string json, string salt, out SongDataSerializable result)
|
||||
@@ -623,6 +671,10 @@ public class SongData : ScriptableObject
|
||||
|
||||
SyncEntriesFromMaps();
|
||||
SavePersistent();
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
GlobalAchievementService.EnsureInstance().RefreshOwnedSongCountAndScores();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user