static public Dialogue CreateDialogueFile(string path, Package package = null) { string projectDirectory = Path.Combine(System.Environment.CurrentDirectory, Project.GetFilePath()); string filePath = ""; try { filePath = Utility.GetRelativePath(path, projectDirectory); } catch (System.UriFormatException) { filePath = path; //In case the given path is already relative (or consider it as relative if it's invalid) } Dialogue dialogue = new Dialogue(); dialogue.Init(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)); dialogue.Package = (package != null) ? package : Project.GetDefaultPackage(); if (AddDialogue(dialogue)) { DialogueNodeRoot root = new DialogueNodeRoot(); dialogue.AddNode(root); dialogue.RootNode = root; ExporterJson.SaveDialogueFile(Project, dialogue); return(dialogue); } return(null); }
static public Dialogue CreateEmptyDialogueInstance(string name) { Dialogue dialogue = new Dialogue(); dialogue.Init("", name); dialogue.Package = Project.GetDefaultPackage(); if (AddDialogue(dialogue)) { return(dialogue); } return(null); }
static public Dialogue CreateDialogueInstance(string name) { Dialogue dialogue = new Dialogue(); dialogue.Init("", name); dialogue.Package = Project.GetDefaultPackage(); if (AddDialogue(dialogue)) { DialogueNodeRoot root = new DialogueNodeRoot(); dialogue.AddNode(root); dialogue.RootNode = root; return(dialogue); } return(null); }
static public void ParseDirectory(System.IO.DirectoryInfo root) { System.IO.FileInfo[] files = null; System.IO.DirectoryInfo[] subDirs = null; try { files = root.GetFiles("*.*"); } catch (UnauthorizedAccessException e) { Console.WriteLine(e.Message); } catch (System.IO.DirectoryNotFoundException e) { Console.WriteLine(e.Message); } if (files != null) { string projectDirectory = Path.Combine(System.Environment.CurrentDirectory, Project.GetFilePath()); foreach (System.IO.FileInfo fi in files) { if (fi.Extension == Dialogue.GetExtension()) { string filePath = Utility.GetRelativePath(fi.FullName, projectDirectory); Dialogue dialogue = new Dialogue(); dialogue.Init(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)); AddDialogue(dialogue); } } subDirs = root.GetDirectories(); foreach (System.IO.DirectoryInfo dirInfo in subDirs) { ParseDirectory(dirInfo); } } }