private void makeDoor(int idx, bool isDoor) { GlobalEvent.OnDocumentChangeBefore(Canvas.instance.GetCurrent(), "add door"); if (isVertical) { loc.X = 2; } else { loc.Y = 2; } Point newLoc = PointUtil.Plus(this.Location, loc); if (isVertical && newLoc.Y + 50 > this.Bottom) { return; } if (!isVertical && newLoc.X + 50 > this.Right) { return; } Door temp = new Door(); temp.pA = newLoc; temp.kind = idx; temp.isDoor = isDoor; Canvas.instance.MakeDoor(temp); Canvas.instance.BindDoorToRoom(); GlobalEvent.OnDocumentChangeAfter(Canvas.instance.GetCurrent(), "add door"); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { GlobalEvent.OnDocumentChangeBefore(Canvas.instance.GetCurrent(), "delete object"); var list = Canvas.instance.m_listObject; var idx = list.IndexOf(this); list.RemoveAt(idx); Canvas.instance.Controls.Remove(this); Dispose(); GlobalEvent.OnDocumentChangeAfter(Canvas.instance.GetCurrent(), "delete object"); }