fix(task): 修复快速截图下,培育中无法正确获取推荐行动
This commit is contained in:
parent
b00db58f9a
commit
cd83e5abd5
|
@ -1 +1 @@
|
|||
{"definitions":{"be6836bd-ee42-432b-9166-469c74f32f0b":{"name":"InPurodyuusu.BoxWeeksUntilExam","displayName":"考试剩余周","type":"hint-box","annotationId":"be6836bd-ee42-432b-9166-469c74f32f0b","useHintRect":false,"description":"培育中左上角的下次考试剩余周数"},"d6b64759-26b7-45b1-bf8e-5c0d98611e0d":{"name":"InPurodyuusu.TextActionVocal","displayName":"Vo. レッスン","type":"template","annotationId":"d6b64759-26b7-45b1-bf8e-5c0d98611e0d","useHintRect":false,"description":"培育 行动页面 声乐课程按钮文字"},"303cccc1-c674-4d3a-8c89-19ea729fdbef":{"name":"InPurodyuusu.TextActionDance","displayName":"Da. レッスン","type":"template","annotationId":"303cccc1-c674-4d3a-8c89-19ea729fdbef","useHintRect":false,"description":"培育 行动页面 舞蹈课程按钮文字"},"cc8a495d-330d-447d-8a80-a8a6ecc409c5":{"name":"InPurodyuusu.TextActionVisual","displayName":"Vi. レッスン","type":"template","annotationId":"cc8a495d-330d-447d-8a80-a8a6ecc409c5","useHintRect":false,"description":"培育 行动页面 形象课程按钮文字"}},"annotations":[{"id":"be6836bd-ee42-432b-9166-469c74f32f0b","type":"rect","data":{"x1":11,"y1":8,"x2":237,"y2":196}},{"id":"d6b64759-26b7-45b1-bf8e-5c0d98611e0d","type":"rect","data":{"x1":116,"y1":1067,"x2":255,"y2":1097}},{"id":"303cccc1-c674-4d3a-8c89-19ea729fdbef","type":"rect","data":{"x1":288,"y1":1068,"x2":431,"y2":1096}},{"id":"cc8a495d-330d-447d-8a80-a8a6ecc409c5","type":"rect","data":{"x1":466,"y1":1067,"x2":606,"y2":1096}}]}
|
||||
{"definitions":{"be6836bd-ee42-432b-9166-469c74f32f0b":{"name":"InPurodyuusu.BoxWeeksUntilExam","displayName":"考试剩余周","type":"hint-box","annotationId":"be6836bd-ee42-432b-9166-469c74f32f0b","useHintRect":false,"description":"培育中左上角的下次考试剩余周数"},"d6b64759-26b7-45b1-bf8e-5c0d98611e0d":{"name":"InPurodyuusu.TextActionVocal","displayName":"Vo. レッスン","type":"template","annotationId":"d6b64759-26b7-45b1-bf8e-5c0d98611e0d","useHintRect":false,"description":"培育 行动页面 声乐课程按钮文字"},"303cccc1-c674-4d3a-8c89-19ea729fdbef":{"name":"InPurodyuusu.TextActionDance","displayName":"Da. レッスン","type":"template","annotationId":"303cccc1-c674-4d3a-8c89-19ea729fdbef","useHintRect":false,"description":"培育 行动页面 舞蹈课程按钮文字"},"cc8a495d-330d-447d-8a80-a8a6ecc409c5":{"name":"InPurodyuusu.TextActionVisual","displayName":"Vi. レッスン","type":"template","annotationId":"cc8a495d-330d-447d-8a80-a8a6ecc409c5","useHintRect":false,"description":"培育 行动页面 形象课程按钮文字"},"d7667903-7149-4f2f-9c15-d8a4b5f4d347":{"name":"InPurodyuusu.IconAsariSenseiAvatar","displayName":"Asari 老师头像","type":"template","annotationId":"d7667903-7149-4f2f-9c15-d8a4b5f4d347","useHintRect":false,"description":"用于检测培育行动页面提示"},"75fdc1b6-5690-44d1-989e-95b6ab78e1dc":{"name":"InPurodyuusu.BoxAsariSenseiTip","displayName":"Asari 老师提示文本区域","type":"hint-box","annotationId":"75fdc1b6-5690-44d1-989e-95b6ab78e1dc","useHintRect":false}},"annotations":[{"id":"be6836bd-ee42-432b-9166-469c74f32f0b","type":"rect","data":{"x1":11,"y1":8,"x2":237,"y2":196}},{"id":"d6b64759-26b7-45b1-bf8e-5c0d98611e0d","type":"rect","data":{"x1":116,"y1":1067,"x2":255,"y2":1097}},{"id":"303cccc1-c674-4d3a-8c89-19ea729fdbef","type":"rect","data":{"x1":288,"y1":1068,"x2":431,"y2":1096}},{"id":"cc8a495d-330d-447d-8a80-a8a6ecc409c5","type":"rect","data":{"x1":466,"y1":1067,"x2":606,"y2":1096}},{"id":"d7667903-7149-4f2f-9c15-d8a4b5f4d347","type":"rect","data":{"x1":638,"y1":178,"x2":679,"y2":220}},{"id":"75fdc1b6-5690-44d1-989e-95b6ab78e1dc","type":"rect","data":{"x1":245,"y1":150,"x2":702,"y2":243}}]}
|
|
@ -95,7 +95,7 @@ def handle_sp_lesson():
|
|||
else:
|
||||
return False
|
||||
|
||||
@action('执行推荐行动')
|
||||
@action('执行推荐行动', screenshot_mode='manual-inherit')
|
||||
def handle_recommended_action(final_week: bool = False) -> ProduceAction | None:
|
||||
"""
|
||||
在行动选择页面,执行推荐行动
|
||||
|
@ -110,13 +110,25 @@ def handle_recommended_action(final_week: bool = False) -> ProduceAction | None:
|
|||
"""
|
||||
# 获取课程
|
||||
logger.debug("Getting recommended lesson...")
|
||||
with cropped(device, y1=0.00, y2=0.30):
|
||||
result = image.find_multi([
|
||||
R.InPurodyuusu.TextSenseiTipDance,
|
||||
R.InPurodyuusu.TextSenseiTipVocal,
|
||||
R.InPurodyuusu.TextSenseiTipVisual,
|
||||
R.InPurodyuusu.TextSenseiTipRest,
|
||||
])
|
||||
device.screenshot()
|
||||
if not image.find(R.InPurodyuusu.IconAsariSenseiAvatar):
|
||||
return None
|
||||
it = Interval()
|
||||
cd = Countdown(sec=5).start()
|
||||
result = None
|
||||
while not cd.expired():
|
||||
logger.debug('Retrieving recommended lesson...')
|
||||
with cropped(device, y1=0.00, y2=0.30):
|
||||
if result := image.find_multi([
|
||||
R.InPurodyuusu.TextSenseiTipDance,
|
||||
R.InPurodyuusu.TextSenseiTipVocal,
|
||||
R.InPurodyuusu.TextSenseiTipVisual,
|
||||
R.InPurodyuusu.TextSenseiTipRest,
|
||||
]):
|
||||
break
|
||||
it.wait()
|
||||
device.screenshot()
|
||||
|
||||
logger.debug("image.find_multi: %s", result)
|
||||
if result is None:
|
||||
logger.debug("No recommended lesson found")
|
||||
|
@ -156,7 +168,7 @@ def handle_recommended_action(final_week: bool = False) -> ProduceAction | None:
|
|||
else:
|
||||
return None
|
||||
logger.debug("Try clicking lesson...")
|
||||
device.double_click(image.expect_wait(template))
|
||||
device.double_click(image.expect(template))
|
||||
return recommended
|
||||
|
||||
class CardDetectResult(NamedTuple):
|
||||
|
|
Loading…
Reference in New Issue