예제 #1
0
        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();
            });
        }
예제 #2
0
        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();
                }
            });
        }