fix(task): 修复无法处理可调整默认商店购买数量为 MAX 弹窗

This commit is contained in:
XcantloadX 2025-04-10 20:09:29 +08:00
parent 0401118150
commit 64aba99c6a
4 changed files with 14 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1 +0,0 @@
{"definitions":{"2f68e457-4491-4ebc-b436-e3e63db92e14":{"name":"Common.ButtonToolbarHomeBinary","displayName":"底部工具栏 首页按钮 二值化图片","type":"template","annotationId":"2f68e457-4491-4ebc-b436-e3e63db92e14","useHintRect":false},"bf6dcf21-2ffc-441f-82f3-59319f2313b1":{"name":"Common.ButtonToolbarMenuBinary","displayName":"底部工具栏 菜单按钮 二值化图片","type":"template","annotationId":"bf6dcf21-2ffc-441f-82f3-59319f2313b1","useHintRect":false}},"annotations":[{"id":"2f68e457-4491-4ebc-b436-e3e63db92e14","type":"rect","data":{"x1":59,"y1":1188,"x2":112,"y2":1240}},{"id":"bf6dcf21-2ffc-441f-82f3-59319f2313b1","type":"rect","data":{"x1":631,"y1":1194,"x2":674,"y2":1232}}]}

View File

@ -0,0 +1 @@
{"definitions":{"de325534-3fd3-480a-9eb8-eb47960a753a":{"name":"Daily.TextDefaultExchangeCountChangeDialog","displayName":"商店默认购买次数改变对话框","type":"template","annotationId":"de325534-3fd3-480a-9eb8-eb47960a753a","useHintRect":false}},"annotations":[{"id":"de325534-3fd3-480a-9eb8-eb47960a753a","type":"rect","data":{"x1":52,"y1":573,"x2":419,"y2":619}}]}

View File

@ -2,6 +2,7 @@ import logging
from .. import R
from kotonebot.util import Interval
from kotonebot.tasks.game_ui import dialog
from kotonebot.tasks.game_ui import toolbar_home
from kotonebot import device, image, action, until, sleep
@ -58,7 +59,7 @@ def goto_home():
logger.debug(f"Trying to go home...")
it.wait()
@action('前往商店页面')
@action('前往商店页面', screenshot_mode='manual-inherit')
def goto_shop():
"""
从首页进入 ショップ
@ -69,9 +70,17 @@ def goto_shop():
logger.info("Going to shop.")
if not at_home():
goto_home()
device.click(image.expect(R.Daily.ButtonShop))
until(at_daily_shop, critical=True)
it = Interval()
while True:
it.wait()
device.screenshot()
if at_daily_shop():
break
elif image.find(R.Daily.ButtonShop):
device.click()
# 可以设置默认购买数量为 MAX 的提示框
elif image.find(R.Daily.TextDefaultExchangeCountChangeDialog):
dialog.yes()
if __name__ == "__main__":
goto_home()