//新建地图 private void button3_Click(object sender, RoutedEventArgs e) { //MessageBox.Show("new map~~~~"); NewMap map = new NewMap(); map.NewMapEvent += createNewMap; map.ShowDialog(); }
private void mi_new_Click(object sender, EventArgs e) { NewMap frm = new NewMap(); if (DialogResult.OK == frm.ShowDialog()) { playerOnMap = false; countBox = countContainer = 0; if (map != null) { for (ushort i = 0; i < map.Length; i++) { map[i].Dispose(); } map = null; } width = frm.ImageWidth; height = frm.ImageHeight; map = new PictureBox[height * width]; ushort it = 0; for (byte i = 0; i < height; i++) { for (byte j = 0; j < width; j++) { map[it] = new PictureBox(); map[it].BorderStyle = BorderStyle.FixedSingle; map[it].Location = new Point(j * 32, i * 32); map[it].Size = new Size(32, 32); map[it].Name = "img" + it; /*if (i == 0 || i == height - 1 || j == 0 || j == width - 1) * { * map[it].Image = CreateWallImage(); * map[it].Tag = BlockState.Wall; * } * else * {*/ map[it].Tag = BlockState.Empty; map[it].MouseClick += new MouseEventHandler(mapClickImage); //} ++it; } } this.panel2.Controls.AddRange(map); } frm.Dispose(); }
void OnNewDocument() { if (!OnCloseDocument()) { return; } NewMap dlg = new NewMap(); if (DialogResult.OK == dlg.ShowDialog()) { document = new MapDocument(this); document.New(dlg.MapSize, dlg.TileSize); mapWindow.SetDocument(document); } }
private void NewMap() { var newMapDialog = new NewMap(); newMapDialog.ShowDialog(); if (newMapDialog.DialogResult) { string imagePath = NowProject.Directory + "Map\\" + newMapDialog.imageName; if (!Directory.Exists(NowProject.Directory + "Map")) { Directory.CreateDirectory(NowProject.Directory + "Map"); } File.Copy(newMapDialog.imagePath, imagePath, false); var bitmapImage = new BitmapImage(new Uri(imagePath)); var imageMap = new Image(); imageMap.Source = bitmapImage; this.SelectedMap = new Map(imageMap, bitmapImage.Width, bitmapImage.Height, newMapDialog.imageName); this.SelectedMap.Matrix = this.Matrix; this.SelectedMap.Name = newMapDialog.MapName; this.NowProject.AddMap(this.SelectedMap); this.SaveMap(); } }
void file_new_Click(object sender, RoutedEventArgs e) { NewMap nm = new NewMap(); nm.ShowDialog(); }
public void CreateNewMapNow() { CurMap = new GameMap(NewMapForm.MapW, NewMapForm.MapH, NewMapForm.MapD, NewMapForm.TileW, NewMapForm.TileH); NewMapForm.Close(); NewMapForm = null; }
public void CancelNewMap() { NewMapForm.Close(); NewMapForm = null; }
void CreateNewMap() { NewMapForm = new NewMap(); NewMapForm.Show(); }
//Sự kiện click nút Mew private void btn_New_Click(object sender, EventArgs e) { NewMap newmap = new NewMap(); newmap.ShowDialog(); NewMap(newmap.cols, newmap.rows); }
private void NewMap() { var newMapDialog = new NewMap(); newMapDialog.ShowDialog(); if (newMapDialog.DialogResult) { string imagePath = NowProject.Directory + "Map\\" + newMapDialog.imageName; if (!Directory.Exists(NowProject.Directory + "Map")) Directory.CreateDirectory(NowProject.Directory + "Map"); File.Copy(newMapDialog.imagePath, imagePath, false); var bitmapImage = new BitmapImage(new Uri(imagePath)); var imageMap = new Image(); imageMap.Source = bitmapImage; this.SelectedMap = new Map(imageMap, bitmapImage.Width, bitmapImage.Height, newMapDialog.imageName); this.SelectedMap.Matrix = this.Matrix; this.SelectedMap.Name = newMapDialog.MapName; this.NowProject.AddMap(this.SelectedMap); this.SaveMap(); } }
// Creation of a new map private void MenuFileNew_Click(object sender, RoutedEventArgs e) { if (hasBeenModified == true) { changeExitButton = true; editorClosing(this, new System.ComponentModel.CancelEventArgs()); if (cancelNextAction == true) return; } defaultSpriteSheetSize = 0; playerSpriteSheetSize = 0; enemySpriteSheetSize = 0; numberPlayerOnMap = 0; NewMap createNewMapWindow = new NewMap(); createNewMapWindow.Owner = this; createNewMapWindow.ShowDialog(); if (createNewMapWindow.xSize > 0 && createNewMapWindow.ySize > 0) { // After the popup is closed mapWidth = createNewMapWindow.xSize; mapHeight = createNewMapWindow.ySize; mapName = createNewMapWindow.mapName; mapGrid.Children.Clear(); globalMap = new tile[mapWidth, mapHeight]; // Setting the mapName as the title of the window this.Title = mapName; // Deciding the size of the rectangles (tiles) int tileSize = 32; for (int j = 0; j < mapHeight; j++) { WrapPanel panel = new WrapPanel(); for (int i = 0; i < mapWidth; i++) { panel.Children.Add(new Rectangle { Tag = i + "/" + (mapHeight - j - 1), Width = tileSize, Height = tileSize, Fill = (Brush)new System.Windows.Media.BrushConverter().ConvertFromString(defaultColor), Stroke = new SolidColorBrush(Colors.Black), Margin = new Thickness(0, 2, 2, 0) }); } mapGrid.Children.Add(panel); } // Clear existing buttons tileSelectionPanel.Children.Clear(); loadButtonsFromFile(); loadSpecialTiles(); gridSplitter.Visibility = Visibility.Visible; selectedSpriteLabel.Visibility = Visibility.Visible; audioButton.Visibility = Visibility.Visible; backgroundButton.Visibility = Visibility.Visible; saveButton.IsEnabled = true; lastSavePath = null; hasBeenModified = false; cancelNextAction = false; numberPlayerOnMap = 0; selectedSprite.Fill = listSprites[0]; sprite = listSprites[0]; spriteInt = 0; canClick = true; } firstTileX = -1; firstTileY = -1; }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { using (NewMap nm = new NewMap()) { if (nm.ShowDialog() == DialogResult.OK) { Map map = new Map(nm.MapWidth, nm.MapHeight, nm.MapName); EditorEngine.Instance.Map = map; EditorEngine.Instance.Run(); } } }