Explorar el Código

Merge pull request #954 from Rain1231244/fix(Exploration_swipe_stuck)

修复探索无限滑动不报错的问题
huangrunheng hace 1 año
padre
commit
22bcc6e9e0
Se han modificado 2 ficheros con 11 adiciones y 2 borrados
  1. 7 1
      tasks/Exploration/base.py
  2. 4 1
      tasks/Hyakkiyakou/utils/exp_test.py

+ 7 - 1
tasks/Exploration/base.py

@@ -22,7 +22,7 @@ from tasks.Utils.config_enum import ShikigamiClass
 
 
 from module.logger import logger
 from module.logger import logger
 from module.base.timer import Timer
 from module.base.timer import Timer
-from module.exception import RequestHumanTakeover, TaskEnd
+from module.exception import RequestHumanTakeover, TaskEnd, GameStuckError
 from module.atom.image_grid import ImageGrid
 from module.atom.image_grid import ImageGrid
 from module.atom.animate import RuleAnimate
 from module.atom.animate import RuleAnimate
 from module.base.utils import load_image
 from module.base.utils import load_image
@@ -151,8 +151,14 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
             self.device.click_record_clear()
             self.device.click_record_clear()
             self.swipe(self.S_SWIPE_LEVEL_UP)
             self.swipe(self.S_SWIPE_LEVEL_UP)
             swipeCount += 1
             swipeCount += 1
+            debug_info = f"Swiped {swipeCount} times, current exploration level: {text1}"
+            logger.info(debug_info)
             if swipeCount >= 25:
             if swipeCount >= 25:
+                raise GameStuckError(
+                    f"Swiped too many times ({swipeCount}), seems stuck in exploration level selection"
+                )
                 return False
                 return False
+            time.sleep(1)
 
 
         # 选中对应章节
         # 选中对应章节
         while 1:
         while 1:

+ 4 - 1
tasks/Hyakkiyakou/utils/exp_test.py

@@ -23,7 +23,7 @@ from tasks.Exploration.config import ExplorationLevel
 
 
 from utils import usage_time
 from utils import usage_time
 from fast_device import FastDevice
 from fast_device import FastDevice
-
+from module.exception import GameStuckError
 
 
 class Step:
 class Step:
     def __init__(self,
     def __init__(self,
@@ -342,6 +342,9 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
             self.swipe(self.S_SWIPE_LEVEL_UP)
             self.swipe(self.S_SWIPE_LEVEL_UP)
             swipeCount += 1
             swipeCount += 1
             if swipeCount >= 25:
             if swipeCount >= 25:
+                raise GameStuckError(
+                    f"Swiped too many times ({swipeCount}), seems stuck in exploration level selection"
+                )
                 return False
                 return False
         self.config.model.script.device.control_method = ControlMethod.WINDOW_MESSAGE
         self.config.model.script.device.control_method = ControlMethod.WINDOW_MESSAGE