feat(task): 培育中文化课(授業)行动支持处理自习事件
This commit is contained in:
parent
2a12fb05e4
commit
47287fdc19
Binary file not shown.
After Width: | Height: | Size: 675 KiB |
|
@ -0,0 +1 @@
|
|||
{"definitions":{"c78c38cc-7b61-4dc4-820d-0a5b684ef52e":{"name":"InPurodyuusu.TextSelfStudyVocal","displayName":"文化课事件 自习 声乐","type":"template","annotationId":"c78c38cc-7b61-4dc4-820d-0a5b684ef52e","useHintRect":false},"83d0a033-466c-463a-bb8c-be0f2953e9b2":{"name":"InPurodyuusu.TextSelfStudyDance","displayName":"文化课事件 自习 舞蹈","type":"template","annotationId":"83d0a033-466c-463a-bb8c-be0f2953e9b2","useHintRect":false},"4695f96b-c4f5-4bb6-a021-a13b6ceb2883":{"name":"InPurodyuusu.TextSelfStudyVisual","displayName":"文化课事件 自习 形象","type":"template","annotationId":"4695f96b-c4f5-4bb6-a021-a13b6ceb2883","useHintRect":false}},"annotations":[{"id":"c78c38cc-7b61-4dc4-820d-0a5b684ef52e","type":"rect","data":{"x1":86,"y1":676,"x2":359,"y2":721}},{"id":"83d0a033-466c-463a-bb8c-be0f2953e9b2","type":"rect","data":{"x1":88,"y1":778,"x2":331,"y2":823}},{"id":"4695f96b-c4f5-4bb6-a021-a13b6ceb2883","type":"rect","data":{"x1":90,"y1":879,"x2":388,"y2":925}}]}
|
|
@ -5,6 +5,8 @@
|
|||
"""
|
||||
from logging import getLogger
|
||||
|
||||
from kotonebot.tasks.common import conf
|
||||
|
||||
from .. import R
|
||||
from .common import acquisitions
|
||||
from ..game_ui import CommuEventButtonUI
|
||||
|
@ -47,23 +49,50 @@ def enter_study():
|
|||
while not image.find(R.InPurodyuusu.IconTitleStudy):
|
||||
logger.debug("Waiting for 授業 screen.")
|
||||
acquisitions()
|
||||
# 获取三个选项的内容
|
||||
ui = CommuEventButtonUI()
|
||||
buttons = ui.all()
|
||||
if not buttons:
|
||||
raise UnrecoverableError("Failed to find any buttons.")
|
||||
# 选中 +30 的选项
|
||||
target_btn = next((btn for btn in buttons if '+30' in btn.description), None)
|
||||
if target_btn is None:
|
||||
logger.error("Failed to find +30 option. Pick the first button instead.")
|
||||
target_btn = buttons[0]
|
||||
logger.debug('Clicking "%s".', target_btn.description)
|
||||
if target_btn.selected:
|
||||
device.click(target_btn)
|
||||
# 首先需要判断是不是自习课
|
||||
# [kotonebot-resource\sprites\jp\in_purodyuusu\screenshot_study_self_study.png]
|
||||
if image.find_multi([
|
||||
R.InPurodyuusu.TextSelfStudyDance,
|
||||
R.InPurodyuusu.TextSelfStudyVisual,
|
||||
R.InPurodyuusu.TextSelfStudyVocal
|
||||
]):
|
||||
logger.info("授業 type: Self study.")
|
||||
target = conf().produce.self_study_lesson
|
||||
if target == 'dance':
|
||||
logger.debug("Clicking on lesson dance.")
|
||||
device.double_click(image.expect(R.InPurodyuusu.TextSelfStudyDance))
|
||||
elif target == 'visual':
|
||||
logger.debug("Clicking on lesson visual.")
|
||||
device.double_click(image.expect(R.InPurodyuusu.TextSelfStudyVisual))
|
||||
elif target == 'vocal':
|
||||
logger.debug("Clicking on lesson vocal.")
|
||||
device.double_click(image.expect(R.InPurodyuusu.TextSelfStudyVocal))
|
||||
from .in_purodyuusu import until_practice_scene, practice
|
||||
logger.info("Entering practice scene.")
|
||||
until_practice_scene()
|
||||
logger.info("Executing practice.")
|
||||
practice()
|
||||
logger.info("Practice completed.")
|
||||
# 不是自习课
|
||||
else:
|
||||
device.double_click(target_btn)
|
||||
while acquisitions() is None:
|
||||
logger.info("Waiting for acquisitions finished.")
|
||||
logger.info("授業 type: Normal.")
|
||||
# 获取三个选项的内容
|
||||
ui = CommuEventButtonUI()
|
||||
buttons = ui.all()
|
||||
if not buttons:
|
||||
raise UnrecoverableError("Failed to find any buttons.")
|
||||
# 选中 +30 的选项
|
||||
target_btn = next((btn for btn in buttons if '+30' in btn.description), None)
|
||||
if target_btn is None:
|
||||
logger.error("Failed to find +30 option. Pick the first button instead.")
|
||||
target_btn = buttons[0]
|
||||
logger.debug('Clicking "%s".', target_btn.description)
|
||||
if target_btn.selected:
|
||||
device.click(target_btn)
|
||||
else:
|
||||
device.double_click(target_btn)
|
||||
while acquisitions() is None:
|
||||
logger.info("Waiting for acquisitions finished.")
|
||||
logger.info("授業 completed.")
|
||||
|
||||
|
||||
|
@ -128,30 +157,6 @@ def at_action_scene():
|
|||
R.InPurodyuusu.ButtonFinalPracticeDance # 离考试剩余一周
|
||||
]) is not None
|
||||
|
||||
if __name__ == '__main__':
|
||||
from kotonebot.backend.context import manual_context, init_context
|
||||
init_context()
|
||||
manual_context().begin()
|
||||
# 获取三个选项的内容
|
||||
ui = CommuEventButtonUI()
|
||||
buttons = ui.all()
|
||||
if not buttons:
|
||||
raise UnrecoverableError("Failed to find any buttons.")
|
||||
# 选中 +30 的选项
|
||||
target_btn = next((btn for btn in buttons if btn.description == '+30'), None)
|
||||
if target_btn is None:
|
||||
logger.error("Failed to find +30 option. Pick the first button instead.")
|
||||
target_btn = buttons[0]
|
||||
# 固定点击 Vi. 选项
|
||||
logger.debug('Clicking "%s".', target_btn.description)
|
||||
if target_btn.selected:
|
||||
device.click(target_btn)
|
||||
else:
|
||||
device.double_click(target_btn)
|
||||
while acquisitions() is None:
|
||||
logger.info("Waiting for acquisitions finished.")
|
||||
logger.info("授業 completed.")
|
||||
|
||||
@action('判断是否可以外出')
|
||||
def outing_available():
|
||||
"""
|
||||
|
@ -203,3 +208,27 @@ def enter_outing():
|
|||
it.wait()
|
||||
|
||||
logger.info("おでかけ completed.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
from kotonebot.backend.context import manual_context, init_context
|
||||
init_context()
|
||||
manual_context().begin()
|
||||
# 获取三个选项的内容
|
||||
ui = CommuEventButtonUI()
|
||||
buttons = ui.all()
|
||||
if not buttons:
|
||||
raise UnrecoverableError("Failed to find any buttons.")
|
||||
# 选中 +30 的选项
|
||||
target_btn = next((btn for btn in buttons if btn.description == '+30'), None)
|
||||
if target_btn is None:
|
||||
logger.error("Failed to find +30 option. Pick the first button instead.")
|
||||
target_btn = buttons[0]
|
||||
# 固定点击 Vi. 选项
|
||||
logger.debug('Clicking "%s".', target_btn.description)
|
||||
if target_btn.selected:
|
||||
device.click(target_btn)
|
||||
else:
|
||||
device.double_click(target_btn)
|
||||
while acquisitions() is None:
|
||||
logger.info("Waiting for acquisitions finished.")
|
||||
logger.info("授業 completed.")
|
|
@ -331,6 +331,8 @@ class ProduceConfig(ConfigBaseModel):
|
|||
"""是否使用笔记数提升。"""
|
||||
follow_producer: bool = False
|
||||
"""是否关注租借了支援卡的制作人。"""
|
||||
self_study_lesson: Literal['dance', 'visual', 'vocal'] = 'dance'
|
||||
"""自习课类型。"""
|
||||
|
||||
|
||||
class MissionRewardConfig(ConfigBaseModel):
|
||||
|
|
|
@ -250,7 +250,8 @@ class KotoneBotUI:
|
|||
use_pt_boost: bool,
|
||||
use_note_boost: bool,
|
||||
follow_producer: bool,
|
||||
mission_reward_enabled: bool
|
||||
self_study_lesson: Literal['dance', 'visual', 'vocal'],
|
||||
mission_reward_enabled: bool,
|
||||
) -> str:
|
||||
ap_items_enum: List[Literal[0, 1, 2, 3]] = []
|
||||
ap_items_map: Dict[str, APShopItems] = {
|
||||
|
@ -302,7 +303,8 @@ class KotoneBotUI:
|
|||
auto_set_support_card=auto_set_support,
|
||||
use_pt_boost=use_pt_boost,
|
||||
use_note_boost=use_note_boost,
|
||||
follow_producer=follow_producer
|
||||
follow_producer=follow_producer,
|
||||
self_study_lesson=self_study_lesson
|
||||
),
|
||||
mission_reward=MissionRewardConfig(
|
||||
enabled=mission_reward_enabled
|
||||
|
@ -497,7 +499,7 @@ class KotoneBotUI:
|
|||
)
|
||||
return assignment_enabled, mini_live_reassign, mini_live_duration, online_live_reassign, online_live_duration
|
||||
|
||||
def _create_produce_settings(self) -> Tuple[gr.Checkbox, gr.Dropdown, gr.Number, gr.Dropdown, gr.Dropdown, gr.Checkbox, gr.Checkbox, gr.Checkbox, gr.Checkbox, gr.Checkbox]:
|
||||
def _create_produce_settings(self) -> Tuple[gr.Checkbox, gr.Dropdown, gr.Number, gr.Dropdown, gr.Dropdown, gr.Checkbox, gr.Checkbox, gr.Checkbox, gr.Checkbox, gr.Checkbox, gr.Dropdown]:
|
||||
with gr.Column():
|
||||
gr.Markdown("### 培育设置")
|
||||
produce_enabled = gr.Checkbox(
|
||||
|
@ -565,6 +567,12 @@ class KotoneBotUI:
|
|||
value=self.current_config.options.produce.follow_producer,
|
||||
info=ProduceConfig.model_fields['follow_producer'].description
|
||||
)
|
||||
self_study_lesson = gr.Dropdown(
|
||||
choices=['dance', 'visual', 'vocal'],
|
||||
value=self.current_config.options.produce.self_study_lesson,
|
||||
label='文化课自习时选项',
|
||||
info='选择自习课类型'
|
||||
)
|
||||
|
||||
produce_enabled.change(
|
||||
fn=lambda x: gr.Group(visible=x),
|
||||
|
@ -577,7 +585,7 @@ class KotoneBotUI:
|
|||
inputs=[auto_set_memory],
|
||||
outputs=[memory_sets_group]
|
||||
)
|
||||
return produce_enabled, produce_mode, produce_count, produce_idols, memory_sets, auto_set_memory, auto_set_support, use_pt_boost, use_note_boost, follow_producer
|
||||
return produce_enabled, produce_mode, produce_count, produce_idols, memory_sets, auto_set_memory, auto_set_support, use_pt_boost, use_note_boost, follow_producer, self_study_lesson
|
||||
|
||||
def _create_settings_tab(self) -> None:
|
||||
with gr.Tab("设置"):
|
||||
|
@ -672,7 +680,7 @@ class KotoneBotUI:
|
|||
*work_settings,
|
||||
contest,
|
||||
*produce_settings,
|
||||
mission_reward
|
||||
mission_reward,
|
||||
]
|
||||
|
||||
save_btn.click(
|
||||
|
|
Loading…
Reference in New Issue