parent
bf2aa4d9e2
commit
9b8ef74317
|
@ -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":"培育 行动页面 形象课程按钮文字"},"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}}]}
|
||||
{"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},"ce1d1d6f-38f2-48bf-98bd-6e091c7ca5b8":{"name":"InPurodyuusu.ButtonPracticeVocal","displayName":"行动页 声乐课程按钮图标","type":"template","annotationId":"ce1d1d6f-38f2-48bf-98bd-6e091c7ca5b8","useHintRect":false},"b2e1bf3c-2c36-4fb5-9db7-c10a29563a37":{"name":"InPurodyuusu.ButtonPracticeDance","displayName":"行动页 舞蹈课程按钮图标","type":"template","annotationId":"b2e1bf3c-2c36-4fb5-9db7-c10a29563a37","useHintRect":false,"description":""},"adc533a7-970b-4c5b-a037-2181531a35d6":{"name":"InPurodyuusu.ButtonPracticeVisual","displayName":"行动页 形象课程按钮图标","type":"template","annotationId":"adc533a7-970b-4c5b-a037-2181531a35d6","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}},{"id":"ce1d1d6f-38f2-48bf-98bd-6e091c7ca5b8","type":"rect","data":{"x1":171,"y1":965,"x2":201,"y2":1038}},{"id":"b2e1bf3c-2c36-4fb5-9db7-c10a29563a37","type":"rect","data":{"x1":337,"y1":970,"x2":390,"y2":1030}},{"id":"adc533a7-970b-4c5b-a037-2181531a35d6","type":"rect","data":{"x1":506,"y1":972,"x2":561,"y2":1031}}]}
|
|
@ -33,53 +33,7 @@ class SkillCard(NamedTuple):
|
|||
rect: Rect
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
ActionType = None | Literal['lesson', 'rest']
|
||||
@deprecated('OCR 方法效果不佳')
|
||||
def enter_recommended_action_ocr(final_week: bool = False) -> ActionType:
|
||||
"""
|
||||
在行动选择页面,执行推荐行动
|
||||
|
||||
:param final_week: 是否是考试前复习周
|
||||
:return: 是否成功执行推荐行动
|
||||
"""
|
||||
# 获取课程
|
||||
logger.debug("Waiting for recommended lesson...")
|
||||
with cropped(device, y1=0.00, y2=0.30):
|
||||
ret = ocr.wait_for(regex('ボーカル|ダンス|ビジュアル|休|体力'))
|
||||
logger.debug("ocr.wait_for: %s", ret)
|
||||
if ret is None:
|
||||
return None
|
||||
if not final_week:
|
||||
if "ボーカル" in ret.text:
|
||||
lesson_text = "Vo"
|
||||
elif "ダンス" in ret.text:
|
||||
lesson_text = "Da"
|
||||
elif "ビジュアル" in ret.text:
|
||||
lesson_text = "Vi"
|
||||
elif "休" in ret.text or "体力" in ret.text:
|
||||
rest()
|
||||
return 'rest'
|
||||
else:
|
||||
return None
|
||||
logger.info("Rec. lesson: %s", lesson_text)
|
||||
# 点击课程
|
||||
logger.debug("Try clicking lesson...")
|
||||
lesson_ret = ocr.expect(contains(lesson_text))
|
||||
device.double_click(lesson_ret.rect)
|
||||
return 'lesson'
|
||||
else:
|
||||
if "ボーカル" in ret.text:
|
||||
template = R.InPurodyuusu.ButtonFinalPracticeVocal
|
||||
elif "ダンス" in ret.text:
|
||||
template = R.InPurodyuusu.ButtonFinalPracticeDance
|
||||
elif "ビジュアル" in ret.text:
|
||||
template = R.InPurodyuusu.ButtonFinalPracticeVisual
|
||||
else:
|
||||
return None
|
||||
logger.debug("Try clicking lesson...")
|
||||
device.double_click(image.expect_wait(template))
|
||||
return 'lesson'
|
||||
|
||||
@action('执行 SP 课程')
|
||||
def handle_sp_lesson():
|
||||
|
@ -134,27 +88,30 @@ def handle_recommended_action(final_week: bool = False) -> ProduceAction | None:
|
|||
logger.debug("No recommended lesson found")
|
||||
return None
|
||||
recommended = None
|
||||
# 普通周
|
||||
if not final_week:
|
||||
if result.index == 0:
|
||||
lesson_text = regex("Da")
|
||||
template = R.InPurodyuusu.ButtonPracticeDance
|
||||
recommended = ProduceAction.DANCE
|
||||
logger.info("Recommend lesson is dance.")
|
||||
elif result.index == 1:
|
||||
lesson_text = regex("Vo|V0|VO")
|
||||
template = R.InPurodyuusu.ButtonPracticeVocal
|
||||
recommended = ProduceAction.VOCAL
|
||||
logger.info("Recommend lesson is vocal.")
|
||||
elif result.index == 2:
|
||||
lesson_text = regex("Vi|V1|VI")
|
||||
template = R.InPurodyuusu.ButtonPracticeVisual
|
||||
recommended = ProduceAction.VISUAL
|
||||
logger.info("Recommend lesson is visual.")
|
||||
elif result.index == 3:
|
||||
rest()
|
||||
return ProduceAction.REST
|
||||
else:
|
||||
return None
|
||||
logger.info("Rec. lesson: %s", lesson_text)
|
||||
# 点击课程
|
||||
logger.debug("Try clicking lesson...")
|
||||
lesson_ret = ocr.expect(lesson_text)
|
||||
device.double_click(lesson_ret.rect)
|
||||
device.double_click(image.expect_wait(template))
|
||||
return recommended
|
||||
# 冲刺周
|
||||
else:
|
||||
if result.index == 0:
|
||||
template = R.InPurodyuusu.ButtonFinalPracticeDance
|
||||
|
|
Loading…
Reference in New Issue