Skip to content
iOSDevLog cover art

iOSDevLog

iOSDevLog

A Technology podcast

Good podcast? Give it some love!

About the show

iOS开发

Newest episodes

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

3 min

成果1077跳一跳微信小程序可以玩游戏了,我们来破解一下《跳一跳》这个官方出品的小游戏吧。思路用usb调试安卓手机,用adb截图并用鼠标测量距离,然后计算按压时间后模拟按压。$ adb shell input swipe [duration(ms)] (Default: touchscreen) # 模拟长按$ adb shell screencap # 保存截屏到手机$ adb pull /sdcard/screen.png # 下载截屏文件到本地得到手指按的时间 t时间 = 距离 / 速度(常量) t = L / kL = p2 - p1获取到起始点和结束点的坐标源码开发环境: Kotlin, IetelliJ IDEAhttps://github.com/iOSDevLog/JumpJump主要源码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...

Similar podcasts

All episodes

The newest 50 of 910 episodes

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

3 min

成果1077跳一跳微信小程序可以玩游戏了,我们来破解一下《跳一跳》这个官方出品的小游戏吧。思路用usb调试安卓手机,用adb截图并用鼠标测量距离,然后计算按压时间后模拟按压。$ adb shell input swipe [duration(ms)] (Default: touchscreen) # 模拟长按$ adb shell screencap # 保存截屏到手机$ adb pull /sdcard/screen.png # 下载截屏文件到本地得到手指按的时间 t时间 = 距离 / 速度(常量) t = L / kL = p2 - p1获取到起始点和结束点的坐标源码开发环境: Kotlin, IetelliJ IDEAhttps://github.com/iOSDevLog/JumpJump主要源码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...

886. 大教堂与集市-大教堂与集市-2

43 min

《大教堂与集市​》内容比较多,后面的就打算不再录制了,喜欢的小伙伴们还是看书吧!有想听的可以留言,如果还有人要听,我就再把后面的录了。

See all 200 episodes

–

0 ratings from members

5
4
3
2
1

Rate this podcast

Log in to rate and review the shows you listen to.

No reviews yet — be the first member to rate "iOSDevLog".

This podcast, its content and its artwork are not owned by, affiliated with, or endorsed by Castquire.

Keep listening

Discover more podcasts like this.

Up next

  1. Nothing queued. Use + Queue on any episode to line it up.

0:00 0:00