mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-02 20:01:12 +08:00
Fix: Catch timeout in _handle_air_raid()
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
import numpy as np
|
|
||||||
|
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.base.utils import get_color, red_overlay_transparency
|
from module.base.utils import get_color, red_overlay_transparency
|
||||||
from module.combat.combat import Combat
|
from module.combat.combat import Combat
|
||||||
@@ -31,11 +29,20 @@ class AmbushHandler(Combat):
|
|||||||
self.MAP_AIR_RAID_OVERLAY_TRANSPARENCY_THRESHOLD
|
self.MAP_AIR_RAID_OVERLAY_TRANSPARENCY_THRESHOLD
|
||||||
|
|
||||||
def _handle_air_raid(self):
|
def _handle_air_raid(self):
|
||||||
|
"""
|
||||||
|
Wait until air raid disappeared
|
||||||
|
"""
|
||||||
logger.info('Map air raid')
|
logger.info('Map air raid')
|
||||||
disappear = Timer(self.MAP_AIR_RAID_CONFIRM_SECOND)
|
disappear = Timer(self.MAP_AIR_RAID_CONFIRM_SECOND).start()
|
||||||
disappear.start()
|
timeout = Timer(2.5, count=2).start()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
# Timeout
|
||||||
|
if timeout.reached():
|
||||||
|
logger.warning('_handle_air_raid timeout, assume air raid disappeared')
|
||||||
|
break
|
||||||
|
# Disappeared
|
||||||
if self._air_raid_appear():
|
if self._air_raid_appear():
|
||||||
disappear.reset()
|
disappear.reset()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user