mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-23 17:11:42 +00:00
95d84d11ac
- 增加了开关控制的函数
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from module.base.base import ModuleBase
|
|
from module.base.switch import Switch
|
|
from module.handler.assets import *
|
|
from module.logger import logger
|
|
|
|
fast_forward = Switch('Fast_Forward')
|
|
fast_forward.add_status('on', check_button=FAST_FORWARD_ON)
|
|
fast_forward.add_status('off', check_button=FAST_FORWARD_OFF)
|
|
fleet_lock = Switch('Fleet_Lock')
|
|
fleet_lock.add_status('on', check_button=FLEET_LOCKED)
|
|
fleet_lock.add_status('off', check_button=FLEET_UNLOCKED)
|
|
|
|
|
|
class FastForwardHandler(ModuleBase):
|
|
def handle_fast_forward(self):
|
|
if not fast_forward.appear(main=self):
|
|
self.config.ENABLE_FAST_FORWARD = False
|
|
self.config.MAP_HAS_AMBUSH = True
|
|
logger.info('No fast forward mode.')
|
|
return False
|
|
|
|
if self.config.ENABLE_FAST_FORWARD:
|
|
self.config.MAP_HAS_AMBUSH = False
|
|
status = 'on'
|
|
else:
|
|
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
|
|
# self.config.MAP_HAS_AMBUSH = True
|
|
status = 'off'
|
|
changed = fast_forward.set(status=status, main=self)
|
|
return changed
|
|
|
|
def handle_map_fleet_lock(self):
|
|
if not fleet_lock.appear(main=self):
|
|
logger.info('No fleet lock option.')
|
|
return False
|
|
logger.info('fleet_lock')
|
|
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
|
|
changed = fleet_lock.set(status=status, main=self)
|
|
return changed
|