Esempio n. 1
0
 public void selectTile(Tile i)
 {
     SelectedTiles.Clear();
     if (i != null)
     {
         SelectedTiles.Add(i);
         SelectedLayer = i.layer;
         updateTreeViewSelection();
         MainWindow.Instance.propertyGrid1.SelectedObject = i;
     }
     else
     {
         selectLayer(SelectedLayer);
     }
 }
Esempio n. 2
0
 public void moveTileToLayer(Tile i1, TileLayer l2, Tile i2)
 {
     int index2 = i2 == null ? 0 : l2.Tiles.IndexOf(i2);
     i1.layer.Tiles.Remove(i1);
     l2.Tiles.Insert(index2, i1);
     i1.layer = l2;
 }
Esempio n. 3
0
 public void selectLayer(TileLayer l)
 {
     if (SelectedTiles.Count > 0)
         selectTile(null);
     SelectedLayer = l;
     updateTreeViewSelection();
     MainWindow.Instance.propertyGrid1.SelectedObject = l;
 }
Esempio n. 4
0
 public void moveLayerUp(TileLayer l)
 {
     int index = map.Layers.IndexOf(l);
     map.Layers[index] = map.Layers[index - 1];
     map.Layers[index - 1] = l;
     selectLayer(l);
 }
Esempio n. 5
0
        public void loadMap(TileMap.TileMap map)
        {
            TextureLoader.Instance.Clear();

            foreach (TileLayer layer in map.Layers)
            {
                layer.map = map;
                foreach (Tile mapObject in layer.Tiles)
                {
                    mapObject.layer = layer;
                    if (!mapObject.loadIntoEditor())
                        return;
                }
            }

            this.map = map;
            MainWindow.Instance.loadFolder(Preferences.Instance.DefaultContentRootFolder);
            if (map.Name == null)
                map.Name = "Map_01";

            SelectedLayer = null;
            if (map.Layers.Count > 0) SelectedLayer = map.Layers[0];
            SelectedTiles.Clear();

            camera = new Camera(MainWindow.Instance.drawingBox.Width, MainWindow.Instance.drawingBox.Height);
            camera.Position = map.EditorRelated.CameraPosition;
            MainWindow.Instance.zoomCombo.Text = "100%";
            undoBuffer.Clear();
            redoBuffer.Clear();
            MainWindow.Instance.undoButton.Enabled = MainWindow.Instance.undoMenuItem.Enabled = undoBuffer.Count > 0;
            MainWindow.Instance.redoButton.Enabled = MainWindow.Instance.redoMenuItem.Enabled = redoBuffer.Count > 0;
            commandInProgress = false;

            updateTreeView();
        }
Esempio n. 6
0
 public void getSelectionFromMap()
 {
     SelectedTiles.Clear();
     SelectedLayer = null;
     string[] itemnames = map.selectedObjects.Split(';');
     foreach (string itemname in itemnames)
     {
         if (itemname.Length > 0) SelectedTiles.Add(map.getTileByName(itemname));
     }
     SelectedLayer = map.getLayerByName(map.selectedLayers);
 }
Esempio n. 7
0
 public void deleteLayer(TileLayer l)
 {
     if (map.Layers.Count > 0)
     {
         Editor.Instance.beginCommand("Delete Layer \"" + l.Name + "\"");
         map.Layers.Remove(l);
         Editor.Instance.endCommand();
     }
     if (map.Layers.Count > 0) SelectedLayer = map.Layers.Last();
     else SelectedLayer = null;
     selectTile(null);
     updateTreeView();
 }
Esempio n. 8
0
 public void addLayer(TileLayer l)
 {
     l.map = map;
     if (!l.map.Layers.Contains(l)) l.map.Layers.Add(l);
 }