forked from junbaor/wechat-jump-jump
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d120504
Showing
5 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.idea | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
### 说明 | ||
~~这可能是目前效率最高的 "跳一跳" 外挂.~~ | ||
|
||
|
||
已经不是效率最高的, AI 版已经出了, 但是算法不够最优, | ||
下功能体验的话请移步 https://github.com/faceair/youjumpijump | ||
|
||
原理: | ||
利用投屏功能, 实时显示 Android 画面, 覆盖一层 Jframe, 鼠标打点后计算距离, 利用 adb 点击屏幕触发弹跳 | ||
|
||
|
||
### 使用步骤 | ||
1. Android 和 PC 安装 Apowersoft 录屏王 | ||
2. 开启手机投屏, 打开跳一跳 | ||
3. 使用 java -jar wechat-jump-jump.jar 运行 | ||
4. 输入投屏的宽、高、跳跃系数 | ||
5. 将半透明窗体覆盖到录屏王上方 | ||
6. 在电脑上点击第一个小方块和第二个小方块 | ||
7. 继续点 | ||
|
||
|
||
### 优势 | ||
|
||
利用投屏的优势, 减少 adb 拉取手机截屏的耗时 | ||
|
||
### 截图 | ||
|
||
 | ||
|
||
### 参考 | ||
https://github.com/wangshub/wechat_jump_game | ||
https://github.com/Chaaang/wechat_jumpandjump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.junbaor</groupId> | ||
<artifactId>wechat-jump</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>wechat-jump-jump</name> | ||
<url>https://github.com/junbaor/wechat-jump-jump</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>1.2.1</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<finalName>wechat-jump-jump</finalName> | ||
<transformers> | ||
<transformer | ||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>com.junbaor.jump.WechatJump</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package com.junbaor.jump; | ||
|
||
import com.sun.awt.AWTUtilities; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.MouseEvent; | ||
import java.awt.event.MouseListener; | ||
import java.io.IOException; | ||
import java.util.Scanner; | ||
|
||
public class WechatJump extends JFrame { | ||
public static double COEFFICIENT; | ||
private static boolean first = true; | ||
private static Point point1; | ||
private static Point point2; | ||
|
||
public WechatJump(int width, int height, double coefficient) { | ||
setSize(width, height); | ||
COEFFICIENT = coefficient; | ||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | ||
} | ||
|
||
public static void main(String[] args) { | ||
//526 946 2.9 | ||
System.out.println("请确保你可以执行 adb 命令,配置好环境变量"); | ||
System.out.println("可以利用 QQ 截图工具测量投屏界面的宽和高\n"); | ||
System.out.println("输入屏幕的宽(整数):"); | ||
Scanner scanner = new Scanner(System.in); | ||
int width = scanner.nextInt(); | ||
System.out.println("输入屏幕的高(整数):"); | ||
int height = scanner.nextInt(); | ||
System.out.println("输入跳跃系数(小数):"); | ||
double coefficient = scanner.nextDouble(); | ||
|
||
WechatJump.setDefaultLookAndFeelDecorated(true); | ||
final WechatJump appJFrameJframe = new WechatJump(width, height, coefficient); | ||
AWTUtilities.setWindowOpacity(appJFrameJframe, 0.4f); | ||
appJFrameJframe.setVisible(true); | ||
appJFrameJframe.setAlwaysOnTop(true); | ||
|
||
appJFrameJframe.addMouseListener(new MouseListener() { | ||
public void mouseClicked(MouseEvent e) { | ||
Point currentPoint = e.getPoint(); | ||
if (first) { | ||
System.out.print("起跳点 "); | ||
point1 = currentPoint; | ||
first = false; | ||
} else { | ||
System.out.print("落点 "); | ||
point2 = currentPoint; | ||
int distance = distance(point1, point2); | ||
onClickPhone(distance * COEFFICIENT); | ||
first = true; | ||
} | ||
System.out.println(e.getX() + " " + e.getY()); | ||
} | ||
|
||
public void mousePressed(MouseEvent e) { | ||
|
||
} | ||
|
||
public void mouseReleased(MouseEvent e) { | ||
|
||
} | ||
|
||
public void mouseEntered(MouseEvent e) { | ||
|
||
} | ||
|
||
public void mouseExited(MouseEvent e) { | ||
|
||
} | ||
}); | ||
|
||
} | ||
|
||
|
||
public static void onClickPhone(double timeMilli) { | ||
try { | ||
Runtime.getRuntime().exec("adb shell input touchscreen swipe 170 187 170 187 " + (int) timeMilli); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
/** | ||
* 计算两点距离 | ||
* | ||
* @param a | ||
* @param b | ||
* @return | ||
*/ | ||
public static int distance(Point a, Point b) { | ||
return (int) Math.sqrt((a.x - b.getX()) * (a.x - b.getX()) + (a.y - b.getY()) * (a.y - b.getY())); | ||
} | ||
} |