示例#1
0
 public void Init(TheaterType theater)
 {
     if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, Name, 0, out Tile tile))
     {
         Thumbnail = new Bitmap(tile.Image, tile.Image.Width, tile.Image.Height);
     }
 }
示例#2
0
        public void Init(TheaterType theater)
        {
            var size      = new Size(Globals.OriginalTileWidth / 4, Globals.OriginalTileWidth / 4);
            var iconSize  = Math.Max(IconWidth, IconHeight);
            var thumbnail = new Bitmap(iconSize * size.Width, iconSize * size.Height);
            var mask      = new bool[IconWidth, IconHeight];

            Array.Clear(mask, 0, mask.Length);

            bool found = false;

            using (var g = Graphics.FromImage(thumbnail))
            {
                g.Clear(Color.Transparent);

                int icon = 0;
                for (var y = 0; y < IconHeight; ++y)
                {
                    for (var x = 0; x < IconWidth; ++x, ++icon)
                    {
                        if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, Name, icon, out Tile tile))
                        {
                            g.DrawImage(tile.Image, x * size.Width, y * size.Height, size.Width, size.Height);
                            found = mask[x, y] = true;
                        }
                    }
                }
            }

            Thumbnail = found ? thumbnail : null;
            IconMask  = mask;
        }
示例#3
0
        public void Init(TheaterType theater)
        {
            string tileName = Name;

            if ((TemplateType & TemplateTypeFlag.OreMine) != TemplateTypeFlag.None)
            {
                tileName = "OREMINE";
            }

            if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, tileName, IsTransformable ? 22 : 0, out Tile tile))
            {
                RenderSize = new Size(tile.Image.Width / Globals.TileScale, tile.Image.Height / Globals.TileScale);
                Thumbnail  = new Bitmap(tile.Image, tile.Image.Width / 2, tile.Image.Height / 2);
            }
        }
示例#4
0
 public void Init(TheaterType theater)
 {
     if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, Name, 0, out Tile tile))
     {
         if ((tile.Image.Width * Globals.TileHeight) > (tile.Image.Height * Globals.TileWidth))
         {
             RenderSize = new Size(
                 tile.Image.Width * Globals.TileWidth / tile.Image.Width,
                 tile.Image.Height * Globals.TileWidth / tile.Image.Width
                 );
         }
         else
         {
             RenderSize = new Size(
                 tile.Image.Width * Globals.TileHeight / tile.Image.Height,
                 tile.Image.Height * Globals.TileHeight / tile.Image.Height
                 );
         }
         Thumbnail = new Bitmap(tile.Image, tile.Image.Width, tile.Image.Height);
     }
 }
示例#5
0
        public void Init(GameType gameType, TheaterType theater, HouseType house, DirectionType direction)
        {
            if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, Name, 4, out Tile tile))
            {
                RenderSize = new Size(tile.Image.Width / Globals.TileScale, tile.Image.Height / Globals.TileScale);
            }

            var mockInfantry = new Infantry(null)
            {
                Type      = this,
                House     = house,
                Strength  = 256,
                Direction = direction
            };
            var infantryThumbnail = new Bitmap(Globals.TileWidth, Globals.TileHeight);

            using (var g = Graphics.FromImage(infantryThumbnail))
            {
                MapRenderer.Render(theater, Point.Empty, Globals.TileSize, mockInfantry, InfantryStoppingType.Center).Item2(g);
            }
            Thumbnail = infantryThumbnail;
        }
示例#6
0
        public void Init(GameType gameType, TheaterType theater, HouseType house, DirectionType direction)
        {
            var mockBuilding = new Building()
            {
                Type      = this,
                House     = house,
                Strength  = 256,
                Direction = direction
            };

            var render = MapRenderer.Render(gameType, theater, Point.Empty, Globals.TileSize, Globals.TileScale, mockBuilding);

            if (!render.Item1.IsEmpty)
            {
                var buildingPreview = new Bitmap(render.Item1.Width, render.Item1.Height);
                using (var g = Graphics.FromImage(buildingPreview))
                {
                    render.Item2(g);
                }
                Thumbnail = buildingPreview;
            }
        }
示例#7
0
        public void Init(GameType gameType, TheaterType theater, HouseType house, DirectionType direction)
        {
            if (Globals.TheTilesetManager.GetTileData(theater.Tilesets, Name, 0, out Tile tile))
            {
                RenderSize = new Size(tile.Image.Width / Globals.TileScale, tile.Image.Height / Globals.TileScale);
            }

            var mockUnit = new Unit()
            {
                Type      = this,
                House     = house,
                Strength  = 256,
                Direction = direction
            };
            var unitThumbnail = new Bitmap(Globals.TileWidth * 3, Globals.TileHeight * 3);

            using (var g = Graphics.FromImage(unitThumbnail))
            {
                MapRenderer.Render(gameType, theater, new Point(1, 1), Globals.TileSize, mockUnit).Item2(g);
            }
            Thumbnail = unitThumbnail;
        }