mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 17:57:01 +08:00
Opt: Add load_offset method to Button class
It will be useful in the future
This commit is contained in:
@@ -88,6 +88,16 @@ class Button:
|
||||
self.image = np.array(image.crop(self.area))
|
||||
return self.color
|
||||
|
||||
def load_offset(self, button):
|
||||
"""
|
||||
Load offset from another button.
|
||||
|
||||
Args:
|
||||
button (Button):
|
||||
"""
|
||||
offset = np.subtract(button.button, button._button)[:2]
|
||||
self._button_offset = area_offset(self._button, offset=offset)
|
||||
|
||||
def ensure_template(self):
|
||||
"""
|
||||
Load asset image.
|
||||
|
||||
@@ -18,13 +18,12 @@ class GlobeOperation(MapEventHandler):
|
||||
Returns:
|
||||
Button:
|
||||
"""
|
||||
for button in ZONE_TYPES:
|
||||
if self.appear(button, offset=(20, 20)):
|
||||
offset = np.subtract(button.button, button._button)[:2]
|
||||
for change in ASSETS_PINNED_ZONE:
|
||||
change._button_offset = area_offset(change._button, offset=offset)
|
||||
for zone in ZONE_TYPES:
|
||||
if self.appear(zone, offset=(20, 20)):
|
||||
for button in ASSETS_PINNED_ZONE:
|
||||
button.load_offset(zone)
|
||||
|
||||
return button
|
||||
return zone
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user