Explorar o código

fix(Component): Update prepare button

ryland %!s(int64=2) %!d(string=hai) anos
pai
achega
f81fcf28fe

+ 2 - 2
tasks/Component/GeneralBattle/assets.py

@@ -70,11 +70,11 @@ class GeneralBattleAssets:
 	# 预设的小图标 
 	# 预设的小图标 
 	I_PRESET = RuleImage(roi_front=(32,650,47,45), roi_back=(32,650,47,45), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset.png")
 	I_PRESET = RuleImage(roi_front=(32,650,47,45), roi_back=(32,650,47,45), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset.png")
 	# 准备 
 	# 准备 
-	I_PREPARE_HIGHLIGHT = RuleImage(roi_front=(1128,536,100,100), roi_back=(1128,536,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png")
+	I_PREPARE_HIGHLIGHT = RuleImage(roi_front=(1119,523,100,100), roi_back=(1119,523,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png")
 	# 战斗胜利 
 	# 战斗胜利 
 	I_WIN = RuleImage(roi_front=(385,47,100,100), roi_back=(296,33,414,224), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_win.png")
 	I_WIN = RuleImage(roi_front=(385,47,100,100), roi_back=(296,33,414,224), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_win.png")
 	# 准备但是界面还未加载这个时候是黑色的 
 	# 准备但是界面还未加载这个时候是黑色的 
-	I_PREPARE_DARK = RuleImage(roi_front=(1131,538,100,100), roi_back=(1131,538,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_dark.png")
+	I_PREPARE_DARK = RuleImage(roi_front=(1118,521,100,100), roi_back=(1118,521,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_prepare_dark.png")
 	# 失败 
 	# 失败 
 	I_FALSE = RuleImage(roi_front=(413,124,100,100), roi_back=(413,124,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_false.png")
 	I_FALSE = RuleImage(roi_front=(413,124,100,100), roi_back=(413,124,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_false.png")
 	# 确认预设的队伍 
 	# 确认预设的队伍 

BIN=BIN
tasks/Component/GeneralBattle/gb/gb_prepare_dark.png


BIN=BIN
tasks/Component/GeneralBattle/gb/gb_prepare_highlight.png


+ 4 - 4
tasks/Component/GeneralBattle/gb/image.json

@@ -20,8 +20,8 @@
   {
   {
     "itemName": "prepare_highlight",
     "itemName": "prepare_highlight",
     "imageName": "gb_prepare_highlight.png",
     "imageName": "gb_prepare_highlight.png",
-    "roiFront": "1128,536,100,100",
-    "roiBack": "1128,536,100,100",
+    "roiFront": "1119,523,100,100",
+    "roiBack": "1119,523,100,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "准备"
     "description": "准备"
@@ -38,8 +38,8 @@
   {
   {
     "itemName": "prepare_dark",
     "itemName": "prepare_dark",
     "imageName": "gb_prepare_dark.png",
     "imageName": "gb_prepare_dark.png",
-    "roiFront": "1131,538,100,100",
-    "roiBack": "1131,538,100,100",
+    "roiFront": "1118,521,100,100",
+    "roiBack": "1118,521,100,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "准备但是界面还未加载这个时候是黑色的"
     "description": "准备但是界面还未加载这个时候是黑色的"

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

@@ -181,6 +181,8 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
                 break
                 break
             if self.appear_then_click(self.I_E_EXPLORATION_CLICK, interval=1):
             if self.appear_then_click(self.I_E_EXPLORATION_CLICK, interval=1):
                 continue
                 continue
+        from time import sleep
+        sleep(1)
         logger.info(f'Enter exploration {layer}')
         logger.info(f'Enter exploration {layer}')
 
 
     def exp_exit(self):
     def exp_exit(self):
@@ -202,7 +204,7 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
         pos_right = 1270
         pos_right = 1270
         pos_left = 260
         pos_left = 260
         pos_top = 390
         pos_top = 390
-        pos_bottom = 620
+        pos_bottom = 500
         pos_level = (pos_top + pos_bottom) / 2
         pos_level = (pos_top + pos_bottom) / 2
 
 
         step_1 = Step('step_1', pos=(pos_right, random.randint(pos_top, pos_bottom)), time=2.1)
         step_1 = Step('step_1', pos=(pos_right, random.randint(pos_top, pos_bottom)), time=2.1)

+ 9 - 7
tasks/Hyakkiyakou/utils/video2images.py

@@ -80,7 +80,7 @@ class TransformVideo(HyakkiyakouAssets):
             if count_frame % frame_skip != 0:
             if count_frame % frame_skip != 0:
                 continue
                 continue
 
 
-            w, h, _ = frame.shape
+            h, w, _ = frame.shape
             if h == 720 and w == 1280:
             if h == 720 and w == 1280:
                 pass
                 pass
             elif h == 720 and w != 1280:
             elif h == 720 and w != 1280:
@@ -96,16 +96,18 @@ class TransformVideo(HyakkiyakouAssets):
                 frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
                 frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
             index_frame += 1
             index_frame += 1
 
 
+            h, w, _ = frame.shape
+
             match mode:
             match mode:
                 case 0:
                 case 0:
-                    img_a = frame[80:, 0:640]
+                    img_a = frame[h-640:, 0:640]
                     img_b = None
                     img_b = None
                 case 1:
                 case 1:
                     img_a = None
                     img_a = None
-                    img_b = frame[80:, 640:1280]
+                    img_b = frame[h-640:, 640:1280]
                 case 2:
                 case 2:
-                    img_a = frame[80:, 0:640]
-                    img_b = frame[80:, 640:1280]
+                    img_a = frame[h-640:, 0:640]
+                    img_b = frame[h-640:, 640:1280]
                 case _:
                 case _:
                     raise ValueError('mode must be 0, 1, or 2')
                     raise ValueError('mode must be 0, 1, or 2')
             if img_a is not None:
             if img_a is not None:
@@ -118,7 +120,7 @@ class TransformVideo(HyakkiyakouAssets):
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
-    VIDEO = r'C:\Users\Ryland\Downloads\202404021234_ssr_021_a.mp4'
+    VIDEO = r'C:\Users\Ryland\Downloads\202404031513.mp4'
     # SAVE_PATH = 'D:/Project/Hyakkiyakou/OnmyojiAutoScript-hyakkiyakou/temp/sources_images'
     # SAVE_PATH = 'D:/Project/Hyakkiyakou/OnmyojiAutoScript-hyakkiyakou/temp/sources_images'
     t = TransformVideo(change_channel=True, interval=0.1)
     t = TransformVideo(change_channel=True, interval=0.1)
-    t.parse_one(VIDEO, mode=1)
+    t.parse_one(VIDEO, mode=2)