Skip to content

Commit

Permalink
#331 加入跳过黑塔选项
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorReid committed Jul 6, 2024
1 parent d51fe28 commit d0ae0d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/gui/sim_uni/sim_uni_challenge_config_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def __init__(self, page: ft.Page, ctx: Context):
self.curio_text = ft.TextField(disabled=True, min_lines=3, max_lines=7, width=380, multiline=True,
on_blur=self._on_curio_text_update)

self.skip_herta_checkbox = ft.Checkbox(disabled=True, on_change=self._on_skip_herta_changed)
self.technique_fight_checkbox = ft.Checkbox(disabled=True, on_change=self._on_technique_fight_changed)
self.technique_only_checkbox = ft.Checkbox(disabled=True, on_change=self._on_technique_only_changed)
self.max_consumable_cnt = ft.Dropdown(options=[ft.dropdown.Option(key=str(i), text=str(i)) for i in range(6)],
Expand All @@ -250,6 +251,7 @@ def __init__(self, page: ft.Page, ctx: Context):
SettingsListItem(gt('奇物优先级', 'ui'), self.curio_btn),
SettingsListItem('', self.curio_text),
SettingsListGroupTitle(gt('战斗', 'ui')),
SettingsListItem(gt('跳过黑塔', 'ui'), self.skip_herta_checkbox),
SettingsListItem(gt('秘技开怪', 'ui'), self.technique_fight_checkbox),
SettingsListItem(gt('仅秘技开怪', 'ui'), self.technique_only_checkbox),
SettingsListItem(gt('单次最多消耗品个数', 'ui'), self.max_consumable_cnt),
Expand Down Expand Up @@ -309,37 +311,30 @@ def _update_config_card_status(self):
config_chosen = self.chosen_config is not None

self.copy_btn.disabled = not config_chosen
self.copy_btn.update()

self.del_btn.disabled = not config_chosen
self.del_btn.update()

self.name_text.disabled = not config_chosen
self.name_text.update()

self.path_dropdown.disabled = not config_chosen
self.path_dropdown.update()

self.bless_btn.disabled = not config_chosen
self.bless_btn.update()

self.bless_btn_2.disabled = not config_chosen
self.bless_btn_2.update()

self.level_type_btn.disabled = not config_chosen
self.level_type_btn.update()

self.curio_btn.disabled = not config_chosen
self.curio_btn.update()

self.skip_herta_checkbox.disabled = not config_chosen

self.technique_fight_checkbox.disabled = not config_chosen
self.technique_fight_checkbox.update()

self.technique_only_checkbox.disabled = not config_chosen
self.technique_only_checkbox.update()

self.max_consumable_cnt.disabled = not config_chosen
self.max_consumable_cnt.update()

self.update()

def _load_config_to_input(self):
"""
Expand All @@ -357,14 +352,12 @@ def _load_config_to_input(self):
self._update_level_type_text()
self._update_curio_text()

self.skip_herta_checkbox.value = self.chosen_config.skip_herta
self.technique_fight_checkbox.value = self.chosen_config.technique_fight
self.technique_fight_checkbox.update()

self.technique_only_checkbox.value = self.chosen_config.technique_only
self.technique_only_checkbox.update()

self.max_consumable_cnt.value = str(self.chosen_config.max_consumable_cnt)
self.max_consumable_cnt.update()

self.update()

def _on_existed_list_changed(self, chosen_idx: Optional[int]):
"""
Expand Down Expand Up @@ -685,6 +678,14 @@ def get_str_list(text_input: ft.TextField) -> List[str]:
arr.pop()
return arr

def _on_skip_herta_changed(self, e):
"""
跳过黑塔更改
:param e:
:return:
"""
self.chosen_config.skip_herta = self.skip_herta_checkbox.value

def _on_technique_fight_changed(self, e):
"""
秘技开怪更改
Expand Down
2 changes: 2 additions & 0 deletions src/sr/sim_uni/op/v2/sim_uni_run_respite_route_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def _check_mm_icon(self) -> OperationOneRoundResult:
识别小地图上的黑塔图标
:return:
"""
if self.ctx.sim_uni_challenge_config.skip_herta: # 跳过黑塔
self.event_handled = True
if self.event_handled: # 已经交互过事件了
return self.round_success(status=SimUniRunRouteBaseV2.STATUS_HAD_EVENT)
screen = self.screenshot()
Expand Down
8 changes: 8 additions & 0 deletions src/sr/sim_uni/sim_uni_challenge_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ def max_consumable_cnt(self) -> bool:
def max_consumable_cnt(self, new_value: int):
self.update('max_consumable_cnt', new_value)

@property
def skip_herta(self) -> bool:
return self.get('skip_herta', False)

@skip_herta.setter
def skip_herta(self, new_value: bool) -> None:
self.update('skip_herta', new_value)


class SimUniChallengeAllConfig:

Expand Down

0 comments on commit d0ae0d5

Please sign in to comment.