Пример #1
0
		private void mapGrößeÄndernToolStripMenuItem_Click(object sender, EventArgs e) {
			var frm = new frmNewMap {
				txtName = {
					Text = mTileMap.Name,
					Enabled = false
				},
				txtWidth = {
					Text = mTileMap.Width.ToString(CultureInfo.InvariantCulture)
				},
				txtHeight = {
					Text = mTileMap.Height.ToString(CultureInfo.InvariantCulture)
				}
			};
			frm.ShowDialog();
			if (frm.OKPressed == false) {
				return;
			}

			var newW = int.Parse(frm.txtWidth.Text);
			var newH = int.Parse(frm.txtHeight.Text);
			if (newW == mTileMap.Width && newH == mTileMap.Height) {
				MessageBox.Show("Größe is gleich...", ",,!,,", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}
			if (newH < 1 || newW < 1) {
				MessageBox.Show("Die Map sollte mind. eine Zelle groß/klein sein...", ",,!,,", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			mTileMap.Resize(newW, newH);
			mTileMap.CollisionLayer = new TileCollisionLayer(mTileMap.CollisionLayer.LayoutMap, newW, newH);

			for (var i = 0; i < mTileMap.Layers.Count; i++) {
				mTileMap.Layers[i] = new TileLayer(mTileMap.Layers[i], newW, newH);
			}

			ProjectTree.Nodes[0].Text = BuildMapName();


			// reset Cursor
			mCursorCell = new Point2D(0, 0); // let the Logic fix it
			AdjustFormScrollbars(true);
		}
Пример #2
0
		private void mapNameÄndernToolStripMenuItem_Click(object sender, EventArgs e) {
			var frm = new frmNewMap {
				txtName = {
					Text = mTileMap.Name
				},
				txtWidth = {
					Text = mTileMap.Width.ToString(CultureInfo.InvariantCulture),
					Enabled = false
				},
				txtHeight = {
					Text = mTileMap.Height.ToString(CultureInfo.InvariantCulture),
					Enabled = false
				}
			};
			frm.ShowDialog();
			if (frm.OKPressed == false) {
				return;
			}

			var newName = frm.txtName.Text;
			if (newName == mTileMap.Name) {
				MessageBox.Show("Name is gleich...", ",,!,,", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			mTileMap.Name = newName;

			ProjectTree.Nodes[0].Text = BuildMapName();
		}
Пример #3
0
		private void MenuFileNew_Click(object sender, EventArgs e) {
			var frm = new frmNewMap();
			frm.ShowDialog();
			if (frm.OKPressed == false) {
				return;
			}

			mTileMap = new TileMap(frm.txtName.Text, int.Parse(frm.txtWidth.Text), int.Parse(frm.txtHeight.Text));

			// clear Project
			ProjectTree.Nodes.Clear();
			mCurrentLayer = -1;
			mTextureRect = Rectangle.Empty;
			mPreviewTileset = null;
			mCursorCell.X = mCursorCell.Y = -1;
			mLastTilesetIndex.Clear();
			mLastAutotileIndex.Clear();
			mLastAnimationIndex.Clear();
			mLastObjectIndex.Clear();
			mUndoQueue.Clear();
			mRedoQueue.Clear();

			// Add Project Main Map
			ProjectTree.Nodes.Add(mTileMap.Name);
			ProjectTree.Nodes[0].ImageIndex = 0;
			ProjectTree.Nodes[0].SelectedImageIndex = 0;
			ProjectTree.Nodes[0].Tag = mTileMap.Name;
			ProjectTree.Nodes[0].ContextMenuStrip = ProjectTreeContext;

			// Add Collision				
			ProjectTree.Nodes[0].Nodes.Add(COLLISION_LAYER_NAME);
			ProjectTree.Nodes[0].Nodes[0].ImageIndex = 4;
			ProjectTree.Nodes[0].Nodes[0].SelectedImageIndex = 4;
			ProjectTree.Nodes[0].Nodes[0].Tag = COLLISION_LAYER_NAME;

			// Add first BG & FG
			AddLayerToTree("Hintergrund Ebene 1", true, 1, true, false, true);
			AddLayerToTree("Vordergrund Ebene 1", true, 3, true, false, false);

			ProjectTree.ExpandAll();

			// auto-select BG 1 (0=Collision, 1=BG, 2=FG)
			ProjectTree.SelectedNode = ProjectTree.Nodes[0].Nodes[1];
		}