Ejemplo n.º 1
0
 protected virtual void OnClear()
 {
     if (!StorySave.Delete(saveFileName, saveFolder))
     {
         //Trace.Error("Failed to delete save file!", this);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Request the reader to clear out all its story state data
 /// </summary>
 public void Clear()
 {
     if (debug)
     {
         Trace.Script("Cleared!", this);
     }
     storySave = new StorySave();
     OnClear();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Request the reader to clear out all its story state data
 /// </summary>
 public void Clear()
 {
     if (debug)
     {
         StratusDebug.Log("Cleared!", this);
     }
     stories.Clear();
     //storySave.Delete();
     storySave = new StorySave();
     OnClear();
 }
Ejemplo n.º 4
0
                protected virtual void OnLoad()
                {
                    if (StorySave.Exists(saveFileName, saveFolder))
                    {
                        storySave = StorySave.Load(saveFileName, saveFolder);

                        // From list to dictionary!
                        //foreach (var story in storySave.storyList)
                        //{
                        //  if (debug)
                        //    Trace.Script($"Loaded {story.name}");
                        //  stories.Add(story.name, story);
                        //}
                    }
                }
Ejemplo n.º 5
0
                protected virtual void OnSave()
                {
                    // From dictionary to list
                    //List<Story> storyList = new List<Story>();
                    //foreach (var story in stories)
                    //  storyList.Add(story.Value);
                    //storySave.stories = storyList;

                    // Now save it
                    StorySave.Save(storySave, saveFileName, saveFolder);

                    if (debug)
                    {
                        Trace.Script($"Saved {StorySave.ComposePath(saveFileName, saveFolder)}");
                    }
                }
Ejemplo n.º 6
0
        protected virtual void Load(Dictionary <string, Story> stories)
        {
            if (StorySave.Exists(saveFileName, saveFolder))
            {
                storySave = StorySave.Load(saveFileName, saveFolder);

                // From list to dictionary!
                foreach (var story in storySave.stories)
                {
                    if (debug)
                    {
                        StratusDebug.Log($"Loaded {story.name}");
                    }
                    stories.Add(story.name, story);
                }
                //if (debug)
                //  Trace.Script("Loaded!");
            }
        }
Ejemplo n.º 7
0
        protected virtual void Save(Dictionary <string, Story> stories)
        {
            // If there's no story save yet
            //if (storySave == null)
            //  storySave = new StorySave();

            // From dictionary to list
            List <Story> storyList = new List <Story>();

            foreach (var story in stories)
            {
                storyList.Add(story.Value);
            }
            storySave.stories = storyList;

            // Now save it
            StorySave.Save(storySave, saveFileName, saveFolder);

            if (debug)
            {
                StratusDebug.Log($"Saved {StorySave.ComposePath(saveFileName, saveFolder)}");
            }
        }