Skip to content

Commit

Permalink
Merge pull request #413 from EightyDollars/dev_shawn
Browse files Browse the repository at this point in the history
fix:基报未加载完全导致基报读取失败
  • Loading branch information
ZhaoZuohong authored Nov 22, 2023
2 parents d47ee78 + bf3e671 commit e8406e6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions arknights_mower/solvers/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import csv
import os
import datetime
import time

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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')
Expand All @@ -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):
Expand Down

0 comments on commit e8406e6

Please sign in to comment.