Beispiel #1
0
        // When button is clicked, dueling begins
        private void button1_Click(object sender, EventArgs e)
        {
            displayText("Started.");
            CursorPath.FreezeInput();
            changeButtonColor(Color.Red);
            Bitmap bmpScreenshot    = BitmapGraphics.Screenshot();
            Bitmap initialScrenshot = BitmapGraphics.Screenshot();
            Point  location;

            CursorPath.setAnchorImage("bmpPanel2");
            CursorPath.setInitialLocation(-175, -140);

            /*var images = Properties.Resources.ResourceManager
             *         .GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true)
             *         .Cast<System.Collections.DictionaryEntry>()
             *         .Where(x => x.Value.GetType() == typeof(Bitmap))
             *         .Select(x => x.Key.ToString())
             *         .ToList();*/

            String[] panels = new String[4] {
                "bmpPanel2", "bmpPanel3", "bmpPanel4", "bmpPanel1"
            };
            bool[] skipPanels = new bool[4] {
                skipCheckbox1, skipCheckbox2, skipCheckbox3, skipCheckbox4
            };
            Delegate[] findDuelistMethods = new Delegate[4];
            findDuelistMethods[0] = new delWithNoParameters(CursorPath.duelAtGate);
            findDuelistMethods[1] = new delWithNoParameters(CursorPath.duelAtPVPArena);
            findDuelistMethods[2] = new delWithNoParameters(CursorPath.duelAtShop);
            findDuelistMethods[3] = new delWithNoParameters(CursorPath.duelAtCardStudio);

            int j = 0;
            int numberOfTimesToCheck = Int32.Parse(textBox1.Text);

            foreach (String p in panels)
            {
                Bitmap duelingZones = (Bitmap)Properties.Resources.ResourceManager.GetObject(p);

                for (int i = 0; i < numberOfTimesToCheck; i++)
                {
                    if (skipPanels[j])
                    {
                        skipPanels[j] = false;
                        break;
                    }
                    findDuelistMethods[j].DynamicInvoke();
                }
                initialScrenshot = BitmapGraphics.Screenshot();
                BitmapGraphics.FindBitMap(duelingZones, initialScrenshot, out location);
                Cursor.Position = location;
                MouseActions.MouseClick();
                BitmapGraphics.disposeGraphic(initialScrenshot);
                j++;
            }
            CursorPath.ThawInput();
            changeButtonColor(Color.LightGreen);
            displayText("Finished.");
        }
 // Clicks auto duel button
 private static void clickAutoDuelButton()
 {
     Cursor.Position = location;
     MouseActions.MouseClick();
     BitmapGraphics.disposeGraphic(tempScreenshot);
     frm.displayText("Clicked on auto-duel.");
     CursorPath.ThawInput();
     frm.changeButtonColor(Color.LightGreen);
     Thread.Sleep(30000);
 }