void OpenTileSetEditor(string fileName) { TileSetEditor ed = new TileSetEditor(); ed.OpenEditor(fileName); AttachNewEditor(ed); }
public void OpenEditor(string file) { CloseEditor(); using (FileStream openFile = new FileStream(file, FileMode.Open, FileAccess.Read)) { baseMap = Map.FromStream(openFile, getTileSetFromFileName); } foreach (TileSet tset in baseMap.tileSets) { TileSetEditor ed = new TileSetEditor(); ed.Editable = false; ed.OpenFromTileSet(tset); ed.TileSelected += OnTileSelected; TabItem tab = new TabItem(); tab.Header = ed.Title; tab.Content = ed; TileSets.SelectedIndex = TileSets.Items.Add(tab); } RebuildMap(); ZClip.Value = ZClip.Maximum; SaveFilePath = file; Saved = true; }
void CreateNewTileSetEditor(string fileName) { TileSetEditor ed = new TileSetEditor(); ed.NewEditor(fileName); AttachNewEditor(ed); }
public void OnAddTileSetClicked(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = MainWindow.ContentDir; dlg.FileOk += MainWindow.ValidateFileName; dlg.Filter = "Tile Sets|*.tls"; Nullable<bool> result = dlg.ShowDialog(); if (result == true) { TileSetEditor tset = new TileSetEditor(); tset.Editable = false; tset.OpenEditor(dlg.FileName); tset.TileSelected += OnTileSelected; baseMap.tileSets.Add(tset.Tiles); TabItem tab = new TabItem(); tab.Header = tset.Title; tab.Content = tset; TileSets.SelectedIndex = TileSets.Items.Add(tab); OnModify(); } dlg = null; }