fix(task): 修复无法处理是否展示技能卡选择指导对话框
This commit is contained in:
parent
075554df37
commit
ace92378aa
Binary file not shown.
After Width: | Height: | Size: 377 KiB |
|
@ -0,0 +1 @@
|
|||
{"definitions":{"3f637e86-6b74-4693-9131-1fe411fc21e5":{"name":"InPurodyuusu.TextSkillCardSelectGuideDialogTitle","displayName":"獲得ガイド表示設定","type":"template","annotationId":"3f637e86-6b74-4693-9131-1fe411fc21e5","useHintRect":false}},"annotations":[{"id":"3f637e86-6b74-4693-9131-1fe411fc21e5","type":"rect","data":{"x1":51,"y1":698,"x2":354,"y2":740}}]}
|
|
@ -14,7 +14,7 @@ from .p_drink import acquire_p_drink
|
|||
from kotonebot.util import measure_time
|
||||
from kotonebot.tasks.common import conf
|
||||
from kotonebot.tasks.actions.loading import loading
|
||||
from kotonebot.tasks.game_ui import CommuEventButtonUI
|
||||
from kotonebot.tasks.game_ui import CommuEventButtonUI, dialog
|
||||
from kotonebot.tasks.actions.commu import handle_unread_commu
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
@ -25,21 +25,42 @@ def acquire_skill_card():
|
|||
# TODO: 识别卡片内容,而不是固定选卡
|
||||
# TODO: 不硬编码坐标
|
||||
logger.debug("Locating all skill cards...")
|
||||
device.screenshot()
|
||||
cards = image.find_all_multi([
|
||||
R.InPurodyuusu.A,
|
||||
R.InPurodyuusu.M
|
||||
])
|
||||
if not cards:
|
||||
logger.warning("No skill cards found. Skip acquire.")
|
||||
return
|
||||
cards = sorted(cards, key=lambda x: (x.position[0], x.position[1]))
|
||||
logger.info(f"Found {len(cards)} skill cards")
|
||||
logger.debug("Click first skill card")
|
||||
device.click(cards[0].rect)
|
||||
sleep(0.2)
|
||||
logger.debug("Click acquire button")
|
||||
device.click(image.expect_wait(R.InPurodyuusu.AcquireBtnDisabled))
|
||||
|
||||
it = Interval()
|
||||
cards = None
|
||||
card_clicked = False
|
||||
|
||||
while True:
|
||||
device.screenshot()
|
||||
it.wait()
|
||||
|
||||
# 是否显示技能卡选择指导的对话框
|
||||
# [kotonebot-resource/sprites/jp/in_purodyuusu/screenshot_show_skill_card_select_guide_dialog.png]
|
||||
if image.find(R.InPurodyuusu.TextSkillCardSelectGuideDialogTitle):
|
||||
# 默认就是显示,直接确认
|
||||
dialog.yes()
|
||||
continue
|
||||
if not cards:
|
||||
cards = image.find_all_multi([
|
||||
R.InPurodyuusu.A,
|
||||
R.InPurodyuusu.M
|
||||
])
|
||||
if not cards:
|
||||
logger.warning("No skill cards found. Skip acquire.")
|
||||
return
|
||||
cards = sorted(cards, key=lambda x: (x.position[0], x.position[1]))
|
||||
logger.info(f"Found {len(cards)} skill cards")
|
||||
continue
|
||||
if not card_clicked:
|
||||
logger.debug("Click first skill card")
|
||||
device.click(cards[0].rect)
|
||||
card_clicked = True
|
||||
sleep(0.2)
|
||||
continue
|
||||
if acquire_btn := image.find(R.InPurodyuusu.AcquireBtnDisabled):
|
||||
logger.debug("Click acquire button")
|
||||
device.click(acquire_btn)
|
||||
break
|
||||
|
||||
@action('选择P物品', screenshot_mode='auto')
|
||||
def select_p_item():
|
||||
|
|
Loading…
Reference in New Issue