diff --git a/assets/cn/login/ACCOUNT_CONFIRM.png b/assets/cn/login/ACCOUNT_CONFIRM.png new file mode 100644 index 000000000..3f08352e7 Binary files /dev/null and b/assets/cn/login/ACCOUNT_CONFIRM.png differ diff --git a/module/device/method/nemu_ipc.py b/module/device/method/nemu_ipc.py index 0fde50d51..86948783a 100644 --- a/module/device/method/nemu_ipc.py +++ b/module/device/method/nemu_ipc.py @@ -469,6 +469,9 @@ class NemuIpc(Platform): """ # Try existing settings first if self.config.EmulatorInfo_path: + if 'MuMuPlayerGlobal' in self.config.EmulatorInfo_path: + logger.info(f'nemu_ipc is not available on MuMuPlayerGlobal, {self.config.EmulatorInfo_path}') + raise RequestHumanTakeover folder = os.path.abspath(os.path.join(self.config.EmulatorInfo_path, '../../')) index = NemuIpcImpl.serial_to_id(self.serial) if index is not None: @@ -488,6 +491,9 @@ class NemuIpc(Platform): if self.emulator_instance is None: logger.error('Unable to use NemuIpc because emulator instance not found') raise RequestHumanTakeover + if 'MuMuPlayerGlobal' in self.emulator_instance.path: + logger.info(f'nemu_ipc is not available on MuMuPlayerGlobal, {self.emulator_instance.path}') + raise RequestHumanTakeover try: return NemuIpcImpl( nemu_folder=self.emulator_instance.emulator.abspath('../'), diff --git a/module/ocr/utils.py b/module/ocr/utils.py index ed6701e80..f05cc181b 100644 --- a/module/ocr/utils.py +++ b/module/ocr/utils.py @@ -51,6 +51,47 @@ def _merge_boxed_result(left: BoxedResult, right: BoxedResult) -> BoxedResult: return left +def merge_result_button( + results: list[BoxedResult], + left_func: callable, + right_func: callable, + text_func: callable +) -> list[BoxedResult]: + """ + Args: + results: + left_func: Function that inputs ocr_text (str) and outputs bool + True means mark as left text + right_func: + text_func: Function that inputs left_text (str) right_text (str) and outputs text (str) + """ + left = None + right = None + for result in results: + if left_func(result.ocr_text): + left = result + elif right_func(result.ocr_text): + right = result + + text = text_func( + left.ocr_text if left is not None else '', + right.ocr_text if right is not None else '' + ) + if left is not None: + if right is not None: + results.remove(right) + left.box = _merge_area(left.box, right.box) + left.ocr_text = text + else: + left.ocr_text = text + else: + if right is not None: + right.ocr_text = text + else: + pass + return results + + def merge_buttons(buttons: list[BoxedResult], thres_x=20, thres_y=20) -> list[BoxedResult]: """ Args: diff --git a/tasks/base/main_page.py b/tasks/base/main_page.py index aa21d14a9..781bc0f7a 100644 --- a/tasks/base/main_page.py +++ b/tasks/base/main_page.py @@ -23,6 +23,10 @@ class OcrPlaneName(OcrWhiteLetterOnComplexBackground): result = result.replace('avatia', 'avalia') # 苏乐达™热砂海选会场 result = re.sub(r'(苏乐达|蘇樂達|SoulGlad|スラーダ|FelizAlma)[rtT]*M*', r'\1', result) + # SoulGladtM Scorchsand Audition Ven + if 'Audition' in result: + right = result.find('Audition') + len('Audition') + result = result[:right] + ' Venue' # 幽囚狱 result = result.replace('幽因狱', '幽囚狱') result = result.replace('幽因獄', '幽囚獄') diff --git a/tasks/dungeon/ui/llist.py b/tasks/dungeon/ui/llist.py index e49c02d59..f35eac294 100644 --- a/tasks/dungeon/ui/llist.py +++ b/tasks/dungeon/ui/llist.py @@ -1,4 +1,5 @@ import re +from copy import copy import cv2 from pponnxcr.predict_system import BoxedResult @@ -10,7 +11,7 @@ from module.base.timer import Timer from module.base.utils import area_center, area_limit, area_offset, crop, image_size from module.logger import logger from module.ocr.ocr import Ocr, OcrResultButton -from module.ocr.utils import split_and_pair_button_attr, split_and_pair_buttons +from module.ocr.utils import merge_result_button, split_and_pair_button_attr, split_and_pair_buttons from module.ui.draggable_list import DraggableList from module.ui.switch import Switch from tasks.base.page import page_guide @@ -40,6 +41,7 @@ class OcrDungeonName(Ocr): # 苏乐达™热砂海选会场 result = re.sub(r'(苏乐达|蘇樂達|SoulGlad|スラーダ|FelizAlma)[rtT]*M*', r'\1', result) result = re.sub(r'["\']', '', result) + result = re.sub('Aud[it]+on', 'Audition', result) result = super().after_process(result) @@ -106,6 +108,17 @@ class OcrDungeonList(OcrDungeonName): else: result.box = area_offset(result.box, offset=OCR_DUNGEON_NAME.area[:2]) + before = copy(results) + # Calyx_Crimson_The_Hunt_Penacony_SoulGladScorchsandAuditionVenue + merge_result_button( + results, + left_func=lambda x: 'Audition' in x, + right_func=lambda x: 'Venue' in x, + text_func=lambda l, r: f'SoulGladScorchsandAuditionVenue' + ) + if results != before: + logger.attr(name=self.name, + text=str([result.ocr_text for result in results])) return results def _match_result(self, *args, **kwargs): diff --git a/tasks/login/assets/assets_login.py b/tasks/login/assets/assets_login.py index e7f36c8f0..a91813695 100644 --- a/tasks/login/assets/assets_login.py +++ b/tasks/login/assets/assets_login.py @@ -3,6 +3,17 @@ from module.base.button import Button, ButtonWrapper # This file was auto-generated, do not modify it manually. To generate: # ``` python -m dev_tools.button_extract ``` +ACCOUNT_CONFIRM = ButtonWrapper( + name='ACCOUNT_CONFIRM', + cn=Button( + file='./assets/cn/login/ACCOUNT_CONFIRM.png', + area=(583, 424, 696, 450), + search=(563, 404, 716, 470), + color=(172, 145, 92), + button=(583, 424, 696, 450), + ), + en=None, +) LOGIN_CONFIRM = ButtonWrapper( name='LOGIN_CONFIRM', share=[ diff --git a/tasks/login/login.py b/tasks/login/login.py index 412220ac0..fd1889ed9 100644 --- a/tasks/login/login.py +++ b/tasks/login/login.py @@ -3,7 +3,7 @@ from module.exception import GameNotRunningError from module.logger import logger from tasks.base.page import page_main from tasks.base.ui import UI -from tasks.login.assets.assets_login import LOGIN_CONFIRM, LOGIN_LOADING, USER_AGREEMENT_ACCEPT +from tasks.login.assets.assets_login import * from tasks.login.cloud import LoginAndroidCloud @@ -62,6 +62,8 @@ class Login(UI, LoginAndroidCloud): continue if self.appear_then_click(USER_AGREEMENT_ACCEPT): continue + if self.appear_then_click(ACCOUNT_CONFIRM): + continue # Additional if self.handle_popup_single(): continue