Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

附上python3 mac测试成功代码 #4

Closed
barrer opened this issue Dec 29, 2017 · 34 comments
Closed

附上python3 mac测试成功代码 #4

barrer opened this issue Dec 29, 2017 · 34 comments

Comments

@barrer
Copy link

barrer commented Dec 29, 2017

python2的库mac安装有问题
python3一切完美

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from PIL import Image
import math
import time
import os

def pull_screenshot():
    os.system('adb shell screencap -p /sdcard/1.png')
    os.system('adb pull /sdcard/1.png .')

def jump(distance):
    press_time = distance * 1.35
    press_time = int(press_time)
    cmd = 'adb shell input swipe 320 410 320 410 ' + str(press_time)
    print(cmd)
    os.system(cmd)

fig = plt.figure()
index = 0
cor = [0, 0]

pull_screenshot()
img = np.array(Image.open('1.png'))

update = True 
click_count = 0
cor = []

def update_data():
    return np.array(Image.open('1.png'))

im = plt.imshow(img, animated=True)


def updatefig(*args):
    global update
    if update:
        time.sleep(1.5)
        pull_screenshot()
        im.set_array(update_data())
        update = False
    return im,

def onClick(event):      
    global update    
    global ix, iy
    global click_count
    global cor

    # next screenshot
    
    ix, iy = event.xdata, event.ydata
    coords = []
    coords.append((ix, iy))
    print('now = ', coords)
    cor.append(coords)
    

    click_count += 1
    if click_count > 1:
        click_count = 0
        
        cor1 = cor.pop()
        cor2 = cor.pop()

        distance = (cor1[0][0] - cor2[0][0])**2 + (cor1[0][1] - cor2[0][1])**2 
        distance = distance ** 0.5
        print('distance = ', distance)
        jump(distance)
        update = True
        


fig.canvas.mpl_connect('button_press_event', onClick)
ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
plt.show()
@barrer
Copy link
Author

barrer commented Dec 29, 2017

安装python3
安装引用库
pip3 install matplotlib
pip3 install Pillow
然后开始游戏
然后运行python3 wechat_jump.py
点击目标点击黑感叹号底部中心, done!

@zhuweiyou
Copy link

我的 2.x 各种报错。按照你说的装 3 试一下看看

@hidetag
Copy link

hidetag commented Dec 29, 2017

分辨率适配有点问题

@zhuweiyou
Copy link

成功了,根据我自己的手机调整了一下系数,现在刷到好友第一了。

@Fennay
Copy link

Fennay commented Dec 29, 2017

@zhuweiyou 请问下,如何调整呢

@zhuweiyou
Copy link

@Fennay distance * 1.5 我改的 1.5 刚好符合我的手机。。你调整这个值,测试下就行了

@Fennay
Copy link

Fennay commented Dec 29, 2017

@zhuweiyou
adb shell input swipe 320 410 320 410 509
3035 KB/s (31102 bytes in 0.010s)
卡这里了,已经修改为1.5
手机是红米3s,分辨率是1280*720
还会有别的影响吗...

@vuuihc
Copy link

vuuihc commented Dec 29, 2017

@Fennay MIUI8之后的小米手机需要打开USB调试(安全调试)

@wangshub
Copy link
Owner

@qianbiTH
Copy link

可以的

@jkzing
Copy link

jkzing commented Dec 29, 2017

MIX2参数设成1.4最佳😎

@jiangzhibin
Copy link

iPhone 只能看看,好想去秀秀

@Fly-Bird
Copy link

小米5s经过调试完美运行

@iMLe0n
Copy link

iMLe0n commented Dec 29, 2017

所以这个到底怎么玩啊,求详细教程

@Akihi777
Copy link

有没有 纯小白教程?

@sqrtqiezi
Copy link

坚果手机,把参数调整为:

adb shell input swipe 320 410 320 930

即可

@Fennay
Copy link

Fennay commented Dec 29, 2017

@vuuihc 感谢,开启调试后,完美运行

@ingShen
Copy link

ingShen commented Dec 29, 2017

@vuuihc 多谢老哥 红米手机已ok。

@keytodoor
Copy link

mac 上python3.6 onClick(event)函数没有被调用啊 大神 刚接触python

@18o
Copy link

18o commented Dec 29, 2017

三星s7 edge系数调到1.05正好

@1soYang
Copy link

1soYang commented Dec 29, 2017

有没有老哥告诉一声s8改成什么参数效果最佳

@0312birdzhang
Copy link
Contributor

酷派大神F2 系数调为 1.98能到100多 😂
swipe值调为323 1057 323 1059可以无限重玩

@Kenmmm
Copy link

Kenmmm commented Dec 30, 2017

没发现底部的黑色感叹号啊

@Kenmmm
Copy link

Kenmmm commented Dec 30, 2017

@sqrtqiezi 我是坚果 Pro,调成这个参数发现也没用啊

@whiyc
Copy link

whiyc commented Dec 30, 2017

多谢老哥,有一点点误差,2个小瓶子之间操作不好容易翻车

@jing36
Copy link

jing36 commented Dec 30, 2017

运行之后有两个错误
img =np.array(Image.open('1.png'))
还有FileNotFoundError: [Errno 2] No such file or directory: '1.png'

@a905139429
Copy link

Traceback (most recent call last):
File "", line 1, in
NameError: name 'plt' is not defined

@a905139429
Copy link

Traceback (most recent call last):
File "", line 1, in
NameError: name 'plt' is not defined 怎么板

@hopesala
Copy link

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x1163f40f0>: Failed to establish a new connection: [Errno 61] Connection refused',))

mac os下 python3.6

@KinmoCode
Copy link

iPhone 7 plus跳一步之后界面刷新不完整,有大佬遇到过么,求解决方法。

@ValentinZhao
Copy link

赞赞赞~!

wangshub pushed a commit that referenced this issue Dec 31, 2017
@kuiblog
Copy link

kuiblog commented Jan 2, 2018

我的设备是 Mac,目前Mac+iPhone和Mac+Android 都成功了,大家可以参考下这篇文章:http://kuiblog.com/archives/402/

@chengkunlun
Copy link

安装web的时候,运行会报缺少依赖库的问题,有遇见过得吗?

@MrLevo520
Copy link
Collaborator

  1. 请使用最新版代码
  2. 使用adb免配置版本
  3. 使用最新版release app一键起跳https://github.com/wangshub/wechat_jump_game/releases
    下次请规范提交issue,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests