protected virtual void OnClear() { if (!StorySave.Delete(saveFileName, saveFolder)) { //Trace.Error("Failed to delete save file!", this); } }
/// <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(); }
/// <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(); }
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); //} } }
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)}"); } }
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!"); } }
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)}"); } }