feat: add Delete methods to SaveSystem

This commit is contained in:
cuqmbr 2022-07-31 16:36:27 +03:00
parent f433a7c515
commit 4e823ce744
4 changed files with 6789 additions and 1 deletions

6759
Assets/Scenes/Game Scene.unity generated Normal file

File diff suppressed because it is too large Load Diff

7
Assets/Scenes/Game Scene.unity.meta generated Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2cda990e2423bbf4892e6590ba056729
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2cda990e2423bbf4892e6590ba056729
guid: c0bd90e5972fd8ae8b4bf9eeeed56e24
DefaultImporter:
externalObjects: {}
userData:

View File

@ -105,6 +105,28 @@ public static class SaveSystem
var json = await inputFile.ReadToEndAsync();
return JsonConvert.DeserializeObject<T>(json);
}
public static void Delete(string fileName)
{
if (!File.Exists($"{Path}/{fileName}"))
{
return;
}
File.Delete($"{Path}/{fileName}");
}
public static Task DeleteAsync(string fileName)
{
if (!File.Exists($"{Path}/{fileName}"))
{
return Task.CompletedTask;
}
File.Delete($"{Path}/{fileName}");
return Task.CompletedTask;
}
private static byte[] ObjectToByteArray(System.Object obj)
{