Exemplo n.º 1
0
 public LibraryReport(Library library, StaticImage drawing, string directory)
     : base(library.Details.Name)
 {
     this.library = library;
     staticImage = drawing;
     this.directory = directory;
 }
Exemplo n.º 2
0
        public void Init()
        {
            isInit = true;
            if (map == null) throw new NullReferenceException("map");

            // Load GFX
            staticImage = new StaticImage(ResourceFactory.Singleton.GetInstance("Default.Tiles"), new VectorInt(16, 16));

            // Draw the palette images
            Bitmap palette = new Bitmap(6 * 16, 16);
            Graphics gfx = Graphics.FromImage(palette);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[0]).ToString()].LoadBitmap(), 0, 0);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[1]).ToString()].LoadBitmap(), 16 * 1, 0);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[2]).ToString()].LoadBitmap(), 16 * 2, 0);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[3]).ToString()].LoadBitmap(), 16 * 3, 0);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[4]).ToString()].LoadBitmap(), 16 * 4, 0);
            gfx.DrawImage(staticImage.Resources[SokobanMap.Convert(paletteCells[5]).ToString()].LoadBitmap(), 16 * 5, 0);

            pbPaletteLeft.Image = palette;
            pbPaletteRight.Image = palette;

            udWidth.Value = map.Size.X;
            udHeight.Value = map.Size.Y;

            ReDraw();

            isInit = false;
        }
Exemplo n.º 3
0
        public static HtmlBuilder Report(Puzzle puzzle, StaticImage drawing)
        {
            HtmlBuilder sb = new HtmlBuilder();

            sb.AddSection(puzzle.Details.Name);
            sb.Add("<table class=\"tableformat\"><tr><td>");

            GenericDescription desc = new GenericDescription(puzzle.Details);
            desc.Name = null; // so that the H1 tag is not generated here
            sb.Add(Report(desc));
            if (puzzle.Category != null) sb.AddLabel("Category", puzzle.Category.Details.Name);
            sb.AddLabel("Order", puzzle.Order.ToString());
            sb.AddLabel("Rating", puzzle.Rating);
            sb.AddLabel("PuzzleID", puzzle.PuzzleID);
            sb.AddLabel("Size", "{0}x{1}, {2} crates, {3} floor space",
                puzzle.MasterMap.Map.Size.X,
                puzzle.MasterMap.Map.Size.Y,
                puzzle.MasterMap.Map.Count(Cell.Crate),
                puzzle.MasterMap.Map.Count(Cell.Floor)
                );

            if (puzzle.HasAlternatives)
            {
                sb.AddLabel("Alternatives", puzzle.Alternatives.Count.ToString());
            }

            sb.Add("</td><td>");

            if (drawing != null)
            {
                sb.Add(puzzle.MasterMap, drawing.Draw(puzzle.MasterMap.Map), null);
            }

            sb.Add("</td></tr></table>");

            return sb;
        }
Exemplo n.º 4
0
        public void Init()
        {
            isInit = true;
            if (puzzleMap == null) throw new NullReferenceException("puzzleMap");

            // Load GFX
            staticImage = new StaticImage(ResourceController.Singleton.GetInstance("Default.Tiles"), new VectorInt(16, 16));

            // Draw the palette images
            Bitmap palette = new Bitmap(6 * 16, 16);
            Graphics gfx = Graphics.FromImage(palette);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 0, 0);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 16 * 1, 0);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 16 * 2, 0);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 16 * 3, 0);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 16 * 4, 0);
            gfx.DrawImage(staticImage.Resources[StaticImage.Convert(SokobanMap.Convert(paletteCells[0]))].DataAsImage, 16 * 5, 0);

            pbPaletteLeft.Image = palette;
            pbPaletteRight.Image = palette;

            udWidth.Value = Map.Size.X;
            udHeight.Value = Map.Size.Y;

            if (puzzleMap.IsMasterMap)
            {
                ucGenericDescription1.Data = puzzleMap.Puzzle.Details;
            }
            else
            {
                ucGenericDescription1.Data = puzzleMap.Details;
            }

            ReDraw();

            isInit = false;
        }
Exemplo n.º 5
0
        public static HtmlBuilder Report(PuzzleMap item, StaticImage drawing)
        {
            HtmlBuilder sb = new HtmlBuilder();

            sb.Add(Report(item.Details));

            if (drawing != null)
            {
                sb.Add(item, drawing.Draw(item.Map), null);
            }

            if (item.HasSolution)
            {
                sb.AddLabel("Solutions", item.Solutions.Count.ToString());
            }

            return sb;
        }
Exemplo n.º 6
0
 public IconBinder(StaticImage images)
 {
     this.images = images;
 }