ryland 2 лет назад
Родитель
Сommit
208aade44f
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      tasks/Component/SwitchSoul/switch_soul.py

+ 8 - 5
tasks/Component/SwitchSoul/switch_soul.py

@@ -250,13 +250,16 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
                 break
         logger.info(f'Select team {teamName}')
         # 切换御魂
-        for i in range(5):
-            sleep(0.8)
+        cnt_click: int = 0
+        self.O_SS_TEAM_NAME.keyword = teamName
+        while 1:
             self.screenshot()
-            if self.appear_then_click(self.I_SOU_SWITCH_SURE, interval=1):
+            if cnt_click >= 4:
                 break
-            self.O_SS_TEAM_NAME.keyword = teamName
+            if self.appear_then_click(self.I_SOU_SWITCH_SURE, interval=0.8):
+                continue
             if self.ocr_appear_click_by_rule(self.O_SS_TEAM_NAME, self.I_SOU_CLICK_PRESENT, interval=1.5):
+                cnt_click += 1
                 continue
         logger.info(f'Switch soul_one group {groupName} team {teamName}')
 
@@ -279,7 +282,7 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             return False
 
         x1, y1, w1, h1 = target.area
-        x, y, w, h = action.roi_back
+        x, y = action.coord()
 
         self.device.click(x=x, y=y1, control_name=target.name)
         return True