runhey %!s(int64=3) %!d(string=hai) anos
pai
achega
b0c9b0dfe5

+ 1 - 1
tasks/Component/SwitchSoul/assets.py

@@ -75,7 +75,7 @@ class SwitchSoulAssets:
 
 
 	# Swipe Rule Assets
 	# Swipe Rule Assets
 	# 列表的向上滑动 
 	# 列表的向上滑动 
-	S_SS_GROUP_SWIPE_UP = RuleSwipe(roi_front=(1154,180,23,21), roi_back=(1153,322,21,21), mode="default", name="ss_group_swipe_up")
+	S_SS_GROUP_SWIPE_UP = RuleSwipe(roi_front=(1154,180,90,21), roi_back=(1153,322,86,21), mode="default", name="ss_group_swipe_up")
 	# 列表的向下滑动 
 	# 列表的向下滑动 
 	S_SS_GROUP_SWIPE_DOWN = RuleSwipe(roi_front=(1155,388,21,22), roi_back=(1152,177,22,24), mode="default", name="ss_group_swipe_down")
 	S_SS_GROUP_SWIPE_DOWN = RuleSwipe(roi_front=(1155,388,21,22), roi_back=(1152,177,22,24), mode="default", name="ss_group_swipe_down")
 	# 阵容向上滑动 
 	# 阵容向上滑动 

+ 2 - 2
tasks/Component/SwitchSoul/ss/swipe.json

@@ -1,8 +1,8 @@
 [
 [
   {
   {
     "itemName": "ss_group_swipe_up",
     "itemName": "ss_group_swipe_up",
-    "roiFront": "1154,180,23,21",
-    "roiBack": "1153,322,21,21",
+    "roiFront": "1154,180,90,21",
+    "roiBack": "1153,322,86,21",
     "mode": "default",
     "mode": "default",
     "description": "列表的向上滑动"
     "description": "列表的向上滑动"
   },
   },

+ 25 - 18
tasks/Component/SwitchSoul/switch_soul.py

@@ -168,19 +168,19 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
         保证在式神录的界面
         保证在式神录的界面
         :return:
         :return:
         """
         """
+        logger.hr('Switch soul by name')
         # 滑动至分组最上层
         # 滑动至分组最上层
+        last_group_text = ''
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
             compare1 = self.O_SS_GROUP_NAME.detect_and_ocr(self.device.image)
             compare1 = self.O_SS_GROUP_NAME.detect_and_ocr(self.device.image)
-            text1 = str([result.ocr_text for result in compare1])
-            # 向上滑动
-            self.swipe(self.S_SS_GROUP_SWIPE_UP, 6)
-            self.screenshot()
-            compare2 = self.O_SS_GROUP_NAME.detect_and_ocr(self.device.image)
-            text2 = str([result.ocr_text for result in compare2])
-            # 相等时 滑动到最上层
-            if text1 == text2:
+            now_group_text = str([result.ocr_text for result in compare1])
+            if now_group_text == last_group_text:
                 break
                 break
+            self.swipe(self.S_SS_GROUP_SWIPE_UP, 2)
+            sleep(2.5)
+            last_group_text = now_group_text
+        logger.info('Swipe to top of group')
 
 
         # 判断有无目标分组
         # 判断有无目标分组
         while 1:
         while 1:
@@ -194,6 +194,8 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             if result and len(result) > 0:
             if result and len(result) > 0:
                 break
                 break
             self.swipe(self.S_SS_GROUP_SWIPE_DOWN)
             self.swipe(self.S_SS_GROUP_SWIPE_DOWN)
+            sleep(1.5)
+        logger.info('Swipe down to find target group')
 
 
         # 选中分组
         # 选中分组
         while 1:
         while 1:
@@ -201,20 +203,22 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             self.O_SS_GROUP_NAME.keyword = groupName
             self.O_SS_GROUP_NAME.keyword = groupName
             if self.ocr_appear_click(self.O_SS_GROUP_NAME):
             if self.ocr_appear_click(self.O_SS_GROUP_NAME):
                 break
                 break
+        logger.info(f'Select group {groupName}')
 
 
         # 滑动至阵容最上层
         # 滑动至阵容最上层
+        last_team_text = ''
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
             compare1 = self.O_SS_TEAM_NAME.detect_and_ocr(self.device.image)
             compare1 = self.O_SS_TEAM_NAME.detect_and_ocr(self.device.image)
-            text1 = str([result.ocr_text for result in compare1])
+            now_team_text = str([result.ocr_text for result in compare1])
             # 向上滑动
             # 向上滑动
-            self.swipe(self.S_SS_TEAM_SWIPE_DOWN, 6)
-            self.screenshot()
-            compare2 = self.O_SS_TEAM_NAME.detect_and_ocr(self.device.image)
-            text2 = str([result.ocr_text for result in compare2])
-            # 相等时 说明滑动到最上层
-            if text1 == text2:
+            if now_team_text == last_team_text:
                 break
                 break
+            self.swipe(self.S_SS_TEAM_SWIPE_DOWN, 1.5)
+            sleep(2)
+            last_team_text = now_team_text
+        logger.info('Swipe to top of team')
+
         # 判断当前分组有无目标阵容
         # 判断当前分组有无目标阵容
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
@@ -227,6 +231,7 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             if result and len(result) > 0:
             if result and len(result) > 0:
                 break
                 break
             self.swipe(self.S_SS_TEAM_SWIPE_UP)
             self.swipe(self.S_SS_TEAM_SWIPE_UP)
+        logger.info('Swipe up to find target team')
 
 
         # 选中分组
         # 选中分组
         while 1:
         while 1:
@@ -234,8 +239,9 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
             self.O_SS_TEAM_NAME.keyword = teamName
             self.O_SS_TEAM_NAME.keyword = teamName
             if self.ocr_appear_click(self.O_SS_TEAM_NAME):
             if self.ocr_appear_click(self.O_SS_TEAM_NAME):
                 break
                 break
+        logger.info(f'Select team {teamName}')
         # 切换御魂
         # 切换御魂
-        for i in range(6):
+        for i in range(5):
             sleep(0.8)
             sleep(0.8)
             self.screenshot()
             self.screenshot()
             self.O_SS_TEAM_NAME.keyword = teamName
             self.O_SS_TEAM_NAME.keyword = teamName
@@ -245,6 +251,7 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
                 break
                 break
         logger.info(f'Switch soul_one group {groupName} team {teamName}')
         logger.info(f'Switch soul_one group {groupName} team {teamName}')
 
 
+
     def ocr_appear_click_by_rule(self,
     def ocr_appear_click_by_rule(self,
                          target: RuleOcr,
                          target: RuleOcr,
                          action: Union[RuleClick, RuleLongClick] = None,
                          action: Union[RuleClick, RuleLongClick] = None,
@@ -277,6 +284,6 @@ if __name__ == '__main__':
     s = SwitchSoul(c, d)
     s = SwitchSoul(c, d)
 
 
     s.click_preset()
     s.click_preset()
-    s.switch_soul_one(4, 1)
+    # s.switch_soul_one(4, 1)
     # s.switch_soul_by_name('契灵', '茨球')
     # s.switch_soul_by_name('契灵', '茨球')
-    # s.switch_soul_by_name('默认分组', '结界突破2')
+    s.switch_soul_by_name('默认分组', '队伍5')