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

Merge upstream dev through 92578cd0 while preserving local fixes

Integrate 13 previously unmerged upstream commits, including five merges.
Adopt the three-second invite redraw intervals, activity back-button
fallbacks, strategy-based battle start logging, exploration ticket OCR
region, and shared login cancellation assets.

Keep the local cropped confirm/cancel and checkbox templates. Expand the
shared search regions without losing existing login cancellation coverage.
The upstream unchecked template also matches unrelated room-creation UI
(score 0.82557); the local template distinguishes the recorded screens.
Retain the already implemented circular-back rule without duplication.

Preserve the mail-specific confirmation rule and complete claim/reward/read
state machine, including popup priority, delayed rewards and timeout recovery.
A generic confirmation alone is insufficient to identify a mail dialog.
Remove only the three obsolete login cancellation rules and images.

Validation: 285 pytest tests passed, including six delayed-invite redraw
replays. Four original-code failures demonstrate the timing regressions.
96 production image-matcher checks passed on 16 recorded screenshots;
seven image/OCR rules match their metadata. Changed Python/JSON syntax,
nine production module imports, removed-asset references and git diff
checks passed. No emulator run.
unknown 1 месяц назад
Родитель
Сommit
e2eb0b7391

+ 4 - 0
tasks/ActivityShikigami/script_task.py

@@ -265,6 +265,10 @@ class ScriptTask(StateMachine, GameUi, Battle, BaseActivity, SwitchSoul, Activit
                 break
                 break
             if self.appear(self.I_CHECK_BATTLE_MAIN) and self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
             if self.appear(self.I_CHECK_BATTLE_MAIN) and self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
                 continue
                 continue
+            if self.appear_then_click(self.I_UI_BACK_CIRCLE, interval=2.5):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_RED, interval=1.5):
+                continue
 
 
     def _run_ap(self):
     def _run_ap(self):
         """
         """

+ 2 - 2
tasks/BondlingFairyland/general_invite.py

@@ -472,14 +472,14 @@ class GeneralInvite(BaseTask, BondlingFairylandAssets, GeneralInviteAssets):
                     self.screenshot()
                     self.screenshot()
                     if self.appear(self.I_UI_CHECK):
                     if self.appear(self.I_UI_CHECK):
                         break
                         break
-                    if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
+                    if self.appear_then_click(self.I_UI_UNCHECK, interval=3):
                         continue
                         continue
         # 点击确认
         # 点击确认
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
             if not self.appear(self.I_UI_CONFIRM):
             if not self.appear(self.I_UI_CONFIRM):
                 break
                 break
-            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=3):
                 continue
                 continue
 
 
         return True
         return True

+ 12 - 0
tasks/Component/GeneralBattle/battle.py

@@ -1,4 +1,5 @@
 import random
 import random
+from functools import wraps
 
 
 from module.logger import logger
 from module.logger import logger
 from module.atom.image import RuleImage
 from module.atom.image import RuleImage
@@ -12,6 +13,16 @@ from tasks.Component.GeneralBattle.battle_wait import (
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig, GreenMarkType
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig, GreenMarkType
 
 
 
 
+
+def log_battle_start(func):
+    @wraps(func)
+    def wrapper(owner, *args, **kwargs):
+        logger.hr("General battle start", 2)
+        return func(owner, *args, **kwargs)
+
+    return wrapper
+
+
 class Battle(BattleWait):
 class Battle(BattleWait):
 
 
     def start_fire(self, buttons: list[RuleOcr | RuleImage], checks: list[RuleImage]) -> bool:
     def start_fire(self, buttons: list[RuleOcr | RuleImage], checks: list[RuleImage]) -> bool:
@@ -47,6 +58,7 @@ class Battle(BattleWait):
                         continue
                         continue
         return True
         return True
 
 
+    @log_battle_start
     @battle_wait_strategy()
     @battle_wait_strategy()
     def battle_wait(self, *args, **kwargs):
     def battle_wait(self, *args, **kwargs):
         return self.battle_wait_with_strategy(*args, **kwargs)
         return self.battle_wait_with_strategy(*args, **kwargs)

+ 2 - 2
tasks/Component/GeneralInvite/general_invite.py

@@ -542,14 +542,14 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
                     self.screenshot()
                     self.screenshot()
                     if self.appear(self.I_UI_CHECK):
                     if self.appear(self.I_UI_CHECK):
                         break
                         break
-                    if self.appear_then_click(self.I_UI_UNCHECK, interval=1):
+                    if self.appear_then_click(self.I_UI_UNCHECK, interval=3):
                         continue
                         continue
         # 点击确认
         # 点击确认
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
             if not self.appear(self.I_UI_CONFIRM):
             if not self.appear(self.I_UI_CONFIRM):
                 break
                 break
-            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=3):
                 continue
                 continue
 
 
         return True
         return True

