Esempio n. 1
0
        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());
                }
            }
        }
Esempio n. 2
0
 public void UnExecute(GameMap gameMap)
 {
     if (_direction == LayerDirection.Up)
         gameMap.Layers.Swap(_layerID, _layerID + 1);
     else
         gameMap.Layers.Swap(_layerID, _layerID - 1);
 }
Esempio n. 3
0
        public new void UnExecute(GameMap gameMap)
        {
            foreach (var node in _affectedNodes)
            {
                gameMap.Layers[Layer].MapTiles[node.X][node.Y].TileId = node.ID;

            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
 public void Execute(GameMap gameMap)
 {
     for (int index = _transactionPackage.Count - 1; index >= 0; index--)
     {
         var action = _transactionPackage[index];
         action.Execute(gameMap);
     }
 }
Esempio n. 7
0
        public void SetMap(GameMap map)
        {
            _gameMap = map;

            if (screen != null)
            {
                screen.GameMap = map;
                screen._renderer._gameMap = map;
            }
        }
Esempio n. 8
0
 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];

                }
            }
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
 public MapEditScreen(GameMap gameMap)
 {
     GameMap = gameMap;
 }
Esempio n. 13
0
 public void Execute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_position, _layerToAdd);
 }
Esempio n. 14
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers[_layerID].Name = _previousName;
 }
Esempio n. 15
0
 public void Execute(GameMap gameMap)
 {
     _previousName = gameMap.Layers[_layerID].Name;
     gameMap.Layers[_layerID].Name = _newName;
 }
Esempio n. 16
0
 public SendMapPacket(GameMap map, ulong playerId)
 {
     Map = map;
     PlayerId = playerId;
 }
Esempio n. 17
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Remove(_layerToAdd);
 }
 public MapTransactionMananger(GameMap gameMap)
 {
     _gameMap = gameMap;
 }
Esempio n. 19
0
 public void UnExecute(GameMap gameMap)
 {
 }
Esempio n. 20
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_previousIndex, _layerToAdd);
 }
Esempio n. 21
0
 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;
 }
Esempio n. 24
0
 public GameMapSnapshot(GameMap map, Type action)
 {
     Map = map;
     Action = action;
 }