コード例 #1
0
ファイル: PencilAction.cs プロジェクト: hilts-vaughan/inspire
        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());
                }
            }
        }
コード例 #2
0
 public void UnExecute(GameMap gameMap)
 {
     if (_direction == LayerDirection.Up)
         gameMap.Layers.Swap(_layerID, _layerID + 1);
     else
         gameMap.Layers.Swap(_layerID, _layerID - 1);
 }
コード例 #3
0
        public new void UnExecute(GameMap gameMap)
        {
            foreach (var node in _affectedNodes)
            {
                gameMap.Layers[Layer].MapTiles[node.X][node.Y].TileId = node.ID;

            }
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #6
0
 public void Execute(GameMap gameMap)
 {
     for (int index = _transactionPackage.Count - 1; index >= 0; index--)
     {
         var action = _transactionPackage[index];
         action.Execute(gameMap);
     }
 }
コード例 #7
0
        public void SetMap(GameMap map)
        {
            _gameMap = map;

            if (screen != null)
            {
                screen.GameMap = map;
                screen._renderer._gameMap = map;
            }
        }
コード例 #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);
     }
 }
コード例 #9
0
        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;

                }
            }
        }
コード例 #10
0
        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];

                }
            }
        }
コード例 #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);
        }
コード例 #12
0
 public MapEditScreen(GameMap gameMap)
 {
     GameMap = gameMap;
 }
コード例 #13
0
 public void Execute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_position, _layerToAdd);
 }
コード例 #14
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers[_layerID].Name = _previousName;
 }
コード例 #15
0
 public void Execute(GameMap gameMap)
 {
     _previousName = gameMap.Layers[_layerID].Name;
     gameMap.Layers[_layerID].Name = _newName;
 }
コード例 #16
0
 public SendMapPacket(GameMap map, ulong playerId)
 {
     Map = map;
     PlayerId = playerId;
 }
コード例 #17
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Remove(_layerToAdd);
 }
コード例 #18
0
 public MapTransactionMananger(GameMap gameMap)
 {
     _gameMap = gameMap;
 }
コード例 #19
0
 public void UnExecute(GameMap gameMap)
 {
 }
コード例 #20
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers.Insert(_previousIndex, _layerToAdd);
 }
コード例 #21
0
 public void Execute(GameMap gameMap)
 {
     _previousIndex = gameMap.Layers.IndexOf(_layerToAdd);
     gameMap.Layers.Remove(_layerToAdd);
 }
コード例 #22
0
 /// <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));
 }
コード例 #23
0
 public void UnExecute(GameMap gameMap)
 {
     gameMap.Layers[_layerID].Visible = !gameMap.Layers[_layerID].Visible;
 }
コード例 #24
0
 public GameMapSnapshot(GameMap map, Type action)
 {
     Map = map;
     Action = action;
 }