. NET Development and implementation of a WeChat hop Helper Program,. net assistance

Source: Internet
Author: User

. NET development to implement a skip-to-one helper program,. net assistance

Preface

I believe everyone knows that it has been updated recently. There is a small game called "One hop". It's quite interesting to have a quick start, but it's just a bit of a fight. It's been a long time, I finally got the first place with a score of 135. I didn't expect it to be brushed down by my friends in a short time. The highest score would be 200 points, so I thought it would be nice to develop a helper, so I simply thought about the top game.

Let's talk about the interface and rules of this game:

First look at the interface

Rules:

Press and hold the screen and press it for a certain period of time to jump, jump to the front of the pattern to get 1 point, the graph is calculated by 2 points in the middle (for multiple consecutive medians, add 2 points, for example, the first 2 points, the second 4 points, the third 6 points, and the maximum 32 points. Other rules are not clear.

After finishing the implementation principle, it is actually quite simple: calculate the distance from the bottom of the black person to the middle of the pattern, and then debug the time. After the time is adjusted, calculate the best time X for a pixel, then, the best time is to test the distance from the black bottom to the pattern center * X.

Practice the theoretical knowledge.

1. First, you must obtain the pictures on the mobile phone screen and display them in the winform program.

2. Ask the customer to click on the black bottom and the pattern Center (it seems a little difficult to get these two points based on the image, at least my current technical difficulties)

3. How long does it take to press and hold the screen?

We can use Android's adb.exe to retrieve screen images. However, I am not familiar with this. I have Baidu commands 1. screenshot command 2 transmission commands and simulated slide commands.

adb shell /system/bin/screencap -p /sdcard/screenshot.png(Save to SDCard)

adb pull /sdcard/screenshot.png d:/screenshot.png(Save to computer)

adb shell input swipe 250 250 300 300 100 The first four are coordinates, and the last one is time.

Okay. The implementation method is also found. Just code it.

Function for executing the adb command

/// <Summary> /// execute the adb command /// </summary> /// <param name = "arguments"> </param> /// <param name = "ischeck"> </param> // <returns> </returns> private string javasadb (string arguments, bool ischeck = true) {if (ischeck &&! HasAndroid) {return string. empty;} string ret = string. empty; using (Process p = new Process () {p. startInfo. fileName = Program. adbPath; // @ "C: \ Android \ sdk \ platform-tools \ adb.exe"; p. startInfo. arguments = arguments; p. startInfo. useShellExecute = false; p. startInfo. redirectStandardInput = true; // redirect standard input p. startInfo. redirectStandardOutput = true; // redirect standard output p. startInfo. redirectStandardError = true; // redirect error output p. startInfo. createNoWindow = true; p. start (); ret = p. standardOutput. readToEnd (); p. close ();} return ret ;}

// Image Click Event

/// <Summary> /// black bottom position /// </summary> Point Start; /// <summary> /// specifies the center or white Point of the image. /// </summary> Point End; private void picturebox#click (object sender, EventArgs e) {var me = (System. windows. forms. mouseEventArgs) (e); if (me. button = MouseButtons. left) // press the Left button to indicate the coordinates of the Black Bottom {Start = (System. windows. forms. mouseEventArgs) (e )). location;} else if (me. button = MouseButtons. right) // Right-click the coordinates at the bottom of the black circle {End = (System. windows. forms. mouseEventArgs) (e )). location; // calculate the distance between two points. double value = Math. sqrt (Math. abs (Start. x-End. x) * Math. abs (Start. x-End. x) + Math. abs (Start. y-End. y) * Math. abs (Start. y-End. y); Text = string. format ("distance between two points: {0}, press the time: {1}", value, (3.999022243950134 * value ). toString ("0"); // 3.999022243950134 this is the best time for me to get this resolution after I have simulated it for multiple times cmdAdb (string. format ("shell input swipe 100 100 200 200 {0}", (3.999022243950134 * value ). toString ("0 ")));}}

In this way, the core code is completed, and it is easy to do ..

Finally, let out the results. (unfortunately, my female ticket handpiece captured the screen. When the screenshot was captured, my hand touched the screen, and then I jumped down. Otherwise, I would like to brush it to points)

I guess this score is just a hand play. It's heartbroken. Haha, the circle of friends occupies the first place. Haha

Finally, let's get the source code.

Address: https://files.cnblogs.com/files/dotnet-org-cn/tiaotitiao.rar

Http://xiazai.jb51.net/201801/yuanma/ShowAndroidModel (jb51.net).rar

Summary

The above is all the content of this article. I hope the content of this article has some reference and learning value for everyone's learning or work. If you have any questions, please leave a message to us. Thank you for your reference.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.