public void LoadAsync(Action onLoadComplete)
    {
        AddRWOperation(() =>
        {
            var path = CompletePath;

            //Exists ?
            if (SaveHelper.FileExists(path))
            {
                SaveService.Instance.ThreadLoad(path,
                                                delegate(object graph)
                {
                    _OverwriteLocalData(graph);
                    HasEverLoaded = true;

                    onLoadComplete?.Invoke();

                    CompleteRWOperation();
                });
            }
            else
            {
                //Nouveau fichier !
                _SetDefaultLocalData();
                SaveAsync(onLoadComplete);

                CompleteRWOperation();
            }
        });
    }
    public void Load(Action onLoadComplete)
    {
        AddRWOperation(() =>
        {
            string path = CompletePath;

            //Exists ?
            if (SaveHelper.FileExists(path))
            {
                //Load and apply
                object graph = SaveHelper.InstantLoad(path);
                _OverwriteLocalData(graph);
                HasEverLoaded = true;

                onLoadComplete?.Invoke();
            }
            else
            {
                //Nouveau fichier !
                _SetDefaultLocalData();

                Save(onLoadComplete);
            }

            CompleteRWOperation();
        });
    }
Пример #3
0
 public bool FileExists(string path)
 {
     return(SaveHelper.FileExists(path));
 }