Exemplo n.º 1
0
        private void _tilesetTools_Tileset_Unloaded(object sender, DockTilesetTools.TilesetLoadedEventArgs e)
        {
            string tilesetPath =
                HelperFunctions.MakeRelative(e.TilesetPath, _project.ClientRootDirectory.FullName + "/");

            if (_dockTilesetTools.Map == _map)
            {
                foreach (var layer in _map.Layers.Values)
                {
                    for (int x = 0; x < _map.Descriptor.Dimensions.X; x++)
                    {
                        for (int y = 0; y < _map.Descriptor.Dimensions.Y; y++)
                        {
                            if (layer.GetTile(x, y) != null && layer.GetTile(x, y).Sprite.Texture == _map.GetTileset(tilesetPath))
                            {
                                layer.SetTile(x, y, new Tile());
                            }
                        }
                    }
                }
            }

            _map.RemoveTileset(tilesetPath);
            this.MarkUnsaved();
        }
        private void _tilesetTools_Tileset_Loaded(object sender, DockTilesetTools.TilesetLoadedEventArgs e)
        {
            if (_dockTilesetTools.Map == _map)
            {
                var mapTilesetTexture = _mapTextureLoader.LoadFromFile(e.TilesetPath);
                mapTilesetTexture.Tag = HelperFunctions.MakeRelative(e.TilesetPath, _project.ClientRootDirectory.FullName + "/");

                _map.Tilesets.Add(Path.GetFileName(e.TilesetPath), mapTilesetTexture);

                this.MarkUnsaved();
            }
        }
Exemplo n.º 3
0
        private void _tilesetTools_Tileset_Unloaded(object sender, DockTilesetTools.TilesetLoadedEventArgs e)
        {
            if (_dockTilesetTools.Map == _map)
            {
                foreach (var layer in _map.Layers)
                {
                    for (int x = 0; x < _map.Dimensions.X; x++)
                    {
                        for (int y = 0; y < _map.Dimensions.Y; y++)
                        {
                            if (layer.GetTile(x, y) != null && layer.GetTile(x, y).Sprite.Texture == _map.GetTileset(e.TilesetPath))
                            {
                                layer.SetTile(x, y, new Tile());
                            }
                        }
                    }
                }
            }

            _map.RemoveTileset(e.TilesetPath);
            this.MarkUnsaved();
        }