mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-26 18:20:42 +00:00
Merge pull request #26 from LmeSzinc/master
Fix: Infinite click on switch when switch is unknown
This commit is contained in:
commit
b5f97b328a
@ -1,5 +1,6 @@
|
|||||||
from module.base.base import ModuleBase
|
from module.base.base import ModuleBase
|
||||||
from module.base.button import Button
|
from module.base.button import Button
|
||||||
|
from module.base.timer import Timer
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ class Switch:
|
|||||||
bool:
|
bool:
|
||||||
"""
|
"""
|
||||||
changed = False
|
changed = False
|
||||||
|
warning_show_timer = Timer(5, count=10).start()
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
@ -65,8 +67,12 @@ class Switch:
|
|||||||
matched = data
|
matched = data
|
||||||
if current == status:
|
if current == status:
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
if current == 'unknown':
|
if current == 'unknown':
|
||||||
|
if warning_show_timer.reached():
|
||||||
logger.warning(f'Unknown {self.name} switch')
|
logger.warning(f'Unknown {self.name} switch')
|
||||||
|
warning_show_timer.reset()
|
||||||
|
continue
|
||||||
|
|
||||||
for data in self.status_list:
|
for data in self.status_list:
|
||||||
if data['status'] == status:
|
if data['status'] == status:
|
||||||
|
@ -92,16 +92,25 @@ class InfoHandler(ModuleBase):
|
|||||||
"""
|
"""
|
||||||
Story
|
Story
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
story_popup_timout = Timer(10, count=20)
|
||||||
|
|
||||||
def story_skip(self):
|
def story_skip(self):
|
||||||
if self.handle_popup_confirm():
|
if self.story_popup_timout.started() and not self.story_popup_timout.reached():
|
||||||
|
if self.handle_popup_confirm('STORY_SKIP'):
|
||||||
|
self.story_popup_timout = Timer(10)
|
||||||
return True
|
return True
|
||||||
if self.appear_then_click(STORY_SKIP, offset=True, interval=2):
|
if self.appear_then_click(STORY_SKIP, offset=True, interval=2):
|
||||||
|
self.story_popup_timout.start()
|
||||||
return True
|
return True
|
||||||
if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=True, interval=2):
|
if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=True, interval=2):
|
||||||
|
self.story_popup_timout.start()
|
||||||
return True
|
return True
|
||||||
if self.appear_then_click(STORY_CHOOSE, offset=True, interval=2):
|
if self.appear_then_click(STORY_CHOOSE, offset=True, interval=2):
|
||||||
|
self.story_popup_timout.start()
|
||||||
return True
|
return True
|
||||||
if self.appear_then_click(STORY_CHOOSE_2, offset=True, interval=2):
|
if self.appear_then_click(STORY_CHOOSE_2, offset=True, interval=2):
|
||||||
|
self.story_popup_timout.start()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@ -109,6 +118,8 @@ class InfoHandler(ModuleBase):
|
|||||||
def handle_story_skip(self):
|
def handle_story_skip(self):
|
||||||
if not self.config.ENABLE_MAP_CLEAR_MODE:
|
if not self.config.ENABLE_MAP_CLEAR_MODE:
|
||||||
return False
|
return False
|
||||||
|
if self.config.ENABLE_FAST_FORWARD:
|
||||||
|
return False
|
||||||
|
|
||||||
return self.story_skip()
|
return self.story_skip()
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class UI(ModuleBase):
|
|||||||
"""
|
"""
|
||||||
return self.appear(page.check_button, offset=(20, 20))
|
return self.appear(page.check_button, offset=(20, 20))
|
||||||
|
|
||||||
def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=3,
|
def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=10,
|
||||||
skip_first_screenshot=False):
|
skip_first_screenshot=False):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
|
Loading…
Reference in New Issue
Block a user