コード例 #1
0
        private void AddClick(MouseEventArgs e)
        {
            if (!currentbounds.Contains(e.Location))
            {
                MouseHook.UnInstallHook();
                mode = Mode.FinishCreating;
                console.BlockInput = false;
                console.Write("Hook disabled.\r\n\r\n" +
                              "You've clicked out of seterra bounds. Do you want to finish education and save map? (y/n) -> ");
                return;
            }
            Bitmap newkey = GetKey();

            double[] mpoint = new double[] { (double)currentbounds.Width / (double)(e.X - currentbounds.X),
                                             (double)currentbounds.Width / (double)(e.Y - currentbounds.Y) };
            Point p = SearchKey(newkey);

            if (p.Y == 0)
            {
                clicks[p.X]   = mpoint;
                testkeys[p.X] = newkey;
                console.WriteLine("Old value replaced.");
            }
            else
            {
                clicks.Add(mpoint);
                testkeys.Add(newkey);
                console.WriteLine("New value added. Difference = " + p.Y);
            }
        }
コード例 #2
0
 private void SolveMap(MouseEventArgs e)
 {
     MouseHook.UnInstallHook();
     console.WriteLine("Hook disabled. Process started.\r\n");
     EmulateClick.LeftClick(e.X, e.Y);
     System.Threading.Thread.Sleep(500);
     for (int i = 0; i < testkeys.Count * 5; i++)
     {
         int ind;
         try { ind = SearchKey(GetKey()).X; }
         catch { break; }
         EmulateClick.LeftClick((int)Math.Round((double)currentbounds.Width / clicks[ind][0]) + currentbounds.X,
                                (int)Math.Round((double)currentbounds.Width / clicks[ind][1]) + currentbounds.Y);
     }
     console.Write("Done! Press \'Enter\' to continue...");
     mode = Mode.FinishSolving;
     console.BlockInput = false;
 }