コード例 #1
0
        public Point CalcClickPointTradeDepot(PanelLocation loc)
        {
            var y = loc.Start.Y >= imageTopsTradeDepot[1] ? clickY[1] : clickY[0];
            var x = clickXExtra + loc.Start.X + 120;

            return(new Point(x, y));
        }
コード例 #2
0
        public List <PanelLocation> CaptureCreateSaleItems()
        {
            var image = this.tradeWindow.CaptureForSaleInventory();

            var locs = new List <PanelLocation>();

            int startX = 90;
            int startY = 60;

            for (int row = 0; row < 3; row++)
            {
                for (int col = 0; col < 2; col++)
                {
                    try
                    {
                        var p = new PanelLocation {
                            Start = new Point(startX + col * 270, startY + row * 172), Row = row, Column = col
                        };
                        p.CroppedImage = cropImage(image, new Rectangle(p.Start, p.ImageGlobalTradeSize));
                        locs.Add(p);
                    }
                    catch
                    {
                    }
                }
            }

            return(locs);
        }
コード例 #3
0
        private List <PanelLocation> FindPanelStarts(Bitmap image, List <int> tops, Tuple <byte, byte> redRange, Tuple <byte, byte> greenRange, Tuple <byte, byte> blueRange)
        {
            var result     = new List <PanelLocation>();
            int lastFoundX = 0;

            tops.ForEach(y =>
            {
                PanelLocation current = null;

                for (int x = 1; x < image.Width; x++)
                {
                    var p = image.GetPixel(x, y);
                    if (InRange(p.R, redRange) && InRange(p.G, greenRange) && InRange(p.B, blueRange))
                    {
                        lastFoundX = x;

                        if (current == null)
                        {
                            current = new PanelLocation {
                                Start = new Point(x, y)
                            };
                        }
                    }
                    else
                    {
                        if (current != null)
                        {
                            int width = x - current.Start.X;
                            if (width > 180)
                            {
                                current.Width = width;
                                result.Add(current);
                                lastFoundX = 0;
                                current    = null;
                            }
                            else
                            {
                                if (x - lastFoundX > 5)
                                {
                                    current = null;
                                }
                            }
                        }
                    }
                }
            });

            return(result);
        }
コード例 #4
0
 public Point CalcClickPointCreateSaleItem(PanelLocation loc)
 {
     return(new Point(520 + loc.Column * 280, 408 + loc.Row * 176));
 }