private void MenuNew_Click(object sender, RoutedEventArgs e) { NewMap newMap = new NewMap(); newMap.ShowDialog(); if (newMap.MapWidth != -1 && newMap.Height != -1) { Setup(newMap.MapWidth, newMap.MapHeight, true); } prevPath = ""; }
private void menuChangeSize_Click(object sender, RoutedEventArgs e) { NewMap newMap = new NewMap(); newMap.MapWidth = editor.Width; newMap.MapHeight = editor.Height; newMap.ShowDialog(); if (newMap.MapWidth == -1 || newMap.Height == -1 || ((newMap.MapWidth < editor.Width || newMap.MapHeight < editor.Height) && MessageBox.Show("The new size is smaller than your current size. Continuing may result in loss of tiles. Continue?", "Are you sure?", MessageBoxButton.YesNo) == MessageBoxResult.No)) { return; } editor.Width = newMap.MapWidth; editor.Height = newMap.MapHeight; cnvMap.Width = editor.Width * editor.TileSize; cnvMap.Height = editor.Height * editor.TileSize; List <Point3D> list = new List <Point3D>(); foreach (var x in editor.Tiles) { if (x.Key.X > editor.Width - 1) { list.Add(x.Key); } else if (x.Key.Y > editor.Height - 1) { list.Add(x.Key); } } foreach (var x in list) { editor.Tiles.Remove(x); } ReSyncOnEditor(); }