//Delete item spawner vertex private void removeItemSpawnButton_Click(object sender, EventArgs e) { LVDShape shape = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; if (shape.points.Count == 0) { return; } int selectionIndex; if (itemSpawnVertTreeView.SelectedNode != null) { selectionIndex = itemSpawnVertTreeView.SelectedNode.Index; } else { selectionIndex = shape.points.Count - 1; } shape.points.RemoveAt(selectionIndex); itemSpawnVertTreeView.Nodes.RemoveAt(selectionIndex); renameItemSpawnVertTreeview(); }
public void Clear() { currentEntry = null; currentVert = new Vector2(0); currentNormal = new Vector2(0); currentMat = null; currentTreeNode = null; currentPoint = null; currentBounds = null; currentItemSection = null; currentGeneralPoint = null; currentGeneralRect = null; currentGeneralPath = null; name.Text = ""; subname.Text = ""; lvdEntryGroup.Visible = false; collisionGroup.Visible = false; cliffGroup.Visible = false; point2dGroup.Visible = false; boundsGroup.Visible = false; itemSpawnerGroup.Visible = false; point3dGroup.Visible = false; rectangleGroup.Visible = false; pathGroup.Visible = false; }
private void renameItemSpawnVertTreeview() { LVDShape shape = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; for (int i = 0; i < shape.points.Count; ++i) { itemSpawnVertTreeView.Nodes[i].Text = $"Point {i + 1} ({shape.points[i].X},{shape.points[i].Y})"; } }
//selecting something in the vertices tab of the item spawner editor private void treeView2_AfterSelect(object sender, TreeViewEventArgs e) { LVDShape shape = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; int selectionIndex = itemSpawnVertTreeView.SelectedNode.Index; Vector2 vert = shape.points[selectionIndex]; numericUpDown2.Value = (decimal)vert.X; numericUpDown1.Value = (decimal)vert.Y; }
//Add section private void addSectionButton_Click(object sender, EventArgs e) { LVDShape section = new LVDShape(4); TreeNode node = new TreeNode($"Section {itemSpawnSectionTreeView.Nodes.Count + 1}") { Tag = section }; ((ItemSpawner)currentEntry).sections.Add(section); itemSpawnSectionTreeView.Nodes.Add(node); }
private void button5_Click(object sender, EventArgs e) { //Add section LVDShape section = new LVDShape(4); TreeNode node = new TreeNode($"Section {treeView1.Nodes.Count + 1}") { Tag = section }; ((ItemSpawner)currentEntry).sections.Add(section); treeView1.Nodes.Add(node); }
//Remove section private void removeSectionButton_Click(object sender, EventArgs e) { LVDShape section = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; TreeNode node = itemSpawnSectionTreeView.SelectedNode; ((ItemSpawner)currentEntry).sections.Remove(section); itemSpawnSectionTreeView.Nodes.Remove(node); int i = 1; foreach (TreeNode n in itemSpawnSectionTreeView.Nodes) { n.Text = $"Section {i++}"; } }
//selecting something in the sections tab of the item spawner editor private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { LVDShape section = (LVDShape)e.Node.Tag; itemSpawnVertTreeView.Nodes.Clear(); int i = 1; foreach (Vector2 v in section.points) { itemSpawnVertTreeView.Nodes.Add(new TreeNode($"Point {i++} ({v.X},{v.Y})") { Tag = v }); } }
private void button4_Click(object sender, EventArgs e) { //remove section LVDShape section = (LVDShape)treeView1.SelectedNode.Tag; TreeNode node = treeView1.SelectedNode; ((ItemSpawner)currentEntry).sections.Remove(section); treeView1.Nodes.Remove(node); int i = 1; foreach (TreeNode n in treeView1.Nodes) { n.Text = $"Section {i++}"; } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { //selecting something in the sections tab of the item spawner editor LVDShape section = (LVDShape)e.Node.Tag; treeView2.Nodes.Clear(); currentItemSection = section; int i = 1; foreach (Vector2 v in section.points) { treeView2.Nodes.Add(new TreeNode($"Point {i++} ({v.X},{v.Y})") { Tag = v }); } }
//changed either X or Y pos of item spawner vertex private void changeItemVertPosition(object sender, EventArgs e) { LVDShape shape = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; int selectionIndex = itemSpawnVertTreeView.SelectedNode.Index; Vector2 vert = shape.points[selectionIndex]; if (sender == numericUpDown2) { vert.X = (float)numericUpDown2.Value; } if (sender == numericUpDown1) { vert.Y = (float)numericUpDown1.Value; } shape.points[selectionIndex] = vert; renameItemSpawnVertTreeview(); }
//Add item spawner vertex private void addItemSpawnButton_Click(object sender, EventArgs e) { LVDShape shape = (LVDShape)itemSpawnSectionTreeView.SelectedNode.Tag; int selectionIndex; if (itemSpawnVertTreeView.SelectedNode != null) { selectionIndex = itemSpawnVertTreeView.SelectedNode.Index + 1; } else { selectionIndex = shape.points.Count; } shape.points.Insert(selectionIndex, new Vector2()); itemSpawnVertTreeView.Nodes.Insert(selectionIndex, new TreeNode()); renameItemSpawnVertTreeview(); }