예제 #1
0
 public static void OpenOffersWindow()
 {
     Tap(ConfigReader.GetPoint("touch", "prepare"));
     //Tap(new Point(850, 130));
 }
예제 #2
0
        private void bwResetAdId_DoWork(object sender, DoWorkEventArgs e)
        {
            AppProcess.CloseGame();
            System.Threading.Thread.Sleep(500);
            AppProcess.DisableRotation();
            System.Threading.Thread.Sleep(500);
            AppProcess.OpenSettings();
            System.Threading.Thread.Sleep(1000);
            //AppProcess.Swipe(new Point(100, 800), new Point(100, 100), 500);
            System.Threading.Thread.Sleep(1000);
            //AppProcess.Tap(new Point(400, 600));
            //System.Threading.Thread.Sleep(500);
            //AppProcess.Tap(new Point(400, 660));
            //System.Threading.Thread.Sleep(500);


            AppProcess.Tap(ConfigReader.GetPoint("touch", "reset-id"));
            //AppProcess.Tap(new Point(400, 200));



            System.Threading.Thread.Sleep(500);


            AppProcess.Tap(ConfigReader.GetPoint("touch", "reset-id-dialog"));
            //AppProcess.Tap(new Point(600, 800));



            System.Threading.Thread.Sleep(500);
            AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);

            //System.Threading.Thread.Sleep(500);
            //AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
            //System.Threading.Thread.Sleep(500);
            //AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);

            System.Threading.Thread.Sleep(500);
            AppProcess.EnableRotation();
            System.Threading.Thread.Sleep(500);
            AppProcess.OpenGame();
            System.Threading.Thread.Sleep(10000);


            string fileName      = "";
            string testImageTwo  = "";
            int    cnt           = 0;
            bool   whileLoopExit = false;

            while (true)
            {
                if (cnt > 5)
                {
                    whileLoopExit = true;
                    break;
                }

                System.Threading.Thread.Sleep(500);
                fileName = AppProcess.TakeSceenshot();
                System.Threading.Thread.Sleep(1000);

                //System.Threading.Timer TheTimer1 = null;
                //int t1 = 0;
                //TheTimer1 = new System.Threading.Timer((ot) =>
                //{
                //    try
                //    {
                //        TheTimer1.Dispose();
                //    }
                //    catch (Exception ex)
                //    {
                //        if (TheTimer1 != null)
                //            TheTimer1.Dispose();
                //    }

                //}, null, 1000, 100);

                testImageTwo = Globals.Temp_Dir + "\\" + fileName;


                if (ImageComparer.CompareImages(Globals.WarWindow1Image, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir,
                                                Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(new Point(740, 660));
                    continue;
                }
                else if (ImageComparer.CompareImages(Globals.WarWindow11Image, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(new Point(740, 660));
                    continue;
                }

                else if (ImageComparer.CompareImages(Globals.WarWindow2Image, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(new Point(740, 630));
                    continue;
                }



                if (ImageComparer.CompareImages(Globals.PrestigeRewardsClaimImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(new Point(860, 620));
                    continue;
                }

                if (ImageComparer.CompareImages(Globals.StartGamePrestigeRewardsClaimImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(new Point(740, 620));
                    continue;
                }



                if (ImageComparer.CompareImages(Globals.FirstScene1Image, testImageTwo, Globals.AForgeConfig.CompareLevel - 0.1, Globals.Temp_Dir,
                                                Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    break;
                }



                else
                {
                    AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
                }


                cnt++;

                deleteFiles();
            }


            if (whileLoopExit == true)
            {
                fileName     = AppProcess.TakeSceenshot();
                testImageTwo = Globals.Temp_Dir + "\\" + fileName;
                if (ImageComparer.CompareImages(Globals.ExitImage, testImageTwo, Globals.AForgeConfig.CompareLevel + 0.01,
                                                Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
                }

                deleteFiles();
            }


            AppProcess.Swipe(new Point(1200, 700), new Point(100, 0), 500);
        }
예제 #3
0
 public static void RunOffer()
 {
     //Tap(new Point(600, 550));
     Tap(ConfigReader.GetPoint("touch", "offers"));
 }
예제 #4
0
        private void bwPlayAndWatchAds_DoWork(object sender, DoWorkEventArgs e)
        {
            int    sleepTime    = 0;
            string msg          = "";
            string fileName     = "";
            string testImageTwo = "";

            if (AppProcess.isAppRunning() == false)
            {
                Globals.AppNotRunningInARow++;
                return;
            }



            if (AppProcess.isAdActivity() == true)
            {
                if (ToAddAsWatched == true)
                {
                    Globals.WatchedAds++;
                    Globals.NoOffersInARow     = 0;
                    ToAddAsWatched             = false;
                    Globals.LoadingTriesInARow = 0;
                    Globals.ElseInARow         = 0;
                    startDate = DateTime.Now;
                }

                AppProcess.Wait();
                Globals.ElseInARow++;
                sleepTime = 2000;

                msg = DateTime.Now + " " + "else 2000 diffs : " + DateTime.Now.Subtract(startDate).Seconds + "";
                Globals.MainLogs.Add(msg);


                System.Threading.Thread.Sleep(2000);

                if (DateTime.Now.Subtract(startDate).Seconds > 35)
                {
                    fileName     = AppProcess.TakeSceenshot();
                    testImageTwo = Globals.Temp_Dir + "\\" + fileName;
                    System.Drawing.Image imageOne;
                    using (var bmpTemp = new Bitmap(testImageTwo))
                    {
                        imageOne = new Bitmap(bmpTemp);
                    }

                    if (imageOne.Size.Width == Globals.ScreenSize.Height)
                    {
                        AppProcess.Tap(new Point(650, 50));
                        //AppProcess.Tap(ConfigReader.GetPoint("touch", "no-close-issue-port"));
                    }
                    else
                    {
                        AppProcess.Tap(new Point(1360, 50));
                        //AppProcess.Tap(ConfigReader.GetPoint("touch", "no-close-issue-land"));
                    }

                    Globals.ElseInARow = 0;
                    msg = DateTime.Now + " " + "tap close button 0000";
                    Logger.WriteLog(msg);
                    Globals.MainLogs.Add(msg);
                    //return;
                }
            }
            else
            {
                fileName = AppProcess.TakeSceenshot();
                //System.Threading.Thread.Sleep(1000);
                //System.Threading.Timer TheTimer1 = null;
                //int t1 = 0;
                //TheTimer1 = new System.Threading.Timer((ot) =>
                //{
                //    try
                //    {
                //        TheTimer1.Dispose();
                //    }
                //    catch (Exception ex)
                //    {
                //        if (TheTimer1 != null)
                //            TheTimer1.Dispose();
                //    }

                //}, null, 1000, 100);
                testImageTwo = Globals.Temp_Dir + "\\" + fileName;
                //System.Threading.Thread.Sleep(1000);
                if (ImageComparer.CompareImages(Globals.OfferImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    ToAddAsWatched = true;
                    AppProcess.RunOffer();
                    int time = random.Next(10000, 20000);
                    sleepTime = time;
                    msg       = DateTime.Now + " offers " + time;
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.NoOfferImage, testImageTwo, Globals.AForgeConfig.CompareLevel + 0.01, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    Globals.NoOffersInARow++;
                    Globals.LoadingTriesInARow = 0;
                    Globals.ElseInARow         = 0;
                    AppProcess.CloseNoOfferWindow();
                    sleepTime = 2000;
                    msg       = DateTime.Now + " " + "no offer 2000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.LoadingImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    Globals.LoadingTriesInARow++;
                    Globals.ElseInARow = 0;

                    sleepTime = 2000;
                    msg       = DateTime.Now + " " + "loading 2000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.EndOfferImage, testImageTwo, Globals.AForgeConfig.CompareLevel + 0.03, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    Globals.NoOffersInARow     = 0;
                    Globals.LoadingTriesInARow = 0;
                    Globals.ElseInARow         = 0;
                    //Globals.WatchedAds++;
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "end of offer 1000";
                    Globals.MainLogs.Add(msg);
                    AppProcess.CloseEndOfOfferWindow();
                }
                else if (ImageComparer.CompareImages(Globals.IntroImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    Globals.NoOffersInARow     = 0;
                    Globals.LoadingTriesInARow = 0;
                    Globals.ElseInARow         = 0;
                    //Globals.WatchedAds++;
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "crashed 1000";
                    Globals.MainLogs.Add(msg);
                    Globals.GameCrashed = true;
                }

                else if (ImageComparer.CompareImages(Globals.PrepareImage, testImageTwo, Globals.AForgeConfig.CompareLevel - 0.10, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.OpenOffersWindow();
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "prepare 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.PrestigeRewardsImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    //AppProcess.Tap(ConfigReader.GetPoint("touch", "pr-rewards"));
                    AppProcess.Tap(new Point(740, 500));
                    System.Threading.Thread.Sleep(500);
                    //AppProcess.Tap(ConfigReader.GetPoint("touch", "pr-rewards"));
                    AppProcess.Tap(new Point(740, 500));
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "prestige rewards 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.PrestigeRewardsClaimImage, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    //AppProcess.Tap(ConfigReader.GetPoint("touch", "pr-rewards-claim"));
                    AppProcess.Tap(new Point(860, 620));
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "prestige rewards claim 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.WarWindow1Image, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    //AppProcess.Tap(ConfigReader.GetPoint("touch", "war-window-1"));
                    AppProcess.Tap(new Point(740, 660));
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "war window 1 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.WarWindow2Image, testImageTwo, Globals.AForgeConfig.CompareLevel, Globals.Temp_Dir, Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Tap(ConfigReader.GetPoint("touch", "war-window-2"));
                    //AppProcess.Tap(new Point(740, 630));
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "war window 2 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.FirstScene1Image, testImageTwo, Globals.AForgeConfig.CompareLevel - 0.1, Globals.Temp_Dir,
                                                     Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Swipe(new Point(1200, 700), new Point(100, 0), 500);
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "first screen 1 1000";
                    Globals.MainLogs.Add(msg);
                }
                else if (ImageComparer.CompareImages(Globals.FirstScene2Image, testImageTwo, Globals.AForgeConfig.CompareLevel - 0.1, Globals.Temp_Dir,
                                                     Globals.AForgeConfig.SimilarityThreshold) == true)
                {
                    AppProcess.Swipe(new Point(1200, 700), new Point(100, 0), 500);
                    sleepTime = 1000;
                    msg       = DateTime.Now + " " + "first screen 2 1000";
                    Globals.MainLogs.Add(msg);
                }
                else
                {
                    AppProcess.Wait();
                    Globals.ElseInARow++;
                    sleepTime = 2000;
                    msg       = DateTime.Now + " " + "else 2000";
                    Globals.MainLogs.Add(msg);
                }
            }



            //if (Globals.ElseInARow > 20)
            //{
            //    System.Drawing.Image imageOne;
            //    using (var bmpTemp = new Bitmap(testImageTwo))
            //    {
            //        imageOne = new Bitmap(bmpTemp);
            //    }

            //    if (imageOne.Size.Width == Globals.ScreenSize.Height)
            //    {
            //        AppProcess.Tap(new Point(650, 50));
            //    }
            //    else
            //    {
            //        AppProcess.Tap(new Point(1360, 50));
            //    }

            //    Globals.ElseInARow = 0;
            //    Logger.WriteLog(DateTime.Now + " " + "tap close button 0000");
            //    //return;
            //}
            //System.Threading.Thread.Sleep(sleepTime);



            //System.Threading.Timer TheTimer = null;
            //int t = 0;
            //TheTimer = new System.Threading.Timer((ot) =>
            //{
            //    try
            //    {
            //        TheTimer.Dispose();
            //    }
            //    catch (Exception ex)
            //    {
            //        if (TheTimer != null)
            //            TheTimer.Dispose();

            //    }


            //}, null, sleepTime, 1000);

            Logger.WriteLog(msg);

            deleteFiles();
        }