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); }
public void Init(DocumentDialogue indocument, TreeNode inTreeNode, DialogueNode inDialogueNode) { document = indocument; treeNode = inTreeNode; dialogueNode = inDialogueNode as DialogueNodeRoot; dialogue = document.Dialogue; textBoxVoiceBank.Text = dialogue.VoiceBank; textBoxContext.Text = dialogue.Context; textBoxComment.Text = dialogue.Comment; comboBoxPackage.DataSource = new BindingSource(ResourcesHandler.Project.ListPackages, null); comboBoxPackage.DisplayMember = "Name"; comboBoxPackage.SelectedItem = dialogue.Package; comboBoxSceneType.DataSource = new BindingSource(EditorCore.CustomLists["SceneTypes"], null); comboBoxSceneType.ValueMember = "Key"; comboBoxSceneType.DisplayMember = "Value"; comboBoxSceneType.SelectedValue = dialogue.SceneType; foreach (var actorID in dialogue.ListAdditionalActors) { Actor actor = ResourcesHandler.Project.GetActorFromID(actorID); if (actor != null) { additionalActors.Add(actor.Name); } else { additionalActors.Add("<Undefined>"); } } listBoxAdditionalActors.DataSource = new BindingSource(additionalActors, null); var actors = new Dictionary <string, string>(); actors.Add("", ""); foreach (Actor actor in ResourcesHandler.Project.ListActors) { actors.Add(actor.ID, actor.Name); } comboBoxAdditionalActors.DataSource = new BindingSource(actors, null); comboBoxAdditionalActors.ValueMember = "Key"; comboBoxAdditionalActors.DisplayMember = "Value"; RefreshAdditionalActorView(); ready = true; }
public DialogueNodeRoot(DialogueNodeRoot other) : base(other) { //Clone all child nodes DialogueNode currentNode = this; DialogueNode currentOther = other; while (currentOther != null && currentOther.Next != null) { currentNode.Next = currentOther.Next.Clone() as DialogueNode; currentNode = currentNode.Next; currentOther = currentOther.Next; } }
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); }
public void ShowDialogueNodeProperties(DocumentDialogue document, TreeNode treeNode, DialogueNode dialogueNode) { //SetDoubleBuffered(LayoutPanel); WIN32.StopRedraw(this); //SuspendLayout(); Clear(); if (dialogueNode is DialogueNodeRoot) { DialogueNodeRoot castNode = dialogueNode as DialogueNodeRoot; FormPropertiesRoot properties = new FormPropertiesRoot(); properties.Init(document, treeNode, castNode); layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } else if (dialogueNode is DialogueNodeSentence) { DialogueNodeSentence castNode = dialogueNode as DialogueNodeSentence; FormPropertiesSentence properties = new FormPropertiesSentence(); properties.Init(document, treeNode, castNode); layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } else if (dialogueNode is DialogueNodeChoice) { DialogueNodeChoice castNode = dialogueNode as DialogueNodeChoice; FormPropertiesChoice properties = new FormPropertiesChoice(); properties.Init(document, treeNode, castNode); layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } else if (dialogueNode is DialogueNodeReply) { DialogueNodeReply castNode = dialogueNode as DialogueNodeReply; FormPropertiesReply properties = new FormPropertiesReply(); properties.Init(document, treeNode, castNode); layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } else if (dialogueNode is DialogueNodeGoto) { DialogueNodeGoto castNode = dialogueNode as DialogueNodeGoto; //FormPropertiesGoto properties = new FormPropertiesGoto(); //properties.Init(document, treeNode, castNode); //layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } else if (dialogueNode is DialogueNodeBranch) { DialogueNodeBranch castNode = dialogueNode as DialogueNodeBranch; FormPropertiesBranch properties = new FormPropertiesBranch(); properties.Init(document, treeNode, castNode); layoutPanel.Controls.Add(properties); FormPropertiesCommon propertiesCommon = new FormPropertiesCommon(); propertiesCommon.Init(document, treeNode, castNode); layoutPanel.Controls.Add(propertiesCommon); } layoutPanel.VerticalScroll.Value = 0; //ResumeLayout(); WIN32.ResumeRedraw(this); this.Refresh(); }