Unity笔记-数据存储管理器

导入Easy Save插件

SaveManager:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
public class SaveManager
{
//省略单例写法
//加密
ES3Settings setting new ES3Settings(ES3.EncryptionType.AES,"test);
//保存
public void Save<T>(string key,T value){
ES3.Save<T>(key,value,setting);
}
//读取
public T Load<T>(string key){
return ES3.Load<T>(key,setting);
}
//保存图片
public void SaveImage(Texture2D texture,string imagename){
ES3.SaveImage(texture,imagename);
}
//读取图片
public Texture2D LoadImage(string imagename){
return ES3.LoadImage(imagename);
}
//Clear
public void Clear(){
ES3.DeleteDirectroy(setting);
}
//读取到
public void LoadInto<T>(string key,T obj) where T:UnityEngine.Object{
ES3.LoadInto<T>(key,t,setting);
}
}