Пример #1
0
        public FormEditor(FormMain parent, string directory)
        {
            InitializeComponent();
            fileDir  = directory;
            dialogue = new DialogueTree();
            if (directory != "")
            {
                dialogue.Load(fileDir);
            }
            parentForm = parent;

            if (File.Exists(fileDir))
            {
                var count = 1;
                dialogue.Load(fileDir);
                for (var i = 0; i < dialogue.DialogueRoot.Count; i++)
                {
                    Tree.Nodes[0].Nodes.Add(new TreeNode());
                    for (var j = 0; j < dialogue.DialogueRoot[i].DialogueNode.Count; j++)
                    {
                        Tree.Nodes[0].Nodes[i].Nodes.Add(new TreeNode());
                        Tree.Nodes[0].Nodes[i].Text          = dialogue.DialogueRoot[i].DialogueNode[j].ConversationID;
                        Tree.Nodes[0].Nodes[i].Nodes[j].Text = count.ToString();
                        count += 1;
                    }

                    count = 1;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Creates an instance of the FormViewer class and creates rows for
        /// </summary>
        /// <param name="parent">The Form that opens this form</param>
        /// <param name="directory">The string containing the file location</param>

        //Prototype: FormViewer(Form parent, string directory)
        //Arguments: takes in a Form and a string
        //Description: Creates an instance of the FormViewer class and creates rows for
        //              the data grid
        //Precondition: There must be an instance of the Form class
        //Postcondition: An instance of the FormViewer class is created
        //Protection Level: public
        public FormViewer(Form parent, string directory)
        {
            Click     += Refresh_Click;
            parentForm = parent;
            fileDir    = directory;
            InitializeComponent();
            grid.CellBorderStyle = DataGridViewCellBorderStyle.Raised;
            dialogue             = new DialogueTree();
            dialogue.Load(directory);
            for (var i = 0; i < dialogue.DialogueRoot.Count; i++)
            {
                for (var j = 0; j < dialogue.DialogueRoot[i].DialogueNode.Count; j++)
                {
                    var      row     = (DataGridViewRow)grid.RowTemplate.Clone();
                    string[] strings =
                    {
                        dialogue.DialogueRoot[i].DialogueNode[j].ConversationID,
                        dialogue.DialogueRoot[i].DialogueNode[j].ParticipantName,
                        dialogue.DialogueRoot[i].DialogueNode[j].EmoteType,
                        dialogue.DialogueRoot[i].DialogueNode[j].Side,
                        dialogue.DialogueRoot[i].DialogueNode[j].Line,
                        dialogue.DialogueRoot[i].DialogueNode[j].SpecialityAnimation,
                        dialogue.DialogueRoot[i].DialogueNode[j].SpecialtyCamera,
                        dialogue.DialogueRoot[i].DialogueNode[j].Participants,
                        dialogue.DialogueRoot[i].DialogueNode[j].ConversationSummary
                    };
                    row.CreateCells(grid, strings);
                    grid.Rows.Add(strings);
                    dialogueLines += 1;
                }
            }

            buttonFontSizeUp.Text   = char.ConvertFromUtf32(0x2191);
            buttonFontSizeDown.Text = char.ConvertFromUtf32(0x2193);
        }