客户端rsa,冗余清理,bug修复,安卓build问题
This commit is contained in:
@@ -11,6 +11,7 @@ public static class PlayerEconomyStorage
|
||||
private const string MainFileName = ".eco.dat";
|
||||
private const string BackupFileName = ".eco.bak";
|
||||
private const string TempFileName = ".eco.tmp";
|
||||
private const string RecoverySlotKey = "player_economy_storage";
|
||||
|
||||
private static string VaultDirectoryPath
|
||||
{
|
||||
@@ -53,9 +54,23 @@ public static class PlayerEconomyStorage
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LocalRecoveryMirror.TryLoadJson(RecoverySlotKey, out payload) && payload != null)
|
||||
{
|
||||
TrySave(payload);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool HasAnyRecoverableState()
|
||||
{
|
||||
return HasAnyVaultFile(MainFileName)
|
||||
|| HasAnyVaultFile(BackupFileName)
|
||||
|| PlayerProgressBackupService.HasEconomyBackup()
|
||||
|| LocalRecoveryMirror.HasSlotData(RecoverySlotKey);
|
||||
}
|
||||
|
||||
public static bool TrySave(PlayerEconomyPayload payload)
|
||||
{
|
||||
try
|
||||
@@ -77,6 +92,7 @@ public static class PlayerEconomyStorage
|
||||
TryHidePath(MainFilePath);
|
||||
File.Delete(TempFilePath);
|
||||
PlayerProgressBackupService.SaveEconomy(payload);
|
||||
LocalRecoveryMirror.SaveJson(RecoverySlotKey, payload);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -170,6 +186,20 @@ public static class PlayerEconomyStorage
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool HasAnyVaultFile(string fileName)
|
||||
{
|
||||
var candidates = SaveIdentityUtility.GetVaultFilePathVariants(fileName);
|
||||
for (int i = 0; i < candidates.Count; i++)
|
||||
{
|
||||
if (File.Exists(candidates[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string BuildEnvelopeJson(PlayerEconomyPayload payload)
|
||||
{
|
||||
payload.lastUpdatedUtcTicks = DateTime.UtcNow.Ticks;
|
||||
|
||||
Reference in New Issue
Block a user