mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-23 06:18:01 +08:00
Add: added option to bypass exception on device/control
Alas will withdraw from map instead stopped.
This commit is contained in:
@@ -8,9 +8,10 @@ from module.base.utils import *
|
|||||||
from module.device.connection import Connection
|
from module.device.connection import Connection
|
||||||
from module.exception import ScriptError
|
from module.exception import ScriptError
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
from module.map.map import Map
|
||||||
|
|
||||||
|
|
||||||
class Control(Connection):
|
class Control(Connection, Map):
|
||||||
click_record = deque(maxlen=15)
|
click_record = deque(maxlen=15)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -40,9 +41,12 @@ class Control(Connection):
|
|||||||
if sum([1 if str(prev) == str(button) else 0 for prev in self.click_record]) >= 12:
|
if sum([1 if str(prev) == str(button) else 0 for prev in self.click_record]) >= 12:
|
||||||
logger.warning(f'Too many click for a button: {button}')
|
logger.warning(f'Too many click for a button: {button}')
|
||||||
logger.info(f'History click: {[str(prev) for prev in self.click_record]}')
|
logger.info(f'History click: {[str(prev) for prev in self.click_record]}')
|
||||||
raise ScriptError(f'Too many click for a button: {button}')
|
if self.config.ENABLE_EXCEPTION:
|
||||||
|
raise ScriptError(f'Too many click for a button: {button}')
|
||||||
else:
|
else:
|
||||||
|
logger.warning('ScriptError, Withdrawing because enable_exception = no')
|
||||||
self.click_record.append(str(button))
|
self.click_record.append(str(button))
|
||||||
|
self.withdraw()
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user