private void PathNodeJunctionEnableCheckBox_CheckedChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentPathNode == null) { return; } lock (ProjectForm.ProjectSyncRoot) { if (CurrentPathNode.HasJunction != PathNodeJunctionEnableCheckBox.Checked) { CurrentPathNode.HasJunction = PathNodeJunctionEnableCheckBox.Checked; if (CurrentPathNode.HasJunction && (CurrentPathNode.Junction == null)) { var j = new YndJunction(); //init new junction j._RawData.HeightmapDimX = 1; j._RawData.HeightmapDimY = 1; j.Heightmap = new YndJunctionHeightmap(new byte[] { 255 }, j); j.RefData = new NodeJunctionRef() { AreaID = (ushort)CurrentPathNode.AreaID, NodeID = (ushort)CurrentPathNode.NodeID }; CurrentPathNode.Junction = j; } ProjectForm.SetYndHasChanged(true); } } LoadPathNodeJunctionPage(); }
private void yndMove_Click(object sender, EventArgs e) { if (populatingui) { return; } if (Ynd == null) { return; } int x = (int)YndAreaIDXUpDown.Value; int y = (int)YndAreaIDYUpDown.Value; lock (ProjectForm.ProjectSyncRoot) { int shiftX = x - Ynd.CellX; int shiftY = y - Ynd.CellY; var areaid = y * 32 + x; if (Ynd.AreaID != areaid && ProjectForm.WorldForm != null) { YndNode[] yndNodes = Ynd.Nodes; for (int i = 0; i < yndNodes.Length; i++) { YndNode yndNode = yndNodes[i]; // a node is 512x512 yndNode.SetPosition(yndNode.Position + new SharpDX.Vector3(512 * shiftX, 512 * shiftY, 0.0f)); yndNode.AreaID = (ushort)areaid; ProjectForm.WorldForm.SetWidgetPosition(yndNode.Position); ProjectForm.WorldForm.UpdatePathNodeGraphics(yndNode, false); } YndJunction[] yndJunctions = Ynd.Junctions; if (yndJunctions != null && yndJunctions.Length != 0) { for (int i = 0; i < yndJunctions.Length; i++) { YndJunction yndJunction = yndJunctions[i]; yndJunction.PositionX += (short)(512 * shiftX); yndJunction.PositionY += (short)(512 * shiftY); } } // Editing links is not needed since they are already loaded as node above Ynd.AreaID = areaid; Ynd.Name = "nodes" + areaid.ToString() + ".ynd"; YndAreaIDInfoLabel.Text = "AID: " + areaid.ToString(); Ynd.UpdateAllNodePositions(); Ynd.UpdateBoundingBox(); Ynd.UpdateTriangleVertices(); ProjectForm.SetYndHasChanged(true); MessageBox.Show("Don't forget to remove the former ynd!"); } } UpdateFormTitleYndChanged(); }