Ejemplo n.º 1
0
 public RenderMapPayload(Splorr.Map map, int x, int y,int columns,int rows)
 {
     Map = map;
     X = x;
     Y = y;
     Columns = columns;
     Rows = rows;
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 3
0
 public RenderMapMessage(Splorr.Map map, int x, int y, int columns, int rows)
     : this(new RenderMapPayload(map, x, y, columns, rows))
 {
 }