|
|
@ -30,28 +30,19 @@ namespace EGFramework |
|
|
|
public EGSave() {} |
|
|
|
public EGSave() {} |
|
|
|
public override void Init() |
|
|
|
public override void Init() |
|
|
|
{ |
|
|
|
{ |
|
|
|
LoadObjectFile("SaveData/DefaultJsonSave.json".GetGodotResPath(),TypeEGSave.Json); |
|
|
|
LoadObjectFile<EGJsonSave>("SaveData/DefaultJsonSave.json".GetGodotResPath()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void LoadDataFile(string path,TypeDBSave type){ |
|
|
|
public void LoadDataFile<TSaveData>(string path) where TSaveData:IEGSaveData,IEGSave,new(){ |
|
|
|
switch(type){ |
|
|
|
TSaveData saveData = new TSaveData(); |
|
|
|
case TypeDBSave.Csv: |
|
|
|
saveData.InitSaveFile(path); |
|
|
|
break; |
|
|
|
DataBaseFiles.Add(path,saveData); |
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void LoadObjectFile(string path,TypeEGSave type){ |
|
|
|
public void LoadObjectFile<TSaveObject>(string path) where TSaveObject:IEGSaveObject,IEGSave,new(){ |
|
|
|
switch(type){ |
|
|
|
TSaveObject saveObject = new TSaveObject(); |
|
|
|
case TypeEGSave.Json: |
|
|
|
saveObject.InitSaveFile(path); |
|
|
|
EGJsonSave newJsonFile = new EGJsonSave(); |
|
|
|
ObjectFiles.Add(path, saveObject); |
|
|
|
newJsonFile.InitSaveFile(path); |
|
|
|
|
|
|
|
ObjectFiles.Add(path, newJsonFile); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void SetObject<TObject>(string path,string objectKey,TObject obj){ |
|
|
|
public void SetObject<TObject>(string path,string objectKey,TObject obj){ |
|
|
|