Skip to content

Commit 71e3326

Browse files
committed
refactor(SwitchSoul): Reuse shared confirm button across costume flows
- replace dedicated soul switch confirmation assets with self.I_UI_CONFIRM - remove duplicate confirmation templates from all shikigami costumes - update related assets, JSON metadata, and task call sites
1 parent cdde0e4 commit 71e3326

35 files changed

Lines changed: 37 additions & 172 deletions

‎tasks/AbyssShadows/script_task.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from tasks.RealmRaid.assets import RealmRaidAssets
2222

2323
from module.logger import logger
24-
from tasks.GlobalGame.assets import GlobalGameAssets
2524
from module.exception import TaskEnd
2625
from module.atom.image_grid import ImageGrid
2726
from module.base.utils import point2str
@@ -548,13 +547,13 @@ def run_general_battle_back(self, Monster_type: str) -> bool:
548547
self.screenshot()
549548
if self.appear_then_click(self.I_EXIT, interval=2):
550549
continue
551-
if self.appear_then_click(GlobalGameAssets.I_UI_CONFIRM, interval=2):
550+
if self.appear_then_click(self.I_UI_CONFIRM, interval=2):
552551
continue
553552
if self.appear_then_click(self.I_WIN, interval=2):
554553
continue
555554
if self.appear(self.I_ABYSS_NAVIGATION):
556555
break
557-
logger.info(f"Click {GlobalGameAssets.I_UI_CONFIRM.name}")
556+
logger.info(f"Click {self.I_UI_CONFIRM.name}")
558557

559558
return True
560559

‎tasks/Component/Costume/costume_base.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
'I_SOU_CHECK_IN': f'I_SOU_CHECK_IN_{i}',
9090
'I_SOU_TEAM_PRESENT': f'I_SOU_TEAM_PRESENT_{i}',
9191
'I_SOU_CLICK_PRESENT': f'I_SOU_CLICK_PRESENT_{i}',
92-
'I_SOU_SWITCH_SURE': f'I_SOU_SWITCH_SURE_{i}',
9392
# SwitchSoul 分组相关 (1-7组)
9493
**{f'I_SOU_CHECK_GROUP_{g}': f'I_SOU_CHECK_GROUP_{g}_{i}' for g in range(1, 8)},
9594
# SwitchSoul 队伍相关 (1-4队)

‎tasks/Component/Costume/costume_test_shikigami.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def run(self):
3636
[self.I_SOU_SWITCH_2, 0],
3737
[self.I_SOU_SWITCH_3, 0],
3838
[self.I_SOU_SWITCH_4, 0],
39-
[self.I_SOU_SWITCH_SURE, 0],
39+
[self.I_UI_CONFIRM, 0],
4040
# SoulsTidy - 御魂页面关键元素
4141
[self.I_ST_SOULS, 0],
4242
[self.I_ST_REPLACE, 0],

