Ejemplo n.º 1
0
 public override void Invoke(bool isSimulate, bool async)
 {
     log.Debug(this.ToString());
     StateContainer.EnterPlanetary();
     if (isSimulate)
     {
         sim.Mouse.MoveMouseTo(795 * xf, 79 * yf).Sleep(100).LeftButtonClick().Sleep(500);
     }
 }
Ejemplo n.º 2
0
        public override void Invoke(bool isSimulate, bool async)
        {
            log.Debug(this.ToString());
            bool saveScreen;

            Boolean.TryParse(StateContainer.ini.Read("saveScreen", "Settings"), out saveScreen);
            Uri proofImg = new Uri(Environment.CurrentDirectory + @"\proofImg\planetary.bmp");

            planetaryProof = new BitmapImage(proofImg);
            StateContainer.EnterPlanetary();
            int  tries   = 0;
            bool loading = false;

            System.Drawing.Bitmap   bmpScreenshot;
            System.Drawing.Graphics gfx;
            if (isSimulate)
            {
                if (Point.X < StateContainer.ExtentMin.X || Point.Y < StateContainer.ExtentMin.Y ||
                    Point.X > StateContainer.ExtentMax.X || Point.Y < StateContainer.ExtentMax.Y)
                {
                    GalaxyMovingCommand moving = new GalaxyMovingCommand(Point);
                    moving.StateContainer = StateContainer;
                    moving.Invoke(isSimulate, async);
                }
                Point target = new Point();
                target.X = Point.X - StateContainer.ExtentMin.X + 15;
                target.Y = Point.Y - StateContainer.ExtentMin.Y + 67;
                sim.Mouse.MoveMouseTo(target.X * xf, target.Y * yf).Sleep(500);
                sim.Mouse.LeftButtonClick();
                while (!loading)
                {
                    tries++;
                    if (tries > 30)
                    {
                        break;
                    }
                    sim.Mouse.Sleep(5000);
                    bmpScreenshot = new System.Drawing.Bitmap(145, 23, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                    gfx           = System.Drawing.Graphics.FromImage(bmpScreenshot);
                    gfx.CopyFromScreen(32, 32, 0, 0,
                                       System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size,
                                       System.Drawing.CopyPixelOperation.SourceCopy);
                    loading = Utils.Compare(Utils.BitmapImage2Bitmap(planetaryProof), bmpScreenshot);
                    log.Debug("Loading...");
                    if (loading)
                    {
                        break;
                    }
                    else if (saveScreen)
                    {
                        Utils.saveScreen(Environment.CurrentDirectory + @"\planetaryTry", bmpScreenshot);
                    }
                }
            }
        }