mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-15 08:59:47 +08:00
Fix: Wait is_current_ap_visible with timeout
This commit is contained in:
@@ -148,6 +148,20 @@ class ActionPointHandler(UI, MapEventHandler):
|
|||||||
self._action_point_total = total
|
self._action_point_total = total
|
||||||
|
|
||||||
def action_point_safe_get(self, skip_first_screenshot=True):
|
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()
|
timeout = Timer(1, count=2).start()
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
@@ -159,10 +173,6 @@ class ActionPointHandler(UI, MapEventHandler):
|
|||||||
logger.warning('Get action points timeout')
|
logger.warning('Get action points timeout')
|
||||||
break
|
break
|
||||||
|
|
||||||
if not self.is_current_ap_visible():
|
|
||||||
timeout.reset()
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.action_point_update()
|
self.action_point_update()
|
||||||
|
|
||||||
# Having too many current AP, probably an OCR error
|
# Having too many current AP, probably an OCR error
|
||||||
|
|||||||
Reference in New Issue
Block a user