Пример #1
0
        /// <summary>
        /// Verifies that the pop-up is roughly the expected size
        /// </summary>
        /// <returns></returns>
        protected virtual void GetPopupHeight(Bitmap screen)
        {
            int yOffset;

            for (int row = 0; row < MAX_ROWS; row++)
            {
                yOffset = RowOffset(row);
                Color       background      = screen.GetPixel(XClick, YClick + yOffset);
                RGBHSBRange rightClickColor = RGBHSBRangeFactory.RightClickPopup();
                if (rightClickColor.ColorInRange(background))
                {
                    Height = TITLE_HEIGHT + ((row + 1) * ROW_HEIGHT);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Checks the area where the center of the bottom row of the popup is expected to be
        /// </summary>
        /// <param name="screen">the full game screen</param>
        /// <returns>true if the expected bottom row is found</returns>
        protected bool PopupIsCorrectHeight(Color[,] screen, CheckHeight checkHeight)
        {
            if (checkHeight == CheckHeight.None)
            {
                return(true);    //No height checking needed
            }

            int    left    = XClick - MIN_WIDTH / 2;
            int    right   = XClick + MIN_WIDTH / 2;
            int    top     = Bottom - ROW_HEIGHT;
            double lastRow = ImageProcessing.FractionalMatchPiece(screen, RGBHSBRangeFactory.RightClickPopup(), left, right, top, Bottom);

            switch (checkHeight)
            {
            case CheckHeight.Half:
                return(lastRow > 0.5);

            case CheckHeight.Full:
                double belowPopup = ImageProcessing.FractionalMatchPiece(screen, RGBHSBRangeFactory.RightClickPopup(), left, right, top + ROW_HEIGHT, Bottom + ROW_HEIGHT);
                return(lastRow > 0.5 && belowPopup < 0.25);
            }

            return(false);   //Should never reach here.
        }