Beispiel #1
0
        private void ScanBurst(FastBitmapHSV bitmap, ScreenData screenData)
        {
            float monoAcc = 0.0f;

            for (int idxY = 0; idxY < rectBurstActive.Height; idxY++)
            {
                for (int idxX = 0; idxX < rectBurstActive.Width; idxX++)
                {
                    FastPixelHSV testPx = bitmap.GetPixel(rectBurstActive.X + idxX, rectBurstActive.Y + idxY);
                    monoAcc += testPx.GetMonochrome();
                }
            }

            float monoAvg       = monoAcc / (rectBurstActive.Width * rectBurstActive.Height);
            float centerFillPct = 0;

            if (monoAvg < 15)
            {
                screenData.BurstState = EBurstState.Active;
            }
            else
            {
                centerFillPct = ScreenshotUtilities.CountFillPct(bitmap, rectBurstCenter, matchBurstCenter);
                if (centerFillPct > 0.75f)
                {
                    screenData.BurstState      = EBurstState.ReadyAndCenter;
                    screenData.BurstMarkerPctX = 0.5f;
                    screenData.BurstMarkerPctY = 0.5f;

                    if (DebugLevel >= EDebugLevel.Verbose)
                    {
                        Rectangle box = GetSpecialActionBox((int)ESpecialBox.BurstCenter);
                        DrawRectangle(bitmap, box.X, box.Y, box.Width, box.Height, 255);
                    }
                }
                else
                {
                    ScanBurstPosition(bitmap, screenData);

                    if (DebugLevel >= EDebugLevel.Verbose && screenData.BurstState == EBurstState.Ready)
                    {
                        Rectangle box = GetSpecialActionBox((int)ESpecialBox.BurstReady);
                        DrawRectangle(bitmap, box.X, box.Y, box.Width, box.Height, 255);
                    }
                }
            }

            if (DebugLevel >= EDebugLevel.Simple)
            {
                Console.WriteLine("{0} ScanBurst: {1}", ScannerName, screenData.BurstState);
            }
            if (DebugLevel >= EDebugLevel.Verbose)
            {
                Console.WriteLine(">> monoAvg: {0}, centerFillPct: {1}", monoAvg, centerFillPct);
            }
        }
Beispiel #2
0
        protected void ScanBurst(FastBitmapHSV bitmap, ScreenData screenData)
        {
            var centerFillPct = ScreenshotUtilities.CountFillPct(bitmap, rectBurstCenter, matchBurstCenter);

            screenData.hasBurstInCenter = centerFillPct > 0.75f;

            if (DebugLevel >= EDebugLevel.Simple)
            {
                Console.WriteLine("{0} ScanBurst: {1}", ScannerName, screenData.hasBurstInCenter);
            }
            if (DebugLevel >= EDebugLevel.Verbose)
            {
                Console.WriteLine(">> centerFillPct: {0}", centerFillPct);
            }
        }
Beispiel #3
0
        protected void ScanSummonSelector(FastBitmapHSV bitmap, ScreenDataBase screenData)
        {
            var avgPx          = ScreenshotUtilities.GetAverageColor(bitmap, rectSummonSelectorA);
            var iconFillPct    = ScreenshotUtilities.CountFillPct(bitmap, rectSummonSelectorB, matchSummonIcon);
            var isAvgMatching  = matchSummonBack.IsMatching(avgPx);
            var isIconMatching = (iconFillPct > 0.10f) && (iconFillPct < 0.35f);

            screenData.hasSummonSelection = isAvgMatching && isIconMatching;

            if (DebugLevel >= EDebugLevel.Simple)
            {
                Console.WriteLine("{0} ScanSummonSelector: {1}", ScannerName, screenData.hasSummonSelection);
            }
            if (DebugLevel >= EDebugLevel.Verbose)
            {
                Console.WriteLine("  avgPx: ({0}) vs ({1}) => {2}, fillIcon: {3} => {4}",
                                  avgPx, matchSummonBack, isAvgMatching,
                                  iconFillPct, isIconMatching);
            }
        }