Ejemplo n.º 1
0
        public DialogueNodeChoice(DialogueNodeChoice other)
            : base(other)
        {
            Choice     = other.Choice;
            RepliesIDs = new List <int>();

            //Clone all child nodes
            Replies = other.Replies.Clone() as List <DialogueNodeReply>;
        }
Ejemplo n.º 2
0
        public void Init(DocumentDialogue inDocument, TreeNode inTreeNode, DialogueNode inDialogueNode)
        {
            document     = inDocument;
            treeNode     = inTreeNode;
            dialogueNode = inDialogueNode as DialogueNodeChoice;

            textBoxWorkstring.Text = dialogueNode.Choice;

            ready = true;
        }
Ejemplo n.º 3
0
        public DialogueNodeChoice(DialogueNodeChoice other)
            : base(other)
        {
            Choice     = other.Choice;
            Timer      = other.Timer;
            HideTimer  = other.HideTimer;
            Blueprint  = other.Blueprint;
            RepliesIDs = new List <int>();

            //Clone all child nodes
            Replies = other.Replies.Clone() as List <DialogueNodeReply>;
        }
Ejemplo n.º 4
0
        public void PostLoad(Project project)
        {
            //Resolve links with package
            Package = project.GetPackage(PackageName);
            if (Package == null)
            {
                EditorCore.LogError("Loading a Dialogue without Package (forcing default) : " + GetName(), this);
                Package = project.GetDefaultPackage();
            }

            //Resolve links between nodes
            RootNode = GetNodeByID(RootNodeID) as DialogueNodeRoot;

            foreach (DialogueNode node in ListNodes)
            {
                node.Next = GetNodeByID(node.NextID);
                if (node is DialogueNodeChoice)
                {
                    DialogueNodeChoice nodeChoice = node as DialogueNodeChoice;
                    foreach (int replyID in nodeChoice.RepliesIDs)
                    {
                        DialogueNodeReply nodeReply = GetNodeByID(replyID) as DialogueNodeReply;
                        if (nodeReply != null)
                        {
                            nodeChoice.Replies.Add(nodeReply);
                        }
                    }
                }
                else if (node is DialogueNodeGoto)
                {
                    DialogueNodeGoto nodeGoto = node as DialogueNodeGoto;
                    nodeGoto.Goto = GetNodeByID(nodeGoto.GotoID);
                }
                else if (node is DialogueNodeBranch)
                {
                    DialogueNodeBranch nodebranch = node as DialogueNodeBranch;
                    nodebranch.Branch = GetNodeByID(nodebranch.BranchID);
                }
            }

            EditorCore.OnDialoguePostLoad?.Invoke(this);
        }
Ejemplo n.º 5
0
        public void Init(DocumentDialogue inDocument, TreeNode inTreeNode, DialogueNodeChoice inDialogueNode)
        {
            document     = inDocument;
            treeNode     = inTreeNode;
            dialogueNode = inDialogueNode;

            textBoxWorkstring.Text = dialogueNode.Choice;
            textBoxTimer.Text      = dialogueNode.Timer.ToString();

            //TODO: Unreal Specific
            if (EditorCore.CustomLists.ContainsKey("DialogueChoices"))
            {
                comboBoxBlueprint.DataSource    = new BindingSource(EditorCore.CustomLists["DialogueChoices"], null);
                comboBoxBlueprint.ValueMember   = "Key";
                comboBoxBlueprint.DisplayMember = "Value";
                comboBoxBlueprint.SelectedValue = dialogueNode.Blueprint;
            }

            Project project = ResourcesHandler.Project;

            //Actors
            if (ResourcesHandler.Project.ListActors.Count > 0)
            {
                var actors = new Dictionary <string, string>();
                actors.Add("", "");

                foreach (Actor actor in project.ListActors)
                {
                    actors.Add(actor.ID, actor.Name);
                }

                comboBoxCharacter.DataSource    = new BindingSource(actors, null);
                comboBoxCharacter.ValueMember   = "Key";
                comboBoxCharacter.DisplayMember = "Value";
                comboBoxCharacter.SelectedValue = dialogueNode.CharacterID;
            }

            checkBoxTimer.Checked = dialogueNode.HideTimer;

            ready = true;
        }
Ejemplo n.º 6
0
        public void Init(DocumentDialogue inDocument, TreeNode inTreeNode, DialogueNodeChoice inDialogueNode)
        {
            document     = inDocument;
            treeNode     = inTreeNode;
            dialogueNode = inDialogueNode;

            textBoxWorkstring.Text = dialogueNode.Choice;
            textBoxTimer.Text      = dialogueNode.Timer.ToString();

            //TODO: Unreal Specific
            if (EditorCore.CustomLists.ContainsKey("DialogueChoices"))
            {
                comboBoxBlueprint.DataSource    = new BindingSource(EditorCore.CustomLists["DialogueChoices"], null);
                comboBoxBlueprint.ValueMember   = "Key";
                comboBoxBlueprint.DisplayMember = "Value";
                comboBoxBlueprint.SelectedValue = dialogueNode.Blueprint;
            }

            checkBoxTimer.Checked = dialogueNode.HideTimer;

            ready = true;
        }
Ejemplo n.º 7
0
        public void RemoveNode(DialogueNode nodeToRemove)
        {
            if (nodeToRemove == null)
            {
                return;
            }

            if (nodeToRemove is DialogueNodeReply)
            {
                //Remove depending nodes
                DialogueNode next = nodeToRemove.Next;
                while (next != null)
                {
                    DialogueNode nextNext = next.Next;
                    RemoveNode(next);
                    next = nextNext;
                }
            }
            else if (nodeToRemove is DialogueNodeChoice)
            {
                //Remove all replies, and let them remove their depending nodes
                DialogueNodeChoice nodechoice = nodeToRemove as DialogueNodeChoice;
                while (nodechoice.Replies.Count > 0)
                {
                    RemoveNode(nodechoice.Replies[0]);
                }
            }
            else if (nodeToRemove is DialogueNodeBranch)
            {
                DialogueNodeBranch nodeBranch = nodeToRemove as DialogueNodeBranch;

                //Remove depending nodes
                DialogueNode next = nodeBranch.Branch;
                while (next != null)
                {
                    DialogueNode nextNext = next.Next;
                    RemoveNode(next);
                    next = nextNext;
                }
            }

            foreach (DialogueNode node in ListNodes)
            {
                //Link next node to previous node
                if (node.Next == nodeToRemove)
                {
                    node.Next = nodeToRemove.Next;
                }

                //Remove from parent choice
                if (node is DialogueNodeChoice && nodeToRemove is DialogueNodeReply)
                {
                    DialogueNodeChoice nodeChoice = node as DialogueNodeChoice;
                    DialogueNodeReply  nodeReply  = nodeToRemove as DialogueNodeReply;
                    if (nodeChoice.Replies.Contains(nodeReply))
                    {
                        nodeChoice.Replies.Remove(nodeReply);
                    }
                }

                //Remove from parent branch
                if (node is DialogueNodeBranch)
                {
                    DialogueNodeBranch nodeBranch = node as DialogueNodeBranch;
                    if (nodeBranch.Branch == nodeToRemove)
                    {
                        nodeBranch.Branch = nodeToRemove.Next;
                    }
                }

                //Clean Goto references
                if (node is DialogueNodeGoto)
                {
                    DialogueNodeGoto nodeGoto = node as DialogueNodeGoto;
                    if (nodeGoto.Goto == nodeToRemove)
                    {
                        nodeGoto.Goto = null;
                    }
                }
            }

            ListNodes.Remove(nodeToRemove);
        }
Ejemplo n.º 8
0
        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;
                }
            }
        }
Ejemplo n.º 9
0
        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();
        }