mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 13:47:32 +08:00
Fix: Wait is_current_ap_visible with timeout
This commit is contained in:
parent
6a10ddf8df
commit
714c1ce455
@ -148,6 +148,20 @@ class ActionPointHandler(UI, MapEventHandler):
|
||||
self._action_point_total = total
|
||||
|
||||
def action_point_safe_get(self, skip_first_screenshot=True):
|
||||
timeout = Timer(3, count=6).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if self.is_current_ap_visible():
|
||||
break
|
||||
if timeout.reached():
|
||||
logger.warning('Get action points timeout, wait is_current_ap_visible timeout')
|
||||
break
|
||||
|
||||
skip_first_screenshot = True
|
||||
timeout = Timer(1, count=2).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
@ -159,10 +173,6 @@ class ActionPointHandler(UI, MapEventHandler):
|
||||
logger.warning('Get action points timeout')
|
||||
break
|
||||
|
||||
if not self.is_current_ap_visible():
|
||||
timeout.reset()
|
||||
continue
|
||||
|
||||
self.action_point_update()
|
||||
|
||||
# Having too many current AP, probably an OCR error
|
||||
|
Loading…
Reference in New Issue
Block a user