Bootstrap

Python游戏辅助脚本(aircv模块)—红警OL资源自动采集

import aircv as ac
import uiautomator2 as u2
import time
import random
d=u2.connect('172.21.236.63')
def match(imsrc,imobj):
	result=ac.find_template(imsrc,imobj,0.7)
	if(result!=None):
		return result['result'][0],result['result'][1]
	return None
def click(img):
	d.screenshot("a.jpg")
	imsrc=ac.imread("C:\\Users\\bj\\Desktop\\a.jpg")
	imobj=ac.imread(img)
	if(match(imsrc,imobj)!=None):
		x,y=match(imsrc,imobj)
		print(x,y)
	#d.screenshot("a.jpg")
	try:
		d.long_click(x,y,0.5)
	except Exception as e:
		pass
def random_xy():
	x=random.uniform(0.1, 0.8)  
	y=random.uniform(0.1, 0.8)  
	z=random.uniform(0.1, 0.8)  
	w=random.uniform(0.1, 0.8)
	d.drag(x,y,z,w,0.3)
while(True):
	time.sleep(1)
	click("C:\\Users\\bj\\Desktop\\serch.jpg")
	time.sleep(2)
	click("C:\\Users\\bj\\Desktop\\search.jpg")
	time.sleep(4)
	click("C:\\Users\\bj\\De
;