コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }