diff --git a/src/tasks/BaseGfTask.py b/src/tasks/BaseGfTask.py index 5acd861..f6b714b 100644 --- a/src/tasks/BaseGfTask.py +++ b/src/tasks/BaseGfTask.py @@ -98,12 +98,30 @@ def skip_dialogs(self, end_match, end_box=None, time_out=120, has_dialog=True, r self.back() self.sleep(1) else: - if has_dialog: + if has_dialog and not self._is_loading_frame(boxes): self.click_relative(0.95, 0.04) self.sleep(2) self.next_frame() if raise_if_not_found: raise Exception('跳过剧情超时!') + + def _is_loading_frame(self, boxes): + """ + 判断当前帧是否为加载界面。 + :param boxes: OCR 识别结果 + :return: True 如果是加载界面,否则 False + """ + if not boxes: + return True + for box in boxes: + name = box.name + if not name: + continue + if '资源加载中' in name: + return True + if re.search(r'\d{1,3}%', name): + return True + return False def auto_battle(self, end_match=None, end_box=None, has_dialog=False, need_click_auto=False, has_dialog_behind_start=False):