// Add a new message to the persistent data folder public static void SaveMessage(Message m) { string path = Application.persistentDataPath + "/Resources/ChatApp/Messages/" + m.chat.name; if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } int count = System.IO.Directory.GetFiles(path).Length; string countName = ""; if (count < 10) { countName = "000" + count; } else if (count < 100) { countName = "00" + count; } else if (count < 1000) { countName = "0" + count; } SOSaver.Save(path + "/ " + m.chat.name + "_" + countName + ".dat", m); }
// Store new dialogue options public static void AddDialogueOption(MessageOption option) { string path = Application.persistentDataPath + "/Resources/ChatApp/Options/" + option.chat.name; if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); } int count = System.IO.Directory.GetFiles(path).Length; SOSaver.Save(path + "/ " + option.chat.name + "_" + count + ".dat", option); }