// // CHOICE EDIT PANEL // private void addChoiceButton_Click(object sender, EventArgs e) { Choice choiceTemp = new Choice(); DisplayedNode.Choices.Add(choiceTemp); ChoiceEditPanel choicePanelTemp = new ChoiceEditPanel(choiceTemp); choicesFlowLayoutPanel.Controls.Add(choicePanelTemp); }
private void RenumberChoiceEditPanels() { if (choicesFlowLayoutPanel.Controls.Count > 1) { ChoiceEditPanel[] choicePanelTemp = new ChoiceEditPanel [choicesFlowLayoutPanel.Controls.Count - 1]; int index = 0; foreach (Control c in choicesFlowLayoutPanel.Controls) { if (c is ChoiceEditPanel) { choicePanelTemp[index] = (ChoiceEditPanel)c; index++; } } for (index = 0; index < choicePanelTemp.Length; index++) { choicePanelTemp[index].SetNumber(index); } } }
private void SetForNewNode(Node n) { displayedNode = n; npcTextBox.Text = n.NPC; if (RootNodePanel != null) { if (n == RootNodePanel.DisplayedNode) { isRootNodePanel = true; } else { isRootNodePanel = false; } } foreach (Control c in choicesFlowLayoutPanel.Controls) { if (c is ChoiceEditPanel) { choiceEditPanels.Push((ChoiceEditPanel)c); } } choicesFlowLayoutPanel.Controls.Clear(); choicesFlowLayoutPanel.Controls.Add(choicesFlowLayoutPanelWidthGuide); foreach (Choice c in n.Choices) { if (choiceEditPanels.Count > 0) { ChoiceEditPanel reusedPanel = choiceEditPanels.Pop(); choicesFlowLayoutPanel.Controls.Add(reusedPanel); reusedPanel.DisplayedChoice = c; } else { choicesFlowLayoutPanel.Controls.Add(new ChoiceEditPanel(c)); } } }