1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-18 15:01:29 +08:00

Opt: Template.match_result returns similarity and Button

- Add Button.move() Button.crop()
This commit is contained in:
LmeSzinc
2021-06-30 13:59:24 +08:00
parent 672d459469
commit cf5bfbc9a7
6 changed files with 71 additions and 15 deletions

View File

@@ -20,11 +20,9 @@ class CampaignBase(CampaignBase_):
if '-5' not in name:
return super().campaign_get_entrance(name)
sim, point = TEMPLATE_STAGE_SOS.match_result(self.device.image)
sim, button = TEMPLATE_STAGE_SOS.match_result(self.device.image)
if sim < 0.85:
raise CampaignNameError
button = area_offset(area=(-12, -12, 44, 32), offset=point)
color = get_color(self.device.image, button)
entrance = Button(area=button, color=color, button=button, name=name)
entrance = button.crop((-12, -12, 44, 32), image=self.device.image, name=name)
return entrance

View File

@@ -27,13 +27,11 @@ class CampaignBase(CampaignBase_):
"""
template = dic_archives_template[name]
sim, point = template.match_result(self.device.image)
sim, button = template.match_result(self.device.image)
if sim < 0.85:
return None
button = area_offset(area=(-12, -12, 44, 32), offset=point)
color = get_color(self.device.image, button)
entrance = Button(area=button, color=color, button=button, name=name)
entrance = button.crop((-12, -12, 44, 32), image=self.device.image, name=name)
return entrance
def _search_archives_entrance(self, name, skip_first_screenshot=True):