예제 #1
0
 private void button3_Click(object sender, EventArgs 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(1000);
     AppProcess.Tap(new Point(400, 660));
     System.Threading.Thread.Sleep(1000);
     AppProcess.Tap(new Point(400, 200));
     System.Threading.Thread.Sleep(1000);
     AppProcess.Tap(new Point(600, 800));
     System.Threading.Thread.Sleep(1000);
     AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
     System.Threading.Thread.Sleep(1000);
     AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
     System.Threading.Thread.Sleep(1000);
     AppProcess.SendKey(AndroidKeys.KEYCODE_BACK);
     System.Threading.Thread.Sleep(500);
     AppProcess.EnableRotation();
     System.Threading.Thread.Sleep(500);
     AppProcess.OpenGame();
     System.Threading.Thread.Sleep(10000);
     AppProcess.Swipe(new Point(1200, 700), new Point(100, 0), 500);
 }
예제 #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);
        }