public ItemCluster(Transformation trans)
        {
            Label = new Label {
                AutoSize    = true,
                Font        = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0),
                Location    = new Point(4, 106),
                MinimumSize = new Size(120, 0),
                Name        = trans.Name + "Label",
                Size        = new Size(120, 20),
                TabIndex    = 0,
                Text        = trans.I18N + ": 0",
                TextAlign   = ContentAlignment.MiddleCenter
            };

            BaseBox = new PictureBox {
                BackColor = Color.Transparent,
                Location  = new Point(14, 3),
                Name      = trans.Name + "PBox",
                Size      = new Size(100, 100),
                TabIndex  = 14,
                TabStop   = false
            };

            TransformationImage = new BaseImage(trans.Name, trans.X, trans.Y, trans.Scale);
            InitTooltip(TransformationImage, BaseBox, trans.I18N);

            Images = trans.Items.Select(item => {
                var itemImage = AfterbirthPlusTransformations.Adult.Equals(trans) ? new PillImage(item.Name, item.X, item.Y, item.Scale, item.BlockReduction) : new ItemImage(item.Name, item.X, item.Y, item.Scale, item.BlockReduction);
                InitTooltip(itemImage, BaseBox, item.I18N);
                return(itemImage);
            }).ToList();

            Panel = new Panel {
                Location = new Point(544, 8),
                Name     = trans.Name + "Panel",
                Size     = new Size(128, 143)
            };
            Panel.Controls.Add(BaseBox);
            Panel.Controls.Add(Label);

            Menu = new ToolStripMenuItem {
                Checked      = true,
                CheckOnClick = true,
                CheckState   = CheckState.Checked,
                Name         = trans.Name + "ToolStripMenuItem",
                Size         = new Size(132, 22),
                Text         = trans.I18N
            };

            Menu.Click += (sender, e) => {
                TransformationViewHelper.ShowHideTransformation(trans, Menu.Checked);
            };

            AddMouseMovedHandler(this);

            BaseBox.Paint += (sender, args) => {
                if (CreationMode.On)
                {
                    args.Graphics.DrawImage(Ring, -1, -1, 100, 100);
                }

                if (ShowTransformation())
                {
                    DrawImage(args, TransformationImage);
                    return;
                }
                foreach (var image in Images)
                {
                    DrawImage(args, image);
                    if (ItemImage.ShowBlackListed(image))
                    {
                        DrawBlock(args, image);
                    }
                }
            };

            _tooltipIntervalSw.Start();

            if (!CreationMode.On)
            {
                return;
            }

            BaseBox.BorderStyle = BorderStyle.FixedSingle;

            BaseBox.Click += (sender, args) => {
                CreationMode.CurrentCluster = this;
                Console.WriteLine(TransformationImage);
                foreach (var image in Images)
                {
                    Console.WriteLine(image);
                }
                Console.WriteLine(CurrentImage.Name);
            };
        }
 private static void DrawBlock(PaintEventArgs args, ItemImage image)
 {
     args.Graphics.DrawImage(_coloredBlock, image.BlockX, image.BlockY, image.BlockSideLength, image.BlockSideLength);
 }
Example #3
0
 public static bool ShowBlackListed(ItemImage image)
 {
     return((image.ItemBlacklisted && !TransformationInfoProvider.IsInBlindFloor() &&
             MainForm.ShowBlacklistedItems) || CreationMode.BlockModeOn);
 }