mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: [TW] SOS chapter 10 is OCRed as 0
This commit is contained in:
parent
a0e00fc74d
commit
458986553a
@ -43,13 +43,17 @@ class Ocr:
|
||||
def cnocr(self) -> "AlOcr":
|
||||
return OCR_MODEL.__getattribute__(self.lang)
|
||||
|
||||
@cached_property
|
||||
@property
|
||||
def buttons(self):
|
||||
buttons = self._buttons
|
||||
buttons = buttons if isinstance(buttons, list) else [buttons]
|
||||
buttons = [button.area if isinstance(button, Button) else button for button in buttons]
|
||||
return buttons
|
||||
|
||||
@buttons.setter
|
||||
def buttons(self, value):
|
||||
self._buttons = value
|
||||
|
||||
def pre_process(self, image):
|
||||
"""
|
||||
Args:
|
||||
|
||||
@ -44,6 +44,16 @@ class CampaignSos(CampaignRun, CampaignBase):
|
||||
def _sos_scroll(self):
|
||||
return Scroll(SOS_SCROLL_AREA, color=(164, 173, 189), name='SOS_SCROLL')
|
||||
|
||||
@cached_property
|
||||
@Config.when(SERVER='tw')
|
||||
def _sos_chapter_ocr(self):
|
||||
return Digit([], letter=[173, 247, 74], threshold=180, name='OCR_SOS_CHAPTER')
|
||||
|
||||
@cached_property
|
||||
@Config.when(SERVER=None)
|
||||
def _sos_chapter_ocr(self):
|
||||
return Digit([], letter=[132, 230, 115], threshold=136, name='OCR_SOS_CHAPTER')
|
||||
|
||||
def _find_target_chapter(self, chapter):
|
||||
"""
|
||||
find the target chapter search button or goto button.
|
||||
@ -63,8 +73,8 @@ class CampaignSos(CampaignRun, CampaignBase):
|
||||
return None
|
||||
|
||||
chapter_buttons = [button.crop(self._sos_chapter_crop) for button in all_buttons]
|
||||
ocr_chapters = Digit(chapter_buttons, letter=[132, 230, 115], threshold=136, name='OCR_SOS_CHAPTER')
|
||||
chapter_list = ocr_chapters.ocr(self.device.image)
|
||||
self._sos_chapter_ocr.buttons = chapter_buttons
|
||||
chapter_list = self._sos_chapter_ocr.ocr(self.device.image)
|
||||
if not isinstance(chapter_list, list):
|
||||
chapter_list = [chapter_list]
|
||||
if chapter in chapter_list:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user