+ 1 - 1
tasks/Exploration/assets.py

@@ -154,7 +154,7 @@ class ExplorationAssets:
 	# 探索右上角 突破卷的数量 
 	# 探索右上角 突破卷的数量 
 	O_REALM_RAID_NUMBER = RuleOcr(roi=(739,11,78,37), area=(739,11,78,37), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number")
 	O_REALM_RAID_NUMBER = RuleOcr(roi=(739,11,78,37), area=(739,11,78,37), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number")
 	# (点出困难28时候)探索右上角 突破卷的数量 
 	# (点出困难28时候)探索右上角 突破卷的数量 
-	O_REALM_RAID_NUMBER1 = RuleOcr(roi=(936,10,82,36), area=(936,10,82,36), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number1")
+	O_REALM_RAID_NUMBER1 = RuleOcr(roi=(920,12,78,30), area=(919,12,80,30), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number1")
 
 
 
 
 	# Swipe Rule Assets
 	# Swipe Rule Assets

+ 2 - 2
tasks/Exploration/res/ocr.json

@@ -28,8 +28,8 @@
   },
   },
   {
   {
     "itemName": "realm_raid_number1",
     "itemName": "realm_raid_number1",
-    "roiFront": "936,10,82,36",
-    "roiBack": "936,10,82,36",
+    "roiFront": "920,12,78,30",
+    "roiBack": "919,12,80,30",
     "mode": "DigitCounter",
     "mode": "DigitCounter",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",

+ 1 - 1
tasks/GameUi/default_pages.py

@@ -62,7 +62,7 @@ page_login.add_enter_success_hooks(handle_login_page)
 # 庭院主页(此处通过提高阈值来处理部分探索章节会识别成原始庭院的问题, 后续有其他更好方法需改善)
 # 庭院主页(此处通过提高阈值来处理部分探索章节会识别成原始庭院的问题, 后续有其他更好方法需改善)
 page_main = Page(GameUiAssets.I_CHECK_MAIN, category="global")
 page_main = Page(GameUiAssets.I_CHECK_MAIN, category="global")
 page_main.add_enter_success_hooks(
 page_main.add_enter_success_hooks(
-    GameUiAssets.I_AD_CLOSE_RED, GlobalGameAssets.I_UI_BACK_RED, RestartAssets.I_CANCEL_BATTLE,
+    GameUiAssets.I_AD_CLOSE_RED, GlobalGameAssets.I_UI_BACK_RED, GlobalGameAssets.I_UI_CANCEL_SAMLL,
     conditional_action(RestartAssets.I_LOGIN_COURTYARD, RestartAssets.C_LOGIN_SCROLL_CLOSE_AREA),
     conditional_action(RestartAssets.I_LOGIN_COURTYARD, RestartAssets.C_LOGIN_SCROLL_CLOSE_AREA),
 )
 )
 
 

+ 4 - 4
tasks/GlobalGame/assets.py

@@ -40,10 +40,10 @@ class GlobalGameAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 长一点的确认 
 	# 长一点的确认 
-	I_UI_CONFIRM = RuleImage(roi_front=(718,424,69,30), roi_back=(643,389,216,95), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm.png")
+	I_UI_CONFIRM = RuleImage(roi_front=(718,424,69,30), roi_back=(643,345,231,320), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm.png")
 	I_UI_CONFIRM_OLD = RuleImage(roi_front=(685,376,179,66), roi_back=(663,334,232,193), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm_old.png")
 	I_UI_CONFIRM_OLD = RuleImage(roi_front=(685,376,179,66), roi_back=(663,334,232,193), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm_old.png")
 	# 长一点的取消 
 	# 长一点的取消 
-	I_UI_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(356,384,276,125), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel.png")
+	I_UI_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(356,384,276,256), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel.png")
 	I_UI_CANCEL_OLD = RuleImage(roi_front=(417,368,177,62), roi_back=(366,349,261,173), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_old.png")
 	I_UI_CANCEL_OLD = RuleImage(roi_front=(417,368,177,62), roi_back=(366,349,261,173), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_old.png")
 	# '获得奖励' 四个大字 
 	# '获得奖励' 四个大字 
 	I_UI_REWARD = RuleImage(roi_front=(514,206,255,70), roi_back=(450,69,390,303), threshold=0.73, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_reward.png")
 	I_UI_REWARD = RuleImage(roi_front=(514,206,255,70), roi_back=(450,69,390,303), threshold=0.73, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_reward.png")
@@ -61,9 +61,9 @@ class GlobalGameAssets:
 	# 短一点的确认 
 	# 短一点的确认 
 	I_UI_CONFIRM_SAMLL = RuleImage(roi_front=(681,392,130,62), roi_back=(558,380,265,99), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm_samll.png")
 	I_UI_CONFIRM_SAMLL = RuleImage(roi_front=(681,392,130,62), roi_back=(558,380,265,99), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_confirm_samll.png")
 	# 短一点的取消 
 	# 短一点的取消 
-	I_UI_CANCEL_SAMLL = RuleImage(roi_front=(492,424,71,30), roi_back=(360,377,272,185), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_samll.png")
+	I_UI_CANCEL_SAMLL = RuleImage(roi_front=(492,424,71,30), roi_back=(360,227,552,335), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_samll.png")
 	# description 
 	# description 
-	I_UI_UNCHECK = RuleImage(roi_front=(545,345,33,33), roi_back=(497,303,163,100), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_uncheck.png")
+	I_UI_UNCHECK = RuleImage(roi_front=(545,345,33,33), roi_back=(497,303,216,100), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_uncheck.png")
 	# 勾选 
 	# 勾选 
 	I_UI_CHECK = RuleImage(roi_front=(545,345,33,33), roi_back=(512,329,164,78), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_check.png")
 	I_UI_CHECK = RuleImage(roi_front=(545,345,33,33), roi_back=(512,329,164,78), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_check.png")
 	# 知道了 
 	# 知道了 

+ 4 - 4
tasks/GlobalGame/ui/image.json

@@ -3,7 +3,7 @@
     "itemName": "ui_confirm",
     "itemName": "ui_confirm",
     "imageName": "ui_ui_confirm.png",
     "imageName": "ui_ui_confirm.png",
     "roiFront": "718,424,69,30",
     "roiFront": "718,424,69,30",
-    "roiBack": "643,389,216,95",
+    "roiBack": "643,345,231,320",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "长一点的确认"
     "description": "长一点的确认"
@@ -12,7 +12,7 @@
     "itemName": "ui_cancel",
     "itemName": "ui_cancel",
     "imageName": "ui_ui_cancel.png",
     "imageName": "ui_ui_cancel.png",
     "roiFront": "492,424,71,30",
     "roiFront": "492,424,71,30",
-    "roiBack": "356,384,276,125",
+    "roiBack": "356,384,276,256",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "长一点的取消"
     "description": "长一点的取消"
@@ -75,7 +75,7 @@
     "itemName": "ui_cancel_samll",
     "itemName": "ui_cancel_samll",
     "imageName": "ui_ui_cancel_samll.png",
     "imageName": "ui_ui_cancel_samll.png",
     "roiFront": "492,424,71,30",
     "roiFront": "492,424,71,30",
-    "roiBack": "360,377,272,185",
+    "roiBack": "360,227,552,335",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "短一点的取消"
     "description": "短一点的取消"
@@ -84,7 +84,7 @@
     "itemName": "ui_uncheck",
     "itemName": "ui_uncheck",
     "imageName": "ui_ui_uncheck.png",
     "imageName": "ui_ui_uncheck.png",
     "roiFront": "545,345,33,33",
     "roiFront": "545,345,33,33",
-    "roiBack": "497,303,163,100",
+    "roiBack": "497,303,216,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 0 - 6
tasks/Restart/assets.py

@@ -113,8 +113,6 @@ class RestartAssets:
 	I_LOGIN_YELLOW_CLOSE = RuleImage(roi_front=(29,17,46,44), roi_back=(0,0,94,86), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_yellow_close.png")
 	I_LOGIN_YELLOW_CLOSE = RuleImage(roi_front=(29,17,46,44), roi_back=(0,0,94,86), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_yellow_close.png")
 	# 用于判断是否出现登录选区的 
 	# 用于判断是否出现登录选区的 
 	I_LOGIN_8 = RuleImage(roi_front=(178,572,53,60), roi_back=(1,547,241,105), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_8.png")
 	I_LOGIN_8 = RuleImage(roi_front=(178,572,53,60), roi_back=(1,547,241,105), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_8.png")
-	# 登录时候不观看CG视频 
-	I_WATCH_VIDEO_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(466,396,130,61), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_watch_video_cancel.png")
 	# 指定角色进入游戏,默认第一个 
 	# 指定角色进入游戏,默认第一个 
 	I_LOGIN_SPECIFIC_SERVE = RuleImage(roi_front=(0,0,120,120), roi_back=(0,0,120,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_specific_serve.png")
 	I_LOGIN_SPECIFIC_SERVE = RuleImage(roi_front=(0,0,120,120), roi_back=(0,0,120,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_specific_serve.png")
 	# 下载插画 
 	# 下载插画 
@@ -123,8 +121,6 @@ class RestartAssets:
 	I_LOGIN_LOGIN_GOTO_BIND_PHONE = RuleImage(roi_front=(940,430,170,150), roi_back=(940,430,170,150), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_goto_bind_phone.png")
 	I_LOGIN_LOGIN_GOTO_BIND_PHONE = RuleImage(roi_front=(940,430,170,150), roi_back=(940,430,170,150), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_goto_bind_phone.png")
 	# 登录界面 弹出框 确定绑定手机 
 	# 登录界面 弹出框 确定绑定手机 
 	I_LOGIN_LOGIN_ENSURE_BIND_PHONE = RuleImage(roi_front=(670,460,160,100), roi_back=(670,460,160,100), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_ensure_bind_phone.png")
 	I_LOGIN_LOGIN_ENSURE_BIND_PHONE = RuleImage(roi_front=(670,460,160,100), roi_back=(670,460,160,100), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_ensure_bind_phone.png")
-	# 登录界面 弹出框 取消绑定手机 
-	I_LOGIN_LOGIN_CANCEL_BIND_PHONE = RuleImage(roi_front=(450,460,160,100), roi_back=(450,460,160,100), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_cancel_bind_phone.png")
 	# 登录界面 弹出框 阴阳师精灵 
 	# 登录界面 弹出框 阴阳师精灵 
 	I_LOGIN_LOGIN_ONMYOJI_GENIE = RuleImage(roi_front=(80,110,280,120), roi_back=(80,110,280,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_onmyoji_genie.png")
 	I_LOGIN_LOGIN_ONMYOJI_GENIE = RuleImage(roi_front=(80,110,280,120), roi_back=(80,110,280,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_onmyoji_genie.png")
 	# 已有角色 
 	# 已有角色 
@@ -135,8 +131,6 @@ class RestartAssets:
 	I_EARLY_SERVER = RuleImage(roi_front=(596,269,115,33), roi_back=(596,269,115,33), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_early_server.png")
 	I_EARLY_SERVER = RuleImage(roi_front=(596,269,115,33), roi_back=(596,269,115,33), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_early_server.png")
 	# 取消体验服切换弹窗 
 	# 取消体验服切换弹窗 
 	I_EARLY_SERVER_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(435,404,172,56), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_early_server_cancel.png")
 	I_EARLY_SERVER_CANCEL = RuleImage(roi_front=(492,424,71,30), roi_back=(435,404,172,56), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_early_server_cancel.png")
-	# 取消继续战斗 
-	I_CANCEL_BATTLE = RuleImage(roi_front=(492,424,71,30), roi_back=(367,227,545,296), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_cancel_battle.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

+ 3 - 3
tasks/Restart/login.py

@@ -49,7 +49,7 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets, GeneralBuffAssets):
             self._burst()
             self._burst()
 
 
             # 取消继续战斗
             # 取消继续战斗
-            if self.appear_then_click(self.I_CANCEL_BATTLE, interval=0.8):
+            if self.appear_then_click(self.I_UI_CANCEL_SAMLL, interval=0.8):
                 logger.info('Cancel continue battle')
                 logger.info('Cancel continue battle')
                 continue
                 continue
             # 确认进入庭院(优化:先检测加成图标确认在庭院页面,再检测式神录图标)
             # 确认进入庭院(优化:先检测加成图标确认在庭院页面,再检测式神录图标)
@@ -82,7 +82,7 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets, GeneralBuffAssets):
                 logger.info('Download inbetweening')
                 logger.info('Download inbetweening')
                 continue
                 continue
             # 不观看视频
             # 不观看视频
-            if self.appear_then_click(self.I_WATCH_VIDEO_CANCEL, interval=0.6):
+            if self.appear_then_click(self.I_UI_CANCEL_SAMLL, interval=0.6):
                 logger.info('Close video')
                 logger.info('Close video')
                 continue
                 continue
             # 右上角的红色的关闭
             # 右上角的红色的关闭
@@ -97,7 +97,7 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets, GeneralBuffAssets):
             if self.appear_then_click(self.I_LOGIN_LOGIN_GOTO_BIND_PHONE):
             if self.appear_then_click(self.I_LOGIN_LOGIN_GOTO_BIND_PHONE):
                 while 1:
                 while 1:
                     self.screenshot()
                     self.screenshot()
-                    if self.appear_then_click(self.I_LOGIN_LOGIN_CANCEL_BIND_PHONE):
+                    if self.appear_then_click(self.I_UI_CANCEL_SAMLL):
                         logger.info("Close bind phone")
                         logger.info("Close bind phone")
                         break
                         break
                 continue
                 continue

+ 0 - 27
tasks/Restart/login/image.json

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "用于判断是否出现登录选区的"
     "description": "用于判断是否出现登录选区的"
   },
   },
-  {
-    "itemName": "watch_video_cancel",
-    "imageName": "login_watch_video_cancel.png",
-    "roiFront": "492,424,71,30",
-    "roiBack": "466,396,130,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "登录时候不观看CG视频"
-  },
   {
   {
     "itemName": "login_specific_serve",
     "itemName": "login_specific_serve",
     "imageName": "login_login_specific_serve.png",
     "imageName": "login_login_specific_serve.png",
@@ -98,15 +89,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "登录界面 弹出框 确定绑定手机"
     "description": "登录界面 弹出框 确定绑定手机"
   },
   },
-  {
-    "itemName": "login_login_cancel_bind_phone",
-    "imageName": "login_login_cancel_bind_phone.png",
-    "roiFront": "450,460,160,100",
-    "roiBack": "450,460,160,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "登录界面 弹出框 取消绑定手机"
-  },
   {
   {
     "itemName": "login_login_onmyoji_genie",
     "itemName": "login_login_onmyoji_genie",
     "imageName": "login_login_onmyoji_genie.png",
     "imageName": "login_login_onmyoji_genie.png",
@@ -152,15 +134,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "取消体验服切换弹窗"
     "description": "取消体验服切换弹窗"
   },
   },
-  {
-    "itemName": "cancel_battle",
-    "imageName": "login_cancel_battle.png",
-    "roiFront": "492,424,71,30",
-    "roiBack": "367,227,545,296",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "取消继续战斗"
-  },
   {
   {
     "itemName": "login_courtyard",
     "itemName": "login_courtyard",
     "imageName": "login_courtyard.png",
     "imageName": "login_courtyard.png",

BIN
tasks/Restart/login/login_cancel_battle.png


BIN
tasks/Restart/login/login_login_cancel_bind_phone.png


BIN
tasks/Restart/login/login_watch_video_cancel.png


+ 68 - 0
tests/tasks/Component/GeneralInvite/test_invite_timing.py

@@ -0,0 +1,68 @@
+from types import SimpleNamespace
+
+import pytest
+
+from module.atom.image import RuleImage
+from module.base import timer
+from tasks.base_task import BaseTask
+from tasks.BondlingFairyland.general_invite import GeneralInvite as BondlingInvite
+from tasks.Component.GeneralInvite.general_invite import GeneralInvite
+
+
+class InviteReplay(BaseTask):
+    """Replay a dialog whose checkbox and confirmation redraw after two seconds."""
+
+    def __init__(self, monkeypatch, checkbox):
+        self.interval_timer = {}
+        self.now = 100.0
+        self.frames = 0
+        self.clicks = []
+        self.checkbox = checkbox
+        self.checked_at = None
+        self.closed_at = None
+        self.device = SimpleNamespace(image=set(), click=self.record_click)
+        monkeypatch.setattr(timer, 'time', SimpleNamespace(time=lambda: self.now))
+        monkeypatch.setattr(
+            RuleImage, 'match', lambda asset, image, **kwargs: asset.name in image
+        )
+        self.refresh_image()
+
+    def refresh_image(self):
+        if self.closed_at is not None and self.now >= self.closed_at:
+            self.device.image = set()
+            return
+        if self.checked_at is not None and self.now >= self.checked_at:
+            self.checkbox = 'checked'
+        self.device.image = {self.I_UI_CONFIRM.name}
+        if self.checkbox == 'checked':
+            self.device.image.add(self.I_UI_CHECK.name)
+        elif self.checkbox == 'unchecked':
+            self.device.image.add(self.I_UI_UNCHECK.name)
+
+    def screenshot(self):
+        self.frames += 1
+        assert self.frames < 40, 'Invite dialog did not settle'
+        self.now += 0.5
+        self.refresh_image()
+
+    def record_click(self, x, y, control_name):
+        self.clicks.append(control_name)
+        if control_name == self.I_UI_UNCHECK.name:
+            assert self.checked_at is None, 'Toggled checkbox again before redraw'
+            self.checked_at = self.now + 2
+        else:
+            assert control_name == self.I_UI_CONFIRM.name
+            assert self.checkbox in ('checked', 'absent')
+            assert self.closed_at is None, 'Confirmed twice before dialog closed'
+            self.closed_at = self.now + 2
+
+
+@pytest.mark.parametrize('invite', [GeneralInvite, BondlingInvite])
+@pytest.mark.parametrize('checkbox', ['unchecked', 'checked', 'absent'])
+def test_delayed_invitation_redraw_does_not_repeat_clicks(monkeypatch, invite, checkbox):
+    task = InviteReplay(monkeypatch, checkbox)
+
+    assert invite.check_and_invite(task) is True
+    assert task.device.image == set()
+    expected = [task.I_UI_UNCHECK.name] if checkbox == 'unchecked' else []
+    assert task.clicks == [*expected, task.I_UI_CONFIRM.name]