. net development and implementation of a wechat jump a jump auxiliary program

Time:2020-7-4

preface

I believe you should all know that wechat has been updated recently, and there is a small game called “jump”. After playing for a while, it is quite interesting But it’s pure hand feeling. After playing for a long time, I finally got 135 points and won the first place. I didn’t expect to be brushed down by my friends after a while, and the highest one was about 200 points. So I thought that it would be good to develop an assistant, so I simply thought about the highest game

First, let’s talk about the interface and rules of the game

Let’s look at the interface first

Rules:

Press and hold the screen and release it for a certain time to jump. If you jump to the front pattern, you will get 1 point. If you press the middle of the picture, you will get 2 points (for example, the first 2 points, the second 4 points, the third 6 points, the highest cumulative 32 points) is not explained in other rules

After sorting out the implementation principle, it is actually quite simple: calculate the distance between the black bottom and the middle of the pattern, and then debug the time. After adjusting the time, calculate the best time X of a pixel, and then test the distance from the black bottom to the center of the pattern * x is the best time

When the theoretical knowledge is good, let’s practice it

1. First get the picture of the mobile phone screen and display it in the WinForm program

2. Let the customer click on the black bottom and the center of the pattern (it seems a little difficult to get these two points according to the picture, at least my technical difficulty now)

3. How long does the mimic screen press and hold

To get screen images, we can use Android’s adb.exe To get, but I am not familiar with this thing, baidu on a few commands 1, screen capture command 2 transmission command and simulation sliding command

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 is time

Well, the implementation of the method also found on the code bar

Functions that execute the ADB command

/// <summary>
  ///Execute the ADB command
  /// </summary>
  /// <param name="arguments"></param>
  /// <param name="ischeck"></param>
  /// <returns></returns>
  private string cmdAdb(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;
  }

//Picture click events

/// <summary>
  ///Black bottom position
  /// </summary>
  Point Start;
  /// <summary>
  ///Pattern center or white spot position
  /// </summary>
  Point End;
  private void pictureBox1_Click(object sender, EventArgs e)
  {
   var me = ((System.Windows.Forms.MouseEventArgs)(e));
   if ( me.Button==MouseButtons . left) // pressing the left button is the coordinates of the black bottom
   {
    Start = ((System.Windows.Forms.MouseEventArgs)(e)).Location;
   }
   else if ( me.Button  = = MouseButtons.Right )//Pressing the right button is the black bottom coordinates
   {
    End = ((System.Windows.Forms.MouseEventArgs)(e)).Location;
    //Calculate the direct 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 time: {1} ", value, (3.999022243950134 * value). ToString (" 0 ")); 
    //3.999022243950134 this is the best time for me to get this resolution after many simulations
    cmdAdb(string.Format("shell input swipe 100 100 200 200 {0}", (3.999022243950134 * value).ToString("0")));
   }
  }

In this way, the core code is completed, isn’t it easy to hurry up..

Finally, the effect is released. (unfortunately, I took a screen shot when my female ticket holder was cheap. During the screen capture, my hand touched the screen, which caused me to press down and jump. Otherwise, I would have to brush to 1W points, ha ha.)

I estimate that this score is more heartbroken to play with pure hands, ha ha ha, the first place in the circle of friends

Finally give the source code

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

Local download: http://xiazai.jb51.net/201801/yuanma/ShowAndroidModel (jb51.net).rar

summary

The above is the whole content of this article, I hope that the content of this article has a certain reference learning value for your study or work, if you have any questions, you can leave a message to exchange, thank you for your comments on developpaer