public void Load(Action onLoadComplete) { AddRWOperation(() => { var path = CompletePath; //Exists ? if (Saves.Exists(path)) { //Load and apply object graph = Saves.InstantLoad(path); _OverwriteLocalData(graph); if (onLoadComplete != null) { onLoadComplete(); } } else { //Nouveau fichier ! _SetDefaultLocalData(); Save(onLoadComplete); } CompleteRWOperation(); }); }
public void LoadAsync(Action onLoadComplete) { AddRWOperation(() => { var path = CompletePath; //Exists ? if (Saves.Exists(path)) { Saves.ThreadLoad(path, delegate(object graph) { _OverwriteLocalData(graph); if (onLoadComplete != null) { onLoadComplete(); } CompleteRWOperation(); }); } else { //Nouveau fichier ! _SetDefaultLocalData(); SaveAsync(onLoadComplete); CompleteRWOperation(); } }); }