‎tasks/Component/CostumeShikigami/assets.py‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class CostumeShikigamiAssets:
2626
# description
2727
I_SOU_SWITCH_4_1 = RuleImage(roi_front=(977,603,33,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_4_1.png")
2828
# description
29-
I_SOU_SWITCH_SURE_1 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_switch_sure_1.png")
3029
# 用于判断是否在式神录里面
3130
I_SOU_CHECK_IN_1 = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk1/sk1_sou_check_in_1.png")
3231
# 检查是否为第一组
@@ -69,7 +68,6 @@ class CostumeShikigamiAssets:
6968
# 第四组切换
7069
I_SOU_SWITCH_4_10 = RuleImage(roi_front=(979,602,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_4_10.png")
7170
# 确认切换
72-
I_SOU_SWITCH_SURE_10 = RuleImage(roi_front=(669,401,190,61), roi_back=(669,401,190,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_switch_sure_10.png")
7371
# 用于判断是否在式神录里面
7472
I_SOU_CHECK_IN_10 = RuleImage(roi_front=(277,79,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk10/sk10_sou_check_in_10.png")
7573
# 检查是否为第一组
@@ -126,7 +124,6 @@ class CostumeShikigamiAssets:
126124
# description
127125
I_SOU_TEAM_PRESENT_11 = RuleImage(roi_front=(734,77,100,41), roi_back=(726,71,115,54), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_team_present_11.png")
128126
# description
129-
I_SOU_SWITCH_SURE_11 = RuleImage(roi_front=(702,401,116,55), roi_back=(690,399,148,64), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_sou_switch_sure_11.png")
130127
# description
131128
I_SOUL_PRESET_11 = RuleImage(roi_front=(342,85,74,31), roi_back=(338,77,83,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk11/sk11_soul_preset_11.png")
132129
# description
@@ -169,7 +166,6 @@ class CostumeShikigamiAssets:
169166
# description
170167
I_SOU_TEAM_PRESENT_12 = RuleImage(roi_front=(734,77,100,41), roi_back=(726,71,115,54), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_team_present_12.png")
171168
# description
172-
I_SOU_SWITCH_SURE_12 = RuleImage(roi_front=(702,401,116,55), roi_back=(690,399,148,64), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_sou_switch_sure_12.png")
173169
# description
174170
I_SOUL_PRESET_12 = RuleImage(roi_front=(342,85,74,31), roi_back=(338,77,83,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk12/sk12_soul_preset_12.png")
175171
# description
@@ -198,7 +194,6 @@ class CostumeShikigamiAssets:
198194
# description
199195
I_SOU_SWITCH_4_2 = RuleImage(roi_front=(977,603,32,21), roi_back=(962,592,56,40), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_4_2.png")
200196
# description
201-
I_SOU_SWITCH_SURE_2 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_switch_sure_2.png")
202197
# 用于判断是否在式神录里面
203198
I_SOU_CHECK_IN_2 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk2/sk2_sou_check_in_2.png")
204199
# 检查是否为第一组
@@ -241,7 +236,6 @@ class CostumeShikigamiAssets:
241236
# description
242237
I_SOU_SWITCH_4_3 = RuleImage(roi_front=(978,603,31,19), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_4_3.png")
243238
# description
244-
I_SOU_SWITCH_SURE_3 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_switch_sure_3.png")
245239
# 用于判断是否在式神录里面
246240
I_SOU_CHECK_IN_3 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk3/sk3_sou_check_in_3.png")
247241
# 检查是否为第一组
@@ -284,7 +278,6 @@ class CostumeShikigamiAssets:
284278
# description
285279
I_SOU_SWITCH_4_4 = RuleImage(roi_front=(978,602,31,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_4_4.png")
286280
# description
287-
I_SOU_SWITCH_SURE_4 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_switch_sure_4.png")
288281
# 用于判断是否在式神录里面
289282
I_SOU_CHECK_IN_4 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk4/sk4_sou_check_in_4.png")
290283
# 检查是否为第一组
@@ -327,7 +320,6 @@ class CostumeShikigamiAssets:
327320
# description
328321
I_SOU_SWITCH_4_5 = RuleImage(roi_front=(978,602,31,20), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_4_5.png")
329322
# description
330-
I_SOU_SWITCH_SURE_5 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_switch_sure_5.png")
331323
# 用于判断是否在式神录里面
332324
I_SOU_CHECK_IN_5 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk5/sk5_sou_check_in_5.png")
333325
# 检查是否为第一组
@@ -370,7 +362,6 @@ class CostumeShikigamiAssets:
370362
# description
371363
I_SOU_SWITCH_4_6 = RuleImage(roi_front=(977,601,32,21), roi_back=(962,592,53,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_4_6.png")
372364
# description
373-
I_SOU_SWITCH_SURE_6 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_switch_sure_6.png")
374365
# 用于判断是否在式神录里面
375366
I_SOU_CHECK_IN_6 = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk6/sk6_sou_check_in_6.png")
376367
# 检查是否为第一组
@@ -413,7 +404,6 @@ class CostumeShikigamiAssets:
413404
# description
414405
I_SOU_SWITCH_4_7 = RuleImage(roi_front=(975,604,37,23), roi_back=(963,589,61,48), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_4_7.png")
415406
# description
416-
I_SOU_SWITCH_SURE_7 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_switch_sure_7.png")
417407
# 用于判断是否在式神录里面
418408
I_SOU_CHECK_IN_7 = RuleImage(roi_front=(268,74,50,49), roi_back=(268,74,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk7/sk7_sou_check_in_7.png")
419409
# 检查是否为第一组
@@ -456,7 +446,6 @@ class CostumeShikigamiAssets:
456446
# 第四组切换
457447
I_SOU_SWITCH_4_8 = RuleImage(roi_front=(981,603,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_4_8.png")
458448
# 确认切换
459-
I_SOU_SWITCH_SURE_8 = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_switch_sure_8.png")
460449
# 用于判断是否在式神录里面
461450
I_SOU_CHECK_IN_8 = RuleImage(roi_front=(265,71,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk8/sk8_sou_check_in_8.png")
462451
# 检查是否为第一组
@@ -499,7 +488,6 @@ class CostumeShikigamiAssets:
499488
# 第四组切换
500489
I_SOU_SWITCH_4_9 = RuleImage(roi_front=(979,602,25,27), roi_back=(960,592,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_4_9.png")
501490
# 确认切换
502-
I_SOU_SWITCH_SURE_9 = RuleImage(roi_front=(669,401,190,61), roi_back=(669,401,190,61), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_switch_sure_9.png")
503491
# 用于判断是否在式神录里面
504492
I_SOU_CHECK_IN_9 = RuleImage(roi_front=(277,79,34,36), roi_back=(265,71,60,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeShikigami/sk9/sk9_sou_check_in_9.png")
505493
# 检查是否为第一组

‎tasks/Component/CostumeShikigami/sk1/image.json‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@
6262
"threshold": 0.8,
6363
"description": "description"
6464
},
65-
{
66-
"itemName": "sou_switch_sure_1",
67-
"imageName": "sk1_sou_switch_sure_1.png",
68-
"roiFront": "668,401,180,61",
69-
"roiBack": "668,401,180,61",
70-
"method": "Template matching",
71-
"threshold": 0.8,
72-
"description": "description"
73-
},
7465
{
7566
"itemName": "sou_check_in_1",
7667
"imageName": "sk1_sou_check_in_1.png",
@@ -179,4 +170,4 @@
179170
"threshold": 0.8,
180171
"description": "更换"
181172
}
182-
]
173+
]
-9.5 KB
Binary file not shown.

‎tasks/Component/CostumeShikigami/sk10/image.json‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@
6262
"threshold": 0.8,
6363
"description": "第四组切换"
6464
},
65-
{
66-
"itemName": "sou_switch_sure_10",
67-
"imageName": "sk10_sou_switch_sure_10.png",
68-
"roiFront": "669,401,190,61",
69-
"roiBack": "669,401,190,61",
70-
"method": "Template matching",
71-
"threshold": 0.8,
72-
"description": "确认切换"
73-
},
7465
{
7566
"itemName": "sou_check_in_10",
7667
"imageName": "sk10_sou_check_in_10.png",
@@ -179,4 +170,4 @@
179170
"threshold": 0.8,
180171
"description": "更换"
181172
}
182-
]
173+
]
-9.94 KB
Binary file not shown.

‎tasks/Component/CostumeShikigami/sk11/image.json‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@
125125
"threshold": 0.8,
126126
"description": "description"
127127
},
128-
{
129-
"itemName": "sou_switch_sure_11",
130-
"imageName": "sk11_sou_switch_sure_11.png",
131-
"roiFront": "702,401,116,55",
132-
"roiBack": "690,399,148,64",
133-
"method": "Template matching",
134-
"threshold": 0.8,
135-
"description": "description"
136-
},
137128
{
138129
"itemName": "soul_preset_11",
139130
"imageName": "sk11_soul_preset_11.png",
@@ -179,4 +170,4 @@
179170
"threshold": 0.8,
180171
"description": "description"
181172
}
182-
]
173+
]
-5.44 KB
Binary file not shown.

0 commit comments

Comments
 (0)