diff --git a/assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.2.png b/assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.2.png new file mode 100644 index 000000000..f6b993c10 Binary files /dev/null and b/assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.2.png differ diff --git a/assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.2.png b/assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.2.png new file mode 100644 index 000000000..49930fecd Binary files /dev/null and b/assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.2.png differ diff --git a/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.2.png b/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.2.png new file mode 100644 index 000000000..c1ea06c78 Binary files /dev/null and b/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.2.png differ diff --git a/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.2.png b/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.2.png new file mode 100644 index 000000000..0645d6ecd Binary files /dev/null and b/assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.2.png differ diff --git a/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.2.png b/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.2.png new file mode 100644 index 000000000..cbc984af2 Binary files /dev/null and b/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.2.png differ diff --git a/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.2.png b/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.2.png new file mode 100644 index 000000000..e393bf840 Binary files /dev/null and b/assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.2.png differ diff --git a/module/base/button.py b/module/base/button.py index 8e338a75f..100635ab8 100644 --- a/module/base/button.py +++ b/module/base/button.py @@ -144,15 +144,25 @@ class ButtonWrapper(Resource): def __bool__(self): return True + def iter_buttons(self) -> t.Iterator[Button]: + for _, assets in self.data_buttons.items(): + if isinstance(assets, Button): + yield assets + elif isinstance(assets, list): + for asset in assets: + yield asset + @cached_property def buttons(self) -> t.List[Button]: for trial in [server.lang, 'share', 'cn']: - assets = self.data_buttons.get(trial, None) - if assets is not None: + try: + assets = self.data_buttons[trial] if isinstance(assets, Button): return [assets] elif isinstance(assets, list): return assets + except KeyError: + pass raise ScriptError(f'ButtonWrapper({self}) on server {server.lang} has no fallback button') @@ -221,13 +231,24 @@ class ButtonWrapper(Resource): """ if isinstance(button, ButtonWrapper): button = button.matched_button - for b in self.buttons: + for b in self.iter_buttons(): b.load_offset(button) def clear_offset(self): - for b in self.buttons: + for b in self.iter_buttons(): b.clear_offset() + def load_search(self, area): + """ + Set `search` attribute. + Note that this method is irreversible. + + Args: + area: + """ + for b in self.iter_buttons(): + b.search = area + class ClickButton: def __init__(self, button, name='CLICK_BUTTON'): diff --git a/tasks/assignment/assets/__init__.py b/tasks/assignment/assets/__init__.py index ee33bd543..c2cd3f656 100644 --- a/tasks/assignment/assets/__init__.py +++ b/tasks/assignment/assets/__init__.py @@ -1,4 +1,3 @@ -from module.config.server import VALID_LANG from tasks.assignment.assets.assets_assignment_ui import ( CHARACTER_MATERIALS_CHECK, CHARACTER_MATERIALS_CLICK, EXP_MATERIALS_CREDITS_CHECK, EXP_MATERIALS_CREDITS_CLICK, GROUP_SEARCH, @@ -12,8 +11,4 @@ for group_button_wrapper in ( EXP_MATERIALS_CREDITS_CHECK, EXP_MATERIALS_CREDITS_CLICK, SYNTHESIS_MATERIALS_CHECK, SYNTHESIS_MATERIALS_CLICK, ): - for lang in VALID_LANG: - button = group_button_wrapper.data_buttons.get(lang, None) - if button is None: - continue - button.search = GROUP_SEARCH.button + group_button_wrapper.load_search(GROUP_SEARCH.button) diff --git a/tasks/assignment/assets/assets_assignment_ui.py b/tasks/assignment/assets/assets_assignment_ui.py index 230772f3d..3d50d5981 100644 --- a/tasks/assignment/assets/assets_assignment_ui.py +++ b/tasks/assignment/assets/assets_assignment_ui.py @@ -12,13 +12,22 @@ CHARACTER_MATERIALS_CHECK = ButtonWrapper( color=(177, 176, 173), button=(346, 97, 421, 117), ), - en=Button( - file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.png', - area=(339, 88, 429, 126), - search=(319, 68, 449, 146), - color=(193, 192, 189), - button=(339, 88, 429, 126), - ), + en=[ + Button( + file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.png', + area=(339, 88, 429, 126), + search=(319, 68, 449, 146), + color=(193, 192, 189), + button=(339, 88, 429, 126), + ), + Button( + file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CHECK.2.png', + area=(142, 98, 234, 119), + search=(319, 68, 449, 146), + color=(203, 202, 199), + button=(142, 98, 234, 119), + ), + ], ) CHARACTER_MATERIALS_CLICK = ButtonWrapper( name='CHARACTER_MATERIALS_CLICK', @@ -29,13 +38,22 @@ CHARACTER_MATERIALS_CLICK = ButtonWrapper( color=(60, 60, 60), button=(347, 97, 421, 117), ), - en=Button( - file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.png', - area=(339, 88, 429, 127), - search=(319, 68, 449, 147), - color=(49, 49, 49), - button=(339, 88, 429, 127), - ), + en=[ + Button( + file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.png', + area=(339, 88, 429, 127), + search=(319, 68, 449, 147), + color=(49, 49, 49), + button=(339, 88, 429, 127), + ), + Button( + file='./assets/en/assignment/ui/CHARACTER_MATERIALS_CLICK.2.png', + area=(143, 98, 234, 120), + search=(319, 68, 449, 147), + color=(61, 59, 57), + button=(143, 98, 234, 120), + ), + ], ) DISPATCHED = ButtonWrapper( name='DISPATCHED', @@ -73,13 +91,22 @@ EXP_MATERIALS_CREDITS_CHECK = ButtonWrapper( color=(178, 177, 174), button=(514, 97, 614, 117), ), - en=Button( - file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.png', - area=(529, 88, 599, 126), - search=(509, 68, 619, 146), - color=(202, 201, 198), - button=(529, 88, 599, 126), - ), + en=[ + Button( + file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.png', + area=(529, 88, 599, 126), + search=(509, 68, 619, 146), + color=(202, 201, 198), + button=(529, 88, 599, 126), + ), + Button( + file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CHECK.2.png', + area=(373, 98, 458, 119), + search=(509, 68, 619, 146), + color=(191, 190, 187), + button=(373, 98, 458, 119), + ), + ], ) EXP_MATERIALS_CREDITS_CLICK = ButtonWrapper( name='EXP_MATERIALS_CREDITS_CLICK', @@ -90,13 +117,22 @@ EXP_MATERIALS_CREDITS_CLICK = ButtonWrapper( color=(61, 60, 60), button=(514, 97, 614, 117), ), - en=Button( - file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.png', - area=(528, 88, 599, 127), - search=(508, 68, 619, 147), - color=(42, 42, 42), - button=(528, 88, 599, 127), - ), + en=[ + Button( + file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.png', + area=(528, 88, 599, 127), + search=(508, 68, 619, 147), + color=(42, 42, 42), + button=(528, 88, 599, 127), + ), + Button( + file='./assets/en/assignment/ui/EXP_MATERIALS_CREDITS_CLICK.2.png', + area=(374, 98, 459, 119), + search=(508, 68, 619, 147), + color=(49, 49, 49), + button=(374, 98, 459, 119), + ), + ], ) GROUP_SEARCH = ButtonWrapper( name='GROUP_SEARCH', @@ -198,13 +234,22 @@ SYNTHESIS_MATERIALS_CHECK = ButtonWrapper( color=(180, 179, 176), button=(708, 97, 783, 117), ), - en=Button( - file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.png', - area=(703, 88, 790, 126), - search=(683, 68, 810, 146), - color=(189, 188, 185), - button=(703, 88, 790, 126), - ), + en=[ + Button( + file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.png', + area=(703, 88, 790, 126), + search=(683, 68, 810, 146), + color=(189, 188, 185), + button=(703, 88, 790, 126), + ), + Button( + file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CHECK.2.png', + area=(624, 97, 715, 119), + search=(683, 68, 810, 146), + color=(197, 196, 193), + button=(624, 97, 715, 119), + ), + ], ) SYNTHESIS_MATERIALS_CLICK = ButtonWrapper( name='SYNTHESIS_MATERIALS_CLICK', @@ -215,11 +260,20 @@ SYNTHESIS_MATERIALS_CLICK = ButtonWrapper( color=(68, 66, 65), button=(709, 97, 783, 117), ), - en=Button( - file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.png', - area=(702, 88, 790, 126), - search=(682, 68, 810, 146), - color=(61, 59, 58), - button=(702, 88, 790, 126), - ), + en=[ + Button( + file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.png', + area=(702, 88, 790, 126), + search=(682, 68, 810, 146), + color=(61, 59, 58), + button=(702, 88, 790, 126), + ), + Button( + file='./assets/en/assignment/ui/SYNTHESIS_MATERIALS_CLICK.2.png', + area=(624, 97, 715, 119), + search=(682, 68, 810, 146), + color=(51, 50, 49), + button=(624, 97, 715, 119), + ), + ], )