Make migration from old save to new save work

This commit is contained in:
2026-02-11 13:46:12 -07:00
parent 6d616e7b23
commit bc21c68c4c
2 changed files with 17 additions and 34 deletions

View File

@@ -25,6 +25,21 @@ public class BazookaManager : MonoBehaviour
DontDestroyOnLoad(gameObject);
if (!firstLoadDone)
{
try
{
var oldSave = Path.Join(Application.persistentDataPath, OldSavefileEncryption.BAZOOKA_MANAGER_FILE_KEY + ".dat");
var newSave = Path.Join(Application.persistentDataPath, "savefile.json");
if (
File.Exists(oldSave) ||
!File.Exists(newSave)
)
{
File.WriteAllBytes(newSave, Encoding.UTF8.GetBytes(OldSavefileEncryption.DecryptRaw(File.ReadAllBytes(oldSave))));
File.Delete(oldSave);
}
}
catch { }
firstLoadDone = true;
var save = LoadObject("savefile");
var cache = LoadArray("cache");