public static List<DialogueSegment2D> Load(InteractionHostType type, IHasGuid obj) { var interactions = new List<DialogueSegment2D>(); foreach (var f in Directory.GetFiles(GetDirectoryPath(GetDirectory(type), obj.Guid))) { interactions.Add(Load(f)); } return interactions; }
static string GetFilePath(InteractionHostType type, Guid guid, DialogueSegment2D interaction) { return GetDirectoryPath(GetDirectory(type), guid) + "/" + interaction.Guid.ToString() + ".json"; }
static string GetDirectory(InteractionHostType type) { if (type == InteractionHostType.Thing) return ThingDirectoryPath; else if (type == InteractionHostType.Trigger) return TriggerDirectoryPath; return ""; }
public static void Save(InteractionHostType type, Guid guid, DialogueSegment2D interaction) { var s = JsonConvert.SerializeObject(interaction, Formatting.Indented, settings); Serializer.SaveToFile(GetFilePath(type, guid, interaction), s); }