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

feat(costume): Add all battle theme

ryland 2 лет назад
Родитель
Сommit
90062da0fe

+ 1 - 1
module/logger.py

@@ -113,7 +113,7 @@ def set_file_logger(name=pyw_name):
         no_color=True,
         highlight=False,
         width=160,
-    )
+    ) 
 
     hdlr = RichFileHandler(
         console=file_console,

+ 18 - 12
tasks/Component/Costume/costume_base.py

@@ -3,6 +3,7 @@
 # github https://github.com/runhey
 
 from module.atom.image import RuleImage
+from module.logger import logger
 
 from tasks.Component.Costume.config import (MainType, CostumeConfig, RealmType,
                                             ThemeType, ShikigamiType, SignType, BattleType)
@@ -83,26 +84,28 @@ battle_theme_model = {
         'I_FRIENDS': 'I_FRIENDS_2',
     },
     BattleType.COSTUME_BATTLE_3: {
-        'I_LOCAL': 'I_LOCAL_1',
-        'I_EXIT': 'I_EXIT_1',
-        'I_FRIENDS': 'I_FRIENDS_1',
+        'I_LOCAL': 'I_LOCAL_3',
+        'I_EXIT': 'I_EXIT_3',
+        'I_FRIENDS': 'I_FRIENDS_3',
     },
     BattleType.COSTUME_BATTLE_4: {
-        'I_LOCAL': 'I_LOCAL_1',
-        'I_EXIT': 'I_EXIT_1',
-        'I_FRIENDS': 'I_FRIENDS_1',
+        'I_LOCAL': 'I_LOCAL_4',
+        'I_EXIT': 'I_EXIT_4',
+        'I_FRIENDS': 'I_FRIENDS_4',
     },
     BattleType.COSTUME_BATTLE_5: {
-        'I_LOCAL': 'I_LOCAL_1',
-        'I_EXIT': 'I_EXIT_1',
-        'I_FRIENDS': 'I_FRIENDS_1',
+        'I_LOCAL': 'I_LOCAL_5',
+        'I_EXIT': 'I_EXIT_5',
+        'I_FRIENDS': 'I_FRIENDS_5',
     },
     BattleType.COSTUME_BATTLE_6: {
-        'I_LOCAL': 'I_LOCAL_1',
-        'I_EXIT': 'I_EXIT_1',
-        'I_FRIENDS': 'I_FRIENDS_1',
+        'I_LOCAL': 'I_LOCAL_6',
+        'I_EXIT': 'I_EXIT_6',
+        'I_FRIENDS': 'I_FRIENDS_6',
     },
 }
+
+
 class CostumeBase:
 
     def check_costume(self, config: CostumeConfig=None):
@@ -129,6 +132,7 @@ class CostumeBase:
     def check_costume_main(self, main_type: MainType):
         if main_type == MainType.COSTUME_MAIN:
             return
+        logger.info(f'Switch main costume to {main_type}')
         costume_assets = CostumeAssets()
         for key, value in main_costume_model[main_type].items():
             assert_value: RuleImage = getattr(costume_assets, value)
@@ -137,6 +141,7 @@ class CostumeBase:
     def check_costume_realm(self, realm_type: RealmType):
         if realm_type == RealmType.COSTUME_REALM_DEFAULT:
             return
+        logger.info(f'Switch realm theme {realm_type}')
         costume_realm_assets = CostumeRealmAssets()
         for key, value in realm_costume_model[realm_type].items():
             assert_value: RuleImage = getattr(costume_realm_assets, value)
@@ -145,6 +150,7 @@ class CostumeBase:
     def check_costume_battle(self, battle_type: BattleType):
         if battle_type == BattleType.COSTUME_BATTLE_DEFAULT:
             return
+        logger.info(f'Switch battle theme {battle_type}')
         costume_battle_assets = CostumeBattleAssets()
         for key, value in battle_theme_model[battle_type].items():
             assert_value: RuleImage = getattr(costume_battle_assets, value)

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

