Radio and PodcastRadio and PodcastLive Radio & Podcasts
910. 用Kotlin破解Android版微信小游戏-跳一跳 artwork
Technology

910. 用Kotlin破解Android版微信小游戏-跳一跳

iOSDevLog by iOSDevLog

Dec 29, 20173:29Technology

成果 1077 跳一跳 微信小程序可以玩游戏了,我们来破解一下《跳一跳》这个官方出品的小游戏吧。 思路 用usb调试安卓手机,用adb截图并用鼠标测量距离,然后计算按压时间后模拟按压。 $ adb shell input swipe [duration(ms)] (Default: touchscreen) # 模拟长按 $ adb shell screencap # 保存截屏到手机 $ adb pull /sdcard/screen....

About This Episode

910. 用Kotlin破解Android版微信小游戏-跳一跳 is an episode from iOSDevLog by iOSDevLog. 成果 1077 跳一跳 微信小程序可以玩游戏了,我们来破解一下《跳一跳》这个官方出品的小游戏吧。 思路 用usb调试安卓手机,用adb截图并用鼠标测量距离,然后计算按压时间后模拟按压。 $ adb shell input swipe [duration(ms)] (Default: touchscreen) # 模拟长按 $ a...

Podcast

This episode belongs to iOSDevLog.

Listen Online

Use the player on this page to stream the episode online.

Episode Details

Published Dec 29, 2017, 3:29 long, audio available.

Questions About This Episode

What is 910. 用Kotlin破解Android版微信小游戏-跳一跳 about?

成果 1077 跳一跳 微信小程序可以玩游戏了,我们来破解一下《跳一跳》这个官方出品的小游戏吧。 思路 用usb调试安卓手机,用adb截图并用鼠标测量距离,然后计算按压时间后模拟按压。 $ adb shell input swipe [duration(ms)] (Default: touchscreen) # 模拟长按 $ adb shell screencap # 保存截屏到手机 $ adb pull /sdcard/screen.png # 下载截屏文件到本地 得到手指按的时间 t 时间 = 距离 / 速度(常量) t = L / k L = p2 - p1 获取到起始点和结束点的坐标 源码 开发环境: Kotlin, IetelliJ IDEA 主要源码 fun main(args: Array ) { val jumpjump = JumpJump() var isFirst = true var firstPoint: Point? = null var secondPoint: Point? val jPanel = object : JPanel() { override fun paintComponent(g: Graphics) { super.paintComponent(g) try { var bufferedImage = ImageIO.read(File(SCREENSHOT_LOCATION)) val newImage = BufferedImage(675, 1200, bufferedImage.getType()) val gTemp = newImage.graphics gTemp.drawImage(bufferedImage, 0, 0, 675, 1200, null) gTemp.dispose() bufferedImage = newImage g.drawImage(bufferedImage, 0, 0, null) } catch (e: IOException) { e.printStackTrace() } } } jPanel.addMouseListener(object : MouseListener { override fun mouseReleased(e: MouseEvent?) { } override fun mouseEntered(e: MouseEvent?) { } override fun mouseClicked(e: MouseEvent?) { } override fun mouseExited(e: MouseEvent?) { } override fun mousePressed(e: MouseEvent?) { println("mousePressed") e.let { if (isFirst) { println("first {pomt" + e!!.x + " " + e.y) firstPoint = e.point isFirst = false } else { secondPoint = e!!.point val distance = distance(firstPoint!!, secondPoint!!) println("distance:" + distance) isFirst = true //magic number call(distance * 2.2) try { // wait for screen cap Thread.sleep(2500) } catch (e1: InterruptedException) { e1.printStackTrace() } printScreen() jPanel.validate() jPanel.repaint() } } } }) jumpjump.isVisible = true jumpjump.contentPane.add(jPanel) printScreen() jumpjump.repaint() jumpjump.validate() } fun distance(a: Point, b: Point): Int { return Math.sqrt((a.x - b.getX()) * (a.x - b.getX()) + (a.y - b.getY()) * (a.y - b.getY())).toInt() } 使用方法 在电脑上下载好adb 打开安卓手机的usb调试模式并授权连接的电脑 打开微信跳一跳,并点击开始 在Constans.kt中配置好adb路径与截图路径,运行 在弹出的窗口中先点击小人底部适当位置,然后再点想要跳的箱子的位置即可完成

Where can I listen to 910. 用Kotlin破解Android版微信小游戏-跳一跳?

You can listen to 910. 用Kotlin破解Android版微信小游戏-跳一跳 online on Radio and Podcast. Open the player on this page to stream the available audio.

Which podcast is 910. 用Kotlin破解Android版微信小游戏-跳一跳 from?

910. 用Kotlin破解Android版微信小游戏-跳一跳 is an episode from iOSDevLog by iOSDevLog.

How long is this episode?

This episode is 3:29 long.

When was this episode published?

This episode was published on Dec 29, 2017.

Can I save 910. 用Kotlin破解Android版微信小游戏-跳一跳 for later?

Yes. Use the heart button on the episode page to add it to your favorite episodes list.

Are there related episodes from iOSDevLog?

Yes. This page shows related episodes from iOSDevLog when more episodes are available from the podcast feed.

Quick Answers About This Episode

Where can I listen to 910. 用Kotlin破解Android版微信小游戏-跳一跳?

You can listen to 910. 用Kotlin破解Android版微信小游戏-跳一跳 on this page when the episode audio is available from the podcast feed.

Which podcast is this episode from?

910. 用Kotlin破解Android版微信小游戏-跳一跳 is from iOSDevLog by iOSDevLog.

What are the episode details?

Published Dec 29, 2017 and 3:29 long