public new void UnExecute(GameMap gameMap)
        {
            Console.WriteLine("Unexecuting: ");
            PrintState();

            List<int> newTiles = new List<int>();

            // Get vertical portion
            var curTexture = MapEditorGlobals.CurrentActiveTexture;

            // We need to loop over the width of the editor
            for (int w = 0; w < SelectedTiles.Width / 32; w++)
            {
                for (int h = 0; h < SelectedTiles.Height / 32; h++)
                {

                    var gX = SelectedTiles.X / 32 + w;
                    var gY = SelectedTiles.Y / 32 + h;

                    var tY = (gY) * curTexture.Width / 32;
                    var tX = gX;
                    var tileID = tY + tX;

                    if (X + w >= gameMap.Layers[0].Width || Y + h >= gameMap.Layers[0].Height)
                        continue;

                    newTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
                    gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = _previousTiles.First();
                    _previousTiles.Remove(_previousTiles.First());
                }
            }
        }
 public void UnExecute(GameMap gameMap)
 {
     if (_direction == LayerDirection.Up)
         gameMap.Layers.Swap(_layerID, _layerID + 1);
     else
         gameMap.Layers.Swap(_layerID, _layerID - 1);
 }
        public new void UnExecute(GameMap gameMap)
        {
            foreach (var node in _affectedNodes)
            {
                gameMap.Layers[Layer].MapTiles[node.X][node.Y].TileId = node.ID;

            }
        }
        public TileMapRenderer(GameScreen parentScreen, GameMap gameMap)
        {
            ParentScreen = parentScreen;
            _gameMap = gameMap;

            // Load up our texture if we need to
            _tilesetTexture = TextureLoader.GetTexture(@"Levels\castle.png", parentScreen.ScreenManager.GraphicsDevice);
        }
        public new void Execute(GameMap gameMap)
        {
            if (X  >= gameMap.Layers[0].Width || Y  >= gameMap.Layers[0].Height)
                return;

            _previousID = gameMap.Layers[Layer].MapTiles[X][Y].TileId;
            gameMap.Layers[Layer].MapTiles[X][Y].TileId = -1;
        }
 public void Execute(GameMap gameMap)
 {
     for (int index = _transactionPackage.Count - 1; index >= 0; index--)
     {
         var action = _transactionPackage[index];
         action.Execute(gameMap);
     }
 }
        public void SetMap(GameMap map)
        {
            _gameMap = map;

            if (screen != null)
            {
                screen.GameMap = map;
                screen._renderer._gameMap = map;
            }
        }
 public void UnExecute(GameMap gameMap)
 {
     //_transactionPackage.Reverse();
        // _transactionPackage.Reverse();
     for (int index = 0; index < _transactionPackage.Count; index++)
     {
         var action = _transactionPackage[index];
         action.UnExecute(gameMap);
     }
 }
        public void Execute(GameMap gameMap)
        {
            Rectangle selected = _cutSection;
            var x = selected.X / 32;
            var y = selected.Y / 32;

            // We need to loop over the width of the editor
            for (int w = 0; w < selected.Width / 32; w++)
            {
                for (int h = 0; h < selected.Height / 32; h++)
                {
                    gameMap.Layers[_layer].MapTiles[x + w][y + h].TileId = -1;

                }
            }
        }
        public void UnExecute(GameMap gameMap)
        {
            Rectangle selected = _cutSection;
            var x = selected.X / 32;
            var y = selected.Y / 32;

            // We need to loop over the width of the editor
            for (int w = 0; w < _newData.GetLength(0); w++)
            {
                for (int h = 0; h < _newData.GetLength(1); h++)
                {
                    gameMap.Layers[_layer].MapTiles[x + w][y + h].TileId = _oldData[w, h];

                }
            }
        }
        public new void Execute(GameMap gameMap)
        {
            _map = gameMap;
            _previousID = gameMap.Layers[Layer].MapTiles[X][Y].TileId;

            var gX = SelectedTiles.X / 32;
            var gY = SelectedTiles.Y / 32;

            var tY = (gY) * MapEditorGlobals.CurrentActiveTexture.Width / 32;
            var tX = gX;
            var tileID = tY + tX;

            // Restore the state, rewind
            for (int x = 0; x < gameMap.Layers[0].Width; x++)
            {
                for (int y = 0; y < gameMap.Layers[0].Height; y++)
                {
                    Node node = new Node(x, y, gameMap.Layers[Layer].MapTiles[x][y].TileId);
                    _affectedNodes.Add(node);
                }
            }

            FloodFill(new Node(X, Y, gameMap.Layers[Layer].MapTiles[X][Y].TileId), gameMap.Layers[Layer].MapTiles[X][Y].TileId, tileID, Layer);
        }
 public MapEditScreen(GameMap gameMap)
 {
     GameMap = gameMap;
 }
 public void Execute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_position, _layerToAdd);
 }
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers[_layerID].Name = _previousName;
 }
 public void Execute(GameMap gameMap)
 {
     _previousName = gameMap.Layers[_layerID].Name;
     gameMap.Layers[_layerID].Name = _newName;
 }
 public SendMapPacket(GameMap map, ulong playerId)
 {
     Map = map;
     PlayerId = playerId;
 }
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Remove(_layerToAdd);
 }
 public MapTransactionMananger(GameMap gameMap)
 {
     _gameMap = gameMap;
 }
 public void UnExecute(GameMap gameMap)
 {
 }
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_previousIndex, _layerToAdd);
 }
 public void Execute(GameMap gameMap)
 {
     _previousIndex = gameMap.Layers.IndexOf(_layerToAdd);
     gameMap.Layers.Remove(_layerToAdd);
 }
 /// <summary>
 /// This method allows a map action to be applied to the current transaction.
 /// </summary>
 public void PerformMapTransaction(IMapAction mapAction, GameMap map)
 {
     mapAction.Execute(map);
     TransactionPerformed(this, new TransactionEventArgs(mapAction));
 }
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers[_layerID].Visible = !gameMap.Layers[_layerID].Visible;
 }
 public GameMapSnapshot(GameMap map, Type action)
 {
     Map = map;
     Action = action;
 }