@@ -28,3 +28,39 @@ class CostumeBattleAssets:
 	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")
 
 
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_3 = RuleImage(roi_front=(29,567,23,25), roi_back=(29,567,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle3/battle3_local_3.png")
+	# 左上角退出 
+	I_EXIT_3 = RuleImage(roi_front=(23,18,27,31), roi_back=(23,18,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle3/battle3_exit_3.png")
+	# 左上角好友 
+	I_FRIENDS_3 = RuleImage(roi_front=(89,17,35,34), roi_back=(89,17,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle3/battle3_friends_3.png")
+
+
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_4 = RuleImage(roi_front=(29,567,23,25), roi_back=(29,567,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle4/battle4_local_4.png")
+	# 左上角退出 
+	I_EXIT_4 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle4/battle4_exit_4.png")
+	# 左上角好友 
+	I_FRIENDS_4 = RuleImage(roi_front=(88,16,35,34), roi_back=(88,16,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle4/battle4_friends_4.png")
+
+
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_5 = RuleImage(roi_front=(30,567,23,25), roi_back=(30,567,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle5/battle5_local_5.png")
+	# 左上角退出 
+	I_EXIT_5 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle5/battle5_exit_5.png")
+	# 左上角好友 
+	I_FRIENDS_5 = RuleImage(roi_front=(90,17,35,34), roi_back=(90,17,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle5/battle5_friends_5.png")
+
+
+	# Image Rule Assets
+	# 指针 
+	I_LOCAL_6 = RuleImage(roi_front=(30,566,23,25), roi_back=(30,566,23,25), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle6/battle6_local_6.png")
+	# 左上角退出 
+	I_EXIT_6 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle6/battle6_exit_6.png")
+	# 左上角好友 
+	I_FRIENDS_6 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle6/battle6_friends_6.png")
+
+

BIN
tasks/Component/CostumeBattle/battle3/battle3_exit_3.png


BIN
tasks/Component/CostumeBattle/battle3/battle3_friends_3.png


BIN
tasks/Component/CostumeBattle/battle3/battle3_local_3.png


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

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_3",
+    "imageName": "battle3_local_3.png",
+    "roiFront": "29,567,23,25",
+    "roiBack": "29,567,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_3",
+    "imageName": "battle3_exit_3.png",
+    "roiFront": "23,18,27,31",
+    "roiBack": "23,18,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_3",
+    "imageName": "battle3_friends_3.png",
+    "roiFront": "89,17,35,34",
+    "roiBack": "89,17,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  }
+]

BIN
tasks/Component/CostumeBattle/battle4/battle1_friends_4.png


BIN
tasks/Component/CostumeBattle/battle4/battle4_exit_4.png


BIN
tasks/Component/CostumeBattle/battle4/battle4_local_4.png


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

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_4",
+    "imageName": "battle4_local_4.png",
+    "roiFront": "29,567,23,25",
+    "roiBack": "29,567,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_4",
+    "imageName": "battle4_exit_4.png",
+    "roiFront": "22,17,27,31",
+    "roiBack": "22,17,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_4",
+    "imageName": "battle4_friends_4.png",
+    "roiFront": "88,16,35,34",
+    "roiBack": "88,16,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  }
+]

BIN
tasks/Component/CostumeBattle/battle5/battle5_exit_5.png


BIN
tasks/Component/CostumeBattle/battle5/battle5_friends_5.png


BIN
tasks/Component/CostumeBattle/battle5/battle5_local_5.png


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

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_5",
+    "imageName": "battle5_local_5.png",
+    "roiFront": "30,567,23,25",
+    "roiBack": "30,567,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_5",
+    "imageName": "battle5_exit_5.png",
+    "roiFront": "22,17,27,31",
+    "roiBack": "22,17,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_5",
+    "imageName": "battle5_friends_5.png",
+    "roiFront": "90,17,35,34",
+    "roiBack": "90,17,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  }
+]

BIN
tasks/Component/CostumeBattle/battle6/battle1_friends_6.png


BIN
tasks/Component/CostumeBattle/battle6/battle6_exit_6.png


BIN
tasks/Component/CostumeBattle/battle6/battle6_local_6.png


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

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "local_6",
+    "imageName": "battle6_local_6.png",
+    "roiFront": "30,566,23,25",
+    "roiBack": "30,566,23,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  },
+  {
+    "itemName": "exit_6",
+    "imageName": "battle6_exit_6.png",
+    "roiFront": "22,17,27,31",
+    "roiBack": "22,17,27,31",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_6",
+    "imageName": "battle6_friends_6.png",
+    "roiFront": "89,18,35,34",
+    "roiBack": "89,18,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  }
+]