Exemplo n.º 1
0
        public List<PuzzleGear> GetGears()
        {
            var gears = new List<PuzzleGear>();

            var windowContents = AutoIt.GetWindowImage();

            foreach (var entry in _letterSearchAreaTesseractArea)
            {
                PuzzleGear gear = null;

                var searchArea = windowContents.Copy(entry.Key);
                if (AutoIt.IsTemplateInWindow(searchArea, _largeWildcardGear).Success)
                {
                    gear = new PuzzleGear(
                        '*',
                        PuzzleGearSize.Large | PuzzleGearSize.Small,
                        PuzzleGearColor.Copper | PuzzleGearColor.Silver | PuzzleGearColor.Gold,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _smallWildcardGear).Success)
                {
                    gear = new PuzzleGear(
                        '*',
                        PuzzleGearSize.Large | PuzzleGearSize.Small,
                        PuzzleGearColor.Copper | PuzzleGearColor.Silver | PuzzleGearColor.Gold,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _largeCopperGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Large,
                        PuzzleGearColor.Copper,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _smallCopperGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Small,
                        PuzzleGearColor.Copper,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _largeSilverGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Large,
                        PuzzleGearColor.Silver,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _smallSilverGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Small,
                        PuzzleGearColor.Silver,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _largeGoldGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Large,
                        PuzzleGearColor.Gold,
                        entry.Value);
                }
                else if (AutoIt.IsTemplateInWindow(searchArea, _smallGoldGear).Success)
                {
                    gear = new PuzzleGear(
                        GetLetterForGear(searchArea),
                        PuzzleGearSize.Small,
                        PuzzleGearColor.Gold,
                        entry.Value);
                }

                if (gear != null)
                {
                    gears.Add(gear);
                }
            }

            Logger.Debug(
                "Detected gears - count={0}, gears={1}",
                gears.Count,
                String.Join(" ", gears));

            return gears;
        }
Exemplo n.º 2
0
        public void Trash(PuzzleGear gear)
        {
            Logger.Debug("Trashing gear - gear={1}", gear.ToString());

            AutoIt.Click(gear.PickupArea);
            AutoIt.Click(_trash);
            AutoIt.WaitAfterInput();
            _trashConfirm.Click();
        }
Exemplo n.º 3
0
        public void ApplyTool(PuzzleTool tool, PuzzleGear gear)
        {
            Logger.Debug(
                "Applying tool - tool={0}, gear={1}",
                tool.ToString(),
                gear.ToString());

            AutoIt.Click(tool.PickupArea);
            AutoIt.Click(gear.PickupArea);

            Thread.Sleep(2500);
        }