refactor(task): 用资源文件和HintPoint代替club_reward中硬编码的坐标

This commit is contained in:
YXHXianYu 2025-03-14 12:43:21 +08:00
parent 0b3e55e9b2
commit 818acb6ec5
4 changed files with 14 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 KiB

View File

@ -0,0 +1 @@
{"definitions":{"11bf08ea-8994-437f-adfb-3470e370deb2":{"name":"Daily.SupportCard.DragDownStartPoint","displayName":"日常 支援卡 向下拖动起点","type":"hint-point","annotationId":"11bf08ea-8994-437f-adfb-3470e370deb2","useHintRect":false},"c3264daf-9834-475e-b230-9de00f1fe507":{"name":"Daily.SupportCard.DragDownEndPoint","displayName":"日常 支援卡 向下拖动终点","type":"hint-point","annotationId":"c3264daf-9834-475e-b230-9de00f1fe507","useHintRect":false},"3cd62da4-543c-48b6-ae02-eafd6f6d8355":{"name":"Daily.SupportCard.TargetSupportCard","displayName":"日常 支援卡 目标支援卡位置","type":"hint-point","annotationId":"3cd62da4-543c-48b6-ae02-eafd6f6d8355","useHintRect":false}},"annotations":[{"id":"11bf08ea-8994-437f-adfb-3470e370deb2","type":"point","data":{"x":357,"y":872}},{"id":"c3264daf-9834-475e-b230-9de00f1fe507","type":"point","data":{"x":362,"y":194}},{"id":"3cd62da4-543c-48b6-ae02-eafd6f6d8355","type":"point","data":{"x":138,"y":432}}]}

View File

@ -38,7 +38,7 @@ def club_reward():
# 如果笔记请求已经结束,则发起一轮新的笔记请求;
# 注:下面这个图片要可以区分出笔记请求是否已经结束,不然会发生不幸的事情
logger.info('Prepare to start new note request')
if image.find(R.Daily.ButtonClubCollectReward):
if image.find(R.Daily.ButtonClubCollectReward, threshold=0.99):
device.click()
sleep(1)
# 找到配置中选择的书籍

View File

@ -35,14 +35,24 @@ def upgrade_support_card():
# 往下滑,划到最底部
for _ in range(5):
device.swipe_scaled(0.50, 0.67, 0.50, 0.42, duration=1.0)
device.swipe(
R.Daily.SupportCard.DragDownStartPoint.x,
R.Daily.SupportCard.DragDownStartPoint.y,
R.Daily.SupportCard.DragDownEndPoint.x,
R.Daily.SupportCard.DragDownEndPoint.y,
duration=1.0
)
sleep(0.1)
sleep(1.5)
# 点击左上角第一张支援卡
# 点击位置百分比: (0.18, 0.34)
# 720p缩放后的位置: (130, 435)
for _ in range(2):
device.click(130, 435)
device.click(
R.Daily.SupportCard.TargetSupportCard.x,
R.Daily.SupportCard.TargetSupportCard.y
)
sleep(0.5)
# 点击两次升级按钮两个按钮的logo不一样但是文字是一样的这里资源文件只包含文字