public RenderMapPayload(Splorr.Map map, int x, int y,int columns,int rows)
 {
     Map = map;
     X = x;
     Y = y;
     Columns = columns;
     Rows = rows;
 }
Beispiel #2
0
        public void RenderMap(Splorr.Map map, int x, int y, int columns, int rows)
        {
            int screenX = x;
            for(int column=0;column< columns;++column)
            {
                int width = 0;
                int screenY = y;
                for(int row=0;row< rows;++row)
                {
                    var mapCell = map.GetMapCell(column, row);

                    var descriptor = _imageDescriptors[mapCell.TerrainInstance.ImageName];

                    var texture = _images[descriptor.Value];

                    width = Math.Max(width, texture.Width);
                    int height = texture.Height;

                    _spriteBatch.Draw(texture, new Rectangle(screenX, screenY, texture.Width, texture.Height), Color.White);

                    var creatureInstance = mapCell.CreatureInstance;
                    if(creatureInstance!= null)
                    {
                        texture = _images[_imageDescriptors[creatureInstance.ImageName].Value];
                        _spriteBatch.Draw(texture, new Rectangle(screenX, screenY, texture.Width, texture.Height), Color.White);
                    }

                    var effectInstance = mapCell.EffectInstance;
                    if (effectInstance != null)
                    {
                        texture = _images[_imageDescriptors[effectInstance.ImageName].Value];
                        _spriteBatch.Draw(texture, new Rectangle(screenX, screenY, texture.Width, texture.Height), Color.White);
                    }

                    var itemInstance = mapCell.PeekItem();
                    if(itemInstance!= null)
                    {
                        texture = _images[_imageDescriptors[itemInstance.ImageName].Value];
                        _spriteBatch.Draw(texture, new Rectangle(screenX, screenY, texture.Width, texture.Height), Color.White);
                    }

                    screenY += height;
                }
                screenX += width;
            }
        }
 public RenderMapMessage(Splorr.Map map, int x, int y, int columns, int rows)
     : this(new RenderMapPayload(map, x, y, columns, rows))
 {
 }