Пример #1
0
        /// <summary>
        /// Determines if the last screenshot was of the welcome screen
        /// </summary>
        /// <returns>true if we are on the welcome screen, false otherwise</returns>
        public bool IsWelcomeScreen(out Point?clickLocation)
        {
            int       centerX   = Center.X;
            const int centerY   = 337;
            const int width     = 220;
            const int height    = 80;
            int       left      = centerX - (width / 2);
            int       right     = centerX + (width / 2);
            int       top       = centerY - (height / 2);
            int       bottom    = centerY + (height / 2);
            int       totalSize = width * height;
            int       redBlobSize;

            RGBHSBRange red = RGBHSBRangeFactory.WelcomeScreenClickHere();

            bool[,] clickHere = ImageProcessing.ColorFilterPiece(Value, red, left, right, top, bottom);
            Blob enterGame = ImageProcessing.BiggestBlob(clickHere);

            redBlobSize = enterGame.Size;

            if (redBlobSize > (totalSize / 2))
            {
                clickLocation = enterGame.RandomBlobPixel();
                clickLocation = new Point(clickLocation.Value.X + left, clickLocation.Value.Y + top);
                return(true);
            }
            else
            {
                clickLocation = null;
                return(false);
            }
        }