Просмотр исходного кода

feat(Costume): Add Battle costume '蝶寻花踪'

huangrunheng 2 лет назад
Родитель
Сommit
44ff784c3a

+ 36 - 3
tasks/Component/Costume/costume_base.py

@@ -77,6 +77,31 @@ battle_theme_model = {
         'I_EXIT': 'I_EXIT_1',
         'I_FRIENDS': 'I_FRIENDS_1',
     },
+    BattleType.COSTUME_BATTLE_2: {
+        'I_LOCAL': 'I_LOCAL_2',
+        'I_EXIT': 'I_EXIT_2',
+        'I_FRIENDS': 'I_FRIENDS_2',
+    },
+    BattleType.COSTUME_BATTLE_3: {
+        'I_LOCAL': 'I_LOCAL_1',
+        'I_EXIT': 'I_EXIT_1',
+        'I_FRIENDS': 'I_FRIENDS_1',
+    },
+    BattleType.COSTUME_BATTLE_4: {
+        'I_LOCAL': 'I_LOCAL_1',
+        'I_EXIT': 'I_EXIT_1',
+        'I_FRIENDS': 'I_FRIENDS_1',
+    },
+    BattleType.COSTUME_BATTLE_5: {
+        'I_LOCAL': 'I_LOCAL_1',
+        'I_EXIT': 'I_EXIT_1',
+        'I_FRIENDS': 'I_FRIENDS_1',
+    },
+    BattleType.COSTUME_BATTLE_6: {
+        'I_LOCAL': 'I_LOCAL_1',
+        'I_EXIT': 'I_EXIT_1',
+        'I_FRIENDS': 'I_FRIENDS_1',
+    },
 }
 class CostumeBase:
 
@@ -87,13 +112,17 @@ class CostumeBase:
         self.check_costume_realm(config.costume_realm_type)
         self.check_costume_battle(config.costume_battle_type)
 
-    def replace_img(self, asset_before: str, asset_after: RuleImage):
+    def replace_img(self,
+                    asset_before: str,
+                    asset_after: RuleImage,
+                    rp_roi_back: bool = True):
         if not hasattr(self, asset_before):
             return
         # setattr(self, asset_before, asset_after)
         asset_before_object: RuleImage = getattr(self, asset_before)
         asset_before_object.roi_front = asset_after.roi_front
-        asset_before_object.roi_back = asset_after.roi_back
+        if rp_roi_back:
+            asset_before_object.roi_back = asset_after.roi_back
         asset_before_object.threshold = asset_after.threshold
         asset_before_object.file = asset_after.file
 
@@ -119,7 +148,11 @@ class CostumeBase:
         costume_battle_assets = CostumeBattleAssets()
         for key, value in battle_theme_model[battle_type].items():
             assert_value: RuleImage = getattr(costume_battle_assets, value)
-            self.replace_img(key, assert_value)
+            # 绿标的坐标点范围不变
+            if key == 'I_LOCAL':
+                self.replace_img(key, assert_value, rp_roi_back=False)
+            else:
+                self.replace_img(key, assert_value)
 
 
 if __name__ == '__main__':

+ 30 - 0
tasks/Component/CostumeBattle/assets.py

@@ -0,0 +1,30 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class CostumeBattleAssets: 
+
+
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_1 = RuleImage(roi_front=(119,493,23,25), roi_back=(119,493,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle1/battle1_local_1.png")
+	# 左上角退出 
+	I_EXIT_1 = RuleImage(roi_front=(21,20,27,31), roi_back=(21,20,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle1/battle1_exit_1.png")
+	# 左上角好友 
+	I_FRIENDS_1 = RuleImage(roi_front=(88,18,35,34), roi_back=(88,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle1/battle1_friends_1.png")
+
+
+	# Image Rule Assets
+	# description 
+	I_LOCAL_2 = RuleImage(roi_front=(30,569,21,22), roi_back=(30,569,21,22), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_local_2.png")
+	# description 
+	I_EXIT_2 = RuleImage(roi_front=(17,16,35,34), roi_back=(17,16,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_exit_2.png")
+	# description 
+	I_FRIENDS_2 = RuleImage(roi_front=(88,15,34,39), roi_back=(88,15,34,39), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_friends_2.png")
+
+

BIN
tasks/Component/CostumeBattle/battle1/battle1_exit_1.png


BIN
tasks/Component/CostumeBattle/battle1/battle1_friends_1.png


BIN
tasks/Component/CostumeBattle/battle1/battle1_local_1.png


BIN
tasks/Component/CostumeBattle/battle2/battle2_exit_2.png


BIN
tasks/Component/CostumeBattle/battle2/battle2_friends_2.png


BIN
tasks/Component/CostumeBattle/battle2/battle2_local_2.png


+ 29 - 0
tasks/Component/CostumeBattle/battle2/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_2",
+    "imageName": "battle2_local_2.png",
+    "roiFront": "30,569,21,22",
+    "roiBack": "30,569,21,22",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "exit_2",
+    "imageName": "battle2_exit_2.png",
+    "roiFront": "17,16,35,34",
+    "roiBack": "17,16,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "friends_2",
+    "imageName": "battle2_friends_2.png",
+    "roiFront": "88,15,34,39",
+    "roiBack": "88,15,34,39",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]