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

该博客介绍了如何利用Python的aircv模块,通过找图功能实现红警OL游戏的资源自动采集。核心在于find_template()函数的应用。
摘要由CSDN通过智能技术生成
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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值