コード例 #1
0
 public TalkNode(TreeNode parentNode, TalkNodeTypes type, String id, String text)
 {
     this.parentNode = parentNode;
     this.type       = type;
     this.id         = id;
     this.text       = text;
 }
コード例 #2
0
 public TalkNode()
 {
     parentNode = null;
     type       = TalkNodeTypes.None;
     id         = "";
     text       = "";
 }
コード例 #3
0
 public TalkNode(TreeNode parentNode, TalkNodeTypes type, String id, String text)
 {
     this.parentNode = parentNode;
     this.type = type;
     this.id = id;
     this.text = text;
 }
コード例 #4
0
 public TalkNode()
 {
     parentNode = null;
     type = TalkNodeTypes.None;
     id = "";
     text = "";
 }
コード例 #5
0
        private void setFields(object sender)
        {
            for (int childIndex = 0; childIndex < m_replies.Count; ++childIndex)
            {
                if (sender == null || sender == m_replies[childIndex].typeField)
                {
                    TalkNodeTypes newType = (TalkNodeTypes)Enum.Parse(typeof(TalkNodeTypes), (String)m_replies[childIndex].typeField.SelectedItem);
                    switch (newType)
                    {
                    case TalkNodeTypes.None:
                        m_replies[childIndex].idField.Enabled     = false;
                        m_replies[childIndex].idField.Text        = "";
                        m_replies[childIndex].textField.Enabled   = false;
                        m_replies[childIndex].textField.Text      = "";
                        m_replies[childIndex].selectField.Enabled = false;
                        break;

                    case TalkNodeTypes.Trade:
                        m_replies[childIndex].idField.Enabled     = true;
                        m_replies[childIndex].textField.Enabled   = false;
                        m_replies[childIndex].textField.Text      = "";
                        m_replies[childIndex].selectField.Enabled = false;
                        break;

                    case TalkNodeTypes.Branch:
                        m_replies[childIndex].idField.Enabled     = true;
                        m_replies[childIndex].textField.Enabled   = true;
                        m_replies[childIndex].selectField.Enabled = true;
                        break;
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Display the reply fields based on the type of data
        /// </summary>
        /// <param name="sender"></param>
        private void setFields(object sender)
        {
            for (int childIndex = 0; childIndex < m_replies.Count; ++childIndex)
            {
                if (sender == null || // Display every reply type
                    sender == m_replies[childIndex].typeField)    // Display this precise reply type
                {
                    m_replyTrade[childIndex].Visible  = false;
                    m_replyBranch[childIndex].Visible = false;
                    m_replyFlag[childIndex].Visible   = false;
                    TalkNodeTypes newType = (TalkNodeTypes)Enum.Parse(typeof(TalkNodeTypes), (String)m_replies[childIndex].typeField.SelectedItem);
                    switch (newType)
                    {
                    case TalkNodeTypes.None:
                    {
                    }
                    break;

                    case TalkNodeTypes.Trade:
                    {
                        Reply.Trade gui = m_replyTrade[childIndex];
                        gui.Focus();
                        gui.Visible = true;
                        gui.setTreeNode(m_replies[childIndex].treeNode);
                    }
                    break;

                    case TalkNodeTypes.Branch:
                    {
                        Reply.Branch gui = m_replyBranch[childIndex];
                        gui.Focus();
                        gui.Visible = true;
                        gui.setTreeNode(m_replies[childIndex].treeNode);
                    }
                    break;

                    case TalkNodeTypes.Flags:
                    {
                        Reply.Flag gui = m_replyFlag[childIndex];
                        gui.Focus();
                        gui.Visible = true;
                        gui.setTreeNode(m_replies[childIndex].treeNode);
                        gui.UpdateData();
                    }
                    break;
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// The type has been changed.  Find the appropriate reply and enable/disable its fields.
        /// </summary>
        private void onReplyTypeSelected(object sender, EventArgs e)
        {
            if (!m_muteFieldEvents)
            {
                // User is manually changing the field
                for (int childIndex = 0; childIndex < m_replies.Count; ++childIndex)
                {
                    if (sender == m_replies[childIndex].typeField)
                    {
                        TalkNodeTypes newType = (TalkNodeTypes)Enum.Parse(typeof(TalkNodeTypes), (String)m_replies[childIndex].typeField.SelectedItem);

                        TalkNodeTypes currentType = m_replies[childIndex].treeNode == null
                                                  ? TalkNodeTypes.None
                                                  : ((TalkNode)m_replies[childIndex].treeNode.Tag).type;
                        if (!currentType.Equals(newType))
                        {
                            // The type has been changed
                            if (newType.Equals(TalkNodeTypes.None))
                            {
                                // Delete this sub-node
                                TreeNode deletedNode = m_replies[childIndex].treeNode;
                                guiTalkTree.SelectedNode.Nodes.Remove(deletedNode);
                                refreshTree();
                                setFields(null);
                            }
                            else
                            {
                                if (newType.Equals(TalkNodeTypes.Trade) &&
                                    !canSetNodeToTrade(guiTalkTree.SelectedNode))
                                {
                                    // Already contains a Trade sub-node so reset to previous type
                                    m_replies[childIndex].typeField.SelectedItem = currentType.ToString();
                                    setFields(sender);
                                    return;
                                }

                                if (currentType.Equals(TalkNodeTypes.None))
                                {
                                    // Create a sub-node
                                    if (newType.Equals(TalkNodeTypes.Trade))
                                    {
                                        addNodeTrade(guiTalkTree.SelectedNode, "");
                                    }
                                    else if (newType.Equals(TalkNodeTypes.Branch))
                                    {
                                        addNodeBranch(guiTalkTree.SelectedNode, "", "");
                                    }
                                    else if (newType.Equals(TalkNodeTypes.Flags))
                                    {
                                        addNodeFlag(guiTalkTree.SelectedNode, "", "");
                                    }
                                }
                                else
                                {
                                    // Change the node type
                                    TreeNode modifiedNode = m_replies[childIndex].treeNode;
                                    guiTalkTree.SelectedNode.Nodes.Remove(modifiedNode);
                                    if (newType.Equals(TalkNodeTypes.Trade))
                                    {
                                        addNodeTrade(guiTalkTree.SelectedNode, "");
                                    }
                                    else if (newType.Equals(TalkNodeTypes.Branch))
                                    {
                                        addNodeBranch(guiTalkTree.SelectedNode, "", "");
                                    }
                                    else if (newType.Equals(TalkNodeTypes.Flags))
                                    {
                                        addNodeFlag(guiTalkTree.SelectedNode, "", "");
                                    }
                                }
                                refreshTree();
                                setFields(sender);
                            }
                        }
                    }
                }
            }
        }