feat: add Delete methods to SaveSystem
This commit is contained in:
parent
f433a7c515
commit
4e823ce744
6759
Assets/Scenes/Game Scene.unity
generated
Normal file
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
7
Assets/Scenes/Game Scene.unity.meta
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2cda990e2423bbf4892e6590ba056729
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
2
Assets/Scenes/SampleScene.unity.meta
generated
2
Assets/Scenes/SampleScene.unity.meta
generated
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2cda990e2423bbf4892e6590ba056729
|
guid: c0bd90e5972fd8ae8b4bf9eeeed56e24
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
@ -105,6 +105,28 @@ public static class SaveSystem
|
|||||||
var json = await inputFile.ReadToEndAsync();
|
var json = await inputFile.ReadToEndAsync();
|
||||||
return JsonConvert.DeserializeObject<T>(json);
|
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)
|
private static byte[] ObjectToByteArray(System.Object obj)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user