From bf3e671f48e2fe61aa76301506aa11ba7dfee08b Mon Sep 17 00:00:00 2001 From: EightyDollars Date: Wed, 22 Nov 2023 13:53:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=9F=BA=E6=8A=A5=E6=9C=AA=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=AE=8C=E5=85=A8=E5=AF=BC=E8=87=B4=E5=9F=BA=E6=8A=A5?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/report.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arknights_mower/solvers/report.py b/arknights_mower/solvers/report.py index 550412db1..dbcba187e 100644 --- a/arknights_mower/solvers/report.py +++ b/arknights_mower/solvers/report.py @@ -3,6 +3,7 @@ import csv import os import datetime +import time import numpy as np import pandas as pd @@ -44,15 +45,18 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None: "合成玉": None, "合成玉订单数量": None, } + self.reload_time = 1 def run(self): if self.has_record(): logger.info("今天的基报看过了") return True - logger.info("康康大基报") + logger.info("康康大基报捏~") try: super().run() return True + except Exception as e: + logger.error(e) except: pass return False @@ -67,7 +71,9 @@ def transition(self) -> bool: elif self.scene() == Scene.CTRLCENTER_ASSISTANT: self.tap_element('control_central_assistants') elif self.scene() == Scene.RIIC_REPORT: - logger.info("找到基报了") + logger.info("看到基报辣") + if self.reload_time > 4: + raise RuntimeError("没找到基报 杂鱼~") return self.read_report() elif self.scene() == Scene.LOADING: self.sleep(3) @@ -81,6 +87,11 @@ def transition(self) -> bool: raise RecognizeError('Unknown scene') def read_report(self): + if not self.locate_report(self.recog.img[0:1080, 1280:1920], 'riic_manufacture'): + logger.info("基报未加载完全") + time.sleep(self.reload_time) + self.reload_time = self.reload_time + 1 + return False try: img = cv2.cvtColor(self.recog.img[0:1080, 1280:1920], cv2.COLOR_BGR2RGB) p0, p1 = self.locate_report(img, 'riic_exp') @@ -106,7 +117,7 @@ def read_report(self): self.record_report() except: - logger.info("基报识别失败 润") + logger.info("你的基报不行啊 杂鱼~") return True def locate_report(self, img, template_name):