public static void SaveInteractionData() { if (currentObject.GetType() == typeof(InteractionQuests)) { } else if (currentObject.GetType() == typeof(InteractionDialogue)) { text.Visible = false; save.Visible = false; ((InteractionDialogue)currentObject).displayText = text.Text; } else if (currentObject.GetType() == typeof(InteractionPath)) { if (pars[0].Text.Length != 0) { ((InteractionPath)currentObject).pathName = pars[0].Text; displayTree.SelectedNode.Text = pars[0].Text; } if (nodeBase[displayTree.SelectedNode.Parent].GetType() == typeof(InteractionQuests)) { InteractionQuests que = (InteractionQuests)nodeBase[displayTree.SelectedNode.Parent]; if (tmpInt != -1) { if (que.questTags.Count > tmpInt) { que.questTags[tmpInt] = pars[1].Text; } if (que.questInts.Count > tmpInt) { if (!int.TryParse(pars[2].Text, out int vbs)) { vbs = 0; } que.questInts[tmpInt] = vbs; } } } } toolButton.DropDown.Items[0].Visible = false; toolButton.DropDown.Items[2].Visible = false; toolButton.DropDown.Items[3].Visible = false; currentObject.ModificationAction(); }
private static void SetupInteractionData() { text.Visible = false; save.Visible = false; group.Visible = false; group.Controls.Clear(); toolButton.DropDown.Items[0].Visible = false; toolButton.DropDown.Items[2].Visible = false; toolButton.DropDown.Items[3].Visible = false; if (currentObject.GetType() == typeof(InteractionChoice)) { toolButton.DropDown.Items[3].Visible = true; } else if (currentObject.GetType() == typeof(InteractionQuests)) { toolButton.DropDown.Items[3].Visible = true; group.Visible = true; CheckBox bux = new CheckBox() { Location = new Point(5, 15), Text = "Immediate Mode", Checked = ((InteractionQuests)currentObject).immediateMode }; bux.CheckedChanged += new EventHandler((object sender, EventArgs e) => { ((InteractionQuests)currentObject).immediateMode = bux.Checked; }); group.Controls.Add(bux); } else if (currentObject.GetType() == typeof(InteractionDialogue)) { text.Visible = true; text.Text = ((InteractionDialogue)currentObject).displayText; save.Visible = true; } else if (currentObject.GetType() == typeof(InteractionPath)) { toolButton.DropDown.Items[0].Visible = true; toolButton.DropDown.Items[2].Visible = true; group.Visible = true; save.Visible = true; //If under a quest, set quest flags and stuff if (nodeBase[displayTree.SelectedNode.Parent].GetType() == typeof(InteractionQuests)) { InteractionQuests que = (InteractionQuests)nodeBase[displayTree.SelectedNode.Parent]; tmpInt = que.paths.IndexOf((InteractionPath)currentObject); pars = new TextBox[3]; TextBox val = new TextBox() { Location = new Point(0, 35), Size = new Size(200, 20), Text = displayTree.SelectedNode.Text }; group.Controls.Add(new Label() { Text = "Path Name: ", Location = new Point(0, 15), Size = new Size(200, 20) }); group.Controls.Add(val); TextBox vall = new TextBox() { Location = new Point(0, 75), Size = new Size(200, 20), Text = (que.questTags.Count > tmpInt && tmpInt != -1) ? que.questTags[tmpInt] : "" }; group.Controls.Add(new Label() { Text = "Quest Name: ", Location = new Point(0, 55), Size = new Size(200, 20) }); group.Controls.Add(vall); TextBox valll = new TextBox() { Location = new Point(0, 115), Size = new Size(200, 20), Text = (que.questInts.Count > tmpInt && tmpInt != -1) ? que.questInts[tmpInt].ToString() : "0" }; group.Controls.Add(new Label() { Text = "Checked Int: ", Location = new Point(0, 95), Size = new Size(200, 20) }); group.Controls.Add(valll); pars[0] = val; pars[1] = vall; pars[2] = valll; } else { pars = new TextBox[1]; TextBox val = new TextBox() { Location = new Point(0, 35), Size = new Size(200, 20), Text = displayTree.SelectedNode.Text }; group.Controls.Add(new Label() { Text = "Path Name: ", Location = new Point(0, 15), Size = new Size(200, 20) }); group.Controls.Add(val); pars[0] = val; } } }
//Creates a new object from type given and adds it to the tree public static void SetupNewData(Type nt) { InteractionBase news = new InteractionDialogue(""); if (nt == typeof(InteractionQuests)) { news = new InteractionQuests(new List <InteractionPath>() { }); } else if (nt.Equals(typeof(InteractionDialogue))) { news = new InteractionDialogue(""); } else if (nt.Equals(typeof(InteractionChoice))) { news = new InteractionChoice(new List <InteractionPath>() { }); } else if (nt.Equals(typeof(InteractionPath))) { news = new InteractionPath(); } TreeNode nod = new TreeNode(news.ToString()); if (displayTree.SelectedNode != null) { if (nodeBase[displayTree.SelectedNode].GetType() == typeof(InteractionPath)) { //If the node is a path, then add the item to that path ((InteractionChoice)nodeBase[displayTree.SelectedNode.Parent]).AddBase(displayTree.SelectedNode.Text, news); displayTree.SelectedNode.Nodes.Add(nod); displayTree.SelectedNode.Expand(); nodeBase.Add(nod, news); } else if (nodeBase[displayTree.SelectedNode].GetType() == typeof(InteractionChoice)) { ((InteractionChoice)nodeBase[displayTree.SelectedNode]).AddChoice(pars[0].Text); nod.Text = pars[0].Text; displayTree.SelectedNode.Nodes.Add(nod); displayTree.SelectedNode.Expand(); nodeBase.Add(nod, news); pars = null; } else if (nodeBase[displayTree.SelectedNode].GetType() == typeof(InteractionQuests)) { ((InteractionQuests)nodeBase[displayTree.SelectedNode]).AddChoice(pars[0].Text); ((InteractionQuests)nodeBase[displayTree.SelectedNode]).questTags.Add(""); nod.Text = pars[0].Text; displayTree.SelectedNode.Nodes.Add(nod); displayTree.SelectedNode.Expand(); nodeBase.Add(nod, news); pars = null; } } else { //if nothing selected, then the primary level interactedObject.InterItems.Add(news); nodeBase.Add(nod, news); displayTree.Nodes.Add(nod); } }