static private void AddUEManifestEntry(UEManifestRoot root, string key) { //In manifest, we will use Key = Text, because Text here will be used as an ID in .po files UEManifestEntry entry = new UEManifestEntry(); entry.Source = new UEManifestSource() { Text = key }; entry.Keys = new List <UEManifestKey>() { new UEManifestKey() { Key = key, Path = "" } }; root.Children.Add(entry); }
static public void ExportToUnrealManifest(string directory, Project project, List <Dialogue> dialogues) { string path = Path.Combine(directory, "Dialogues.manifest"); UEManifestRoot root = new UEManifestRoot(); root.FormatVersion = 1; root.Namespace = ""; root.Children = new List <UEManifestEntry>(); foreach (Dialogue dialogue in dialogues) { var orderedListNodes = new List <DialogueNode>(); dialogue.GetOrderedNodes(ref orderedListNodes); foreach (DialogueNode dialogueNode in orderedListNodes) { if (dialogueNode is DialogueNodeSentence) { DialogueNodeSentence sentence = (dialogueNode as DialogueNodeSentence); AddUEManifestEntry(root, sentence.Sentence); } else if (dialogueNode is DialogueNodeReply) { DialogueNodeReply reply = (dialogueNode as DialogueNodeReply); AddUEManifestEntry(root, reply.Reply); } } } using (StreamWriter file = File.CreateText(path)) { JsonSerializer serializer = new JsonSerializer(); serializer.Formatting = Formatting.Indented; serializer.Serialize(file, root); } }