Ejemplo n.º 1
0
		public void Paste() {
			if (this.Initialized) {
				MemoryStream stream = null;
				IDataObject obj = Clipboard.GetDataObject();
				const string format = "aeon_entities";

				if (obj.GetDataPresent(format)) {
					stream = obj.GetData(format) as MemoryStream;
				}

				EntitySelectionTool.Instance.SelectedEntities.Clear();
				BinaryInput bin = new BinaryInput(stream);

				int c = bin.ReadInt32();
				for (int i = 0; i < c; i++) {
					int temp_index = bin.ReadInt32();
					int x = (int)bin.ReadSingle() >> 4;
					int y = (int)bin.ReadSingle() >> 4;

					AddEntityAction act = new AddEntityAction(EditorEngine.Instance.World.EntityContainer.All()[temp_index], new Vector2(x, y));
					EditorEngine.Instance.GetActionManager().Execute(act);

					MapEntity result = act.worldEntity;
					EntitySelectionTool.Instance.SelectedEntities.Add(result);
				}
			}
		}
Ejemplo n.º 2
0
		private void onMouseDown(object sender, MouseEventArgs e) {
			if (e.Button == MouseButtons.Left) {
				EntityTemplate model = FrmEntitySelector.Instance.selectedEntity;

				if (model != null) {
					AddEntityAction action = new AddEntityAction(
						model, new Vector2(xt, yt));

					EditorEngine.Instance.GetActionManager().Execute(action);
				}
			}
		}