private void duplicate_Click(object sender, EventArgs e) { if (CollisionSwitch != null) { AddNew(CollisionSwitch.Copy()); } }
private void copy_Click(object sender, EventArgs e) { if (CollisionSwitch != null) { copiedCollisionSwitch = CollisionSwitch.Copy(); } }
/// <summary> /// Creates a deep copy of this instance. /// </summary> /// <returns></returns> public CollisionSwitch Copy() { CollisionSwitch copy = new CollisionSwitch(); copy.Tiles = Bits.Copy(Tiles); copy.Pixels = Bits.Copy(Pixels); copy.Tilemap_bytes = Bits.Copy(tilemap_Bytes); copy.Width = Width; copy.Height = Height; copy.X = x; copy.Y = y; return(copy); }
private void height_ValueChanged(object sender, EventArgs e) { if (CollisionSwitch != null && !this.Updating) { int oldHeight = CollisionSwitch.Height; CollisionSwitch.Height = (int)height.Value; if (Model.FreeCollisionSwitchSpace() < 0) { CollisionSwitch.Height = oldHeight; MessageBox.Show("Could not change the height. There is not enough free space available.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (oldHeight != CollisionSwitch.Height) { CollisionSwitch.ResizeTilemaps(); } CollisionSwitch.Pixels = collision.GetTilemapPixels(CollisionSwitch); SetBytesLeftLabel(); picture.Invalidate(); } }
// private void AddNew(CollisionSwitch collisionSwitch) { if (Model.FreeCollisionSwitchSpace() >= collisionSwitch.Length) { this.listBox.Focus(); if (collisionSwitches.CollisionSwitches.Count < 32) { if (listBox.Items.Count > 0) { collisionSwitches.Insert(Index + 1, collisionSwitch); } else { collisionSwitches.Insert(0, collisionSwitch); } int index; if (listBox.Items.Count > 0) { index = Index; } else { index = -1; } BuildListBox(index + 1); } else { MessageBox.Show("Could not insert any more collision switches. The maximum number of collision switches allowed per area is 32.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Could not insert the switch. " + Model.MaximumSpaceExceeded("collision switch"), "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information); } }