//-------------------------------------------------------------------------------------------------------------- // Events private void OnWorkstringChanged(object sender, EventArgs e) { if (!ready) { return; } RichTextBox textBox = sender as RichTextBox; dialogueNode.Choice = EditorHelper.SanitizeText(textBox.Text); document.RefreshTreeNode(treeNode); //document.SetDirty(); document.SetPendingDirty(); }
private void OnWorkstringChanged(object sender, EventArgs e) { if (!ready) { return; } RichTextBox textBox = sender as RichTextBox; if (!isEditingWorkstring) { isEditingWorkstring = true; originalWorkstring = dialogueNode.Sentence; } dialogueNode.Sentence = EditorHelper.SanitizeText(textBox.Text); RefreshWordCount(); document.RefreshTreeNode(treeNode); //document.SetDirty(); document.SetPendingDirty(); }
public void PreSave(Project project) { //Prepare File VersionProject = EditorCore.VersionProject; VersionEditor = EditorVersion.GetVersion(); if (Package == null) { EditorCore.LogError("Saving a Dialogue without Package (forcing default) : " + GetName(), this); Package = project.GetDefaultPackage(); } if (Package != null) { PackageName = Package.Name; } //Sanitize texts //dialogue.Comment = EditorCore.SanitizeText(dialogue.Comment); //Prepare nodes links RootNodeID = (RootNode != null) ? RootNode.ID : DialogueNode.ID_NULL; foreach (DialogueNode node in ListNodes) { node.NextID = (node.Next != null) ? node.Next.ID : DialogueNode.ID_NULL; if (node is DialogueNodeSentence) { //Generate ID DialogueNodeSentence nodeSentence = node as DialogueNodeSentence; nodeSentence.VoicingID = EditorHelper.GetPrettyNodeVoicingID(this, nodeSentence); //Sanitize texts nodeSentence.Sentence = EditorHelper.SanitizeText(nodeSentence.Sentence); //nodeSentence.Comment = EditorHelper.SanitizeText(nodeSentence.Comment); } else if (node is DialogueNodeChoice) { DialogueNodeChoice nodeChoice = node as DialogueNodeChoice; //Sanitize texts nodeChoice.Choice = EditorHelper.SanitizeText(nodeChoice.Choice); nodeChoice.RepliesIDs.Clear(); foreach (DialogueNodeReply nodeReply in nodeChoice.Replies) { //Sanitize texts nodeReply.Reply = EditorHelper.SanitizeText(nodeReply.Reply); nodeChoice.RepliesIDs.Add(nodeReply.ID); } } else if (node is DialogueNodeGoto) { DialogueNodeGoto nodeGoto = node as DialogueNodeGoto; nodeGoto.GotoID = (nodeGoto.Goto != null) ? nodeGoto.Goto.ID : DialogueNode.ID_NULL; } else if (node is DialogueNodeBranch) { DialogueNodeBranch nodeBranch = node as DialogueNodeBranch; nodeBranch.BranchID = (nodeBranch.Branch != null) ? nodeBranch.Branch.ID : DialogueNode.ID_NULL; } } }