Ejemplo n.º 1
0
        private void DrawSingleTile()
        {
            if (m_selectedLayer == null)
                return;
            if (m_selectedTileSheet == null)
                return;
            if (m_selectedTileIndex < 0)
                return;

            if (m_selectedLayer.TileSize != m_selectedTileSheet.TileSize)
            {
                m_tileSizeMessageBox.Show();
                return;
            }

            if (!m_selectedLayer.IsValidTileLocation(m_tileLayerLocation))
                return;

            Tile oldTile = m_selectedLayer.Tiles[m_tileLayerLocation];

            if (oldTile != null && oldTile.TileSheet == m_selectedTileSheet
                && oldTile.TileIndex == m_selectedTileIndex)
                return;

            Command command = new ToolsPlaceTileCommand(
                m_selectedLayer,
                new StaticTile(m_selectedLayer, m_selectedTileSheet,
                    BlendMode.Alpha, m_selectedTileIndex),
                m_tileLayerLocation);
            m_commandHistory.Do(command);

            m_innerPanel.Invalidate();

            if (MapChanged != null)
                MapChanged(this, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        private void DrawSampledTile()
        {
            if (m_selectedLayer == null)
                return;

            if (m_textureDistribution.Count == 0)
                return;

            Tile sampledTile
                = m_textureDistribution[m_random.Next(m_textureDistribution.Count)];

            if (m_selectedLayer.TileSize != sampledTile.TileSheet.TileSize)
            {
                m_tileSizeMessageBox.Show();
                return;
            }

            if (!m_selectedLayer.IsValidTileLocation(m_tileLayerLocation))
                return;

            Tile oldTile = m_selectedLayer.Tiles[m_tileLayerLocation];

            if (oldTile != null && oldTile.TileSheet == m_selectedTileSheet
                && oldTile.TileIndex == m_selectedTileIndex)
                return;

            Command command = new ToolsPlaceTileCommand(
                m_selectedLayer,
                sampledTile,
                m_tileLayerLocation);
            m_commandHistory.Do(command);

            m_innerPanel.Invalidate();

            if (MapChanged != null)
                MapChanged(this, EventArgs.Empty);
        }