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

Merge pull request #1499 from LGG686/dev-d

fix(Gameui): 增加新下载拓展包弹窗关闭识别
huangrunheng 6 месяцев назад
Родитель
Сommit
477fea9f87

+ 10 - 3
tasks/AutoCheckinBigGod/script_task.py

@@ -141,7 +141,7 @@ class ScriptTask(BaseTask):
 
 
         if not rewards:
         if not rewards:
             logger.info('没有可领取的礼包')
             logger.info('没有可领取的礼包')
-            self._cleanup()
+            self._cleanup(restore_game=True)
             self.set_next_run('AutoCheckinBigGod', success=True, finish=True)
             self.set_next_run('AutoCheckinBigGod', success=True, finish=True)
             raise TaskEnd('AutoCheckinBigGod')
             raise TaskEnd('AutoCheckinBigGod')
 
 
@@ -154,13 +154,13 @@ class ScriptTask(BaseTask):
             time.sleep(0.5)
             time.sleep(0.5)
 
 
         logger.info(f'完成! 成功领取 {success_count}/{len(rewards)} 个礼包')
         logger.info(f'完成! 成功领取 {success_count}/{len(rewards)} 个礼包')
-        self._cleanup()
+        self._cleanup(restore_game=True)
         self.set_next_run('AutoCheckinBigGod', success=True, finish=True)
         self.set_next_run('AutoCheckinBigGod', success=True, finish=True)
         raise TaskEnd('AutoCheckinBigGod')
         raise TaskEnd('AutoCheckinBigGod')
 
 
     # ======================== 清理 ========================
     # ======================== 清理 ========================
 
 
-    def _cleanup(self):
+    def _cleanup(self, restore_game=False):
         logger.info('清理:关闭大神APP和Frida Server...')
         logger.info('清理:关闭大神APP和Frida Server...')
         try:
         try:
             if self._frida_session is not None:
             if self._frida_session is not None:
@@ -178,6 +178,13 @@ class ScriptTask(BaseTask):
         except Exception:
         except Exception:
             pass
             pass
 
 
+        if restore_game:
+            try:
+                self.device.app_start()
+                logger.info('已返回阴阳师前台')
+            except Exception as e:
+                logger.warning(f'返回阴阳师失败: {e}')
+
     # ======================== ADB 操作 ========================
     # ======================== ADB 操作 ========================
 
 
     def _adb_cmd(self, args, timeout=10):
     def _adb_cmd(self, args, timeout=10):

+ 2 - 2
tasks/GameUi/assets.py

@@ -148,9 +148,9 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_MAIN_GOTO_FRIENDS = RuleImage(roi_front=(845,590,55,55), roi_back=(845,590,120,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_friends.png")
 	I_MAIN_GOTO_FRIENDS = RuleImage(roi_front=(845,590,55,55), roi_back=(845,590,120,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_friends.png")
 	# 进入花合战 
 	# 进入花合战 
-	I_MAIN_GOTO_DAILY = RuleImage(roi_front=(765,616,63,38), roi_back=(735,590,120,100), threshold=0.6, method="Template matching", file="./tasks/GameUi/page/page_main_goto_daily.png")
+	I_MAIN_GOTO_DAILY = RuleImage(roi_front=(779,612,51,67), roi_back=(754,595,89,97), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_daily.png")
 	# description 
 	# description 
-	I_MAIN_GOTO_MALL = RuleImage(roi_front=(663,623,33,42), roi_back=(620,590,120,100), threshold=0.5, method="Template matching", file="./tasks/GameUi/page/page_main_goto_mall.png")
+	I_MAIN_GOTO_MALL = RuleImage(roi_front=(663,661,41,22), roi_back=(644,613,81,78), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_mall.png")
 	# description 
 	# description 
 	I_MAIN_GOTO_GUILD = RuleImage(roi_front=(495,590,50,22), roi_back=(495,590,120,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_guild.png")
 	I_MAIN_GOTO_GUILD = RuleImage(roi_front=(495,590,50,22), roi_back=(495,590,120,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_guild.png")
 	# description 
 	# description 

+ 3 - 2
tasks/GameUi/page.py

@@ -156,7 +156,7 @@ page_town.link(button=G.I_TOWN_GOTO_HYAKKIYAKOU, destination=page_hyakkiyakou)
 # ************************************* 庭院部分 *****************************************#
 # ************************************* 庭院部分 *****************************************#
 # 式神录 shikigami_records
 # 式神录 shikigami_records
 page_shikigami_records = Page(G.I_CHECK_RECORDS)
 page_shikigami_records = Page(G.I_CHECK_RECORDS)
-page_shikigami_records.additional = [G.I_AD_DISAPPEAR, G.I_RECORDS_CLOSE]
+page_shikigami_records.additional = [G.I_AD_DISAPPEAR, G.I_RECORDS_CLOSE, GGA.I_UI_CANCEL_SAMLL]
 page_shikigami_records.link(button=G.I_BACK_Y, destination=page_main)
 page_shikigami_records.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_SHIKIGAMI_RECORDS, destination=page_shikigami_records)
 page_main.link(button=G.I_MAIN_GOTO_SHIKIGAMI_RECORDS, destination=page_shikigami_records)
 # 阴阳术 onmyodo
 # 阴阳术 onmyodo
@@ -176,7 +176,7 @@ from tasks.DailyTrifles.assets import DailyTriflesAssets
 
 
 # 商店 mall
 # 商店 mall
 page_mall = Page(check_button=[G.I_CHECK_MALL, DailyTriflesAssets.I_ROOM_GIFT])
 page_mall = Page(check_button=[G.I_CHECK_MALL, DailyTriflesAssets.I_ROOM_GIFT])
-page_mall.additional = [G.I_AD_CLOSE_RED, G.I_BACK_Y, G.I_DLC_CLOSE]
+page_mall.additional = [G.I_AD_CLOSE_RED, GGA.I_UI_CANCEL_SAMLL, G.I_BACK_Y]
 page_mall.link(button=G.I_BACK_YOLLOW, destination=page_main)
 page_mall.link(button=G.I_BACK_YOLLOW, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 # 阴阳寮 guild
 # 阴阳寮 guild
@@ -190,6 +190,7 @@ page_team.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_TEAM, destination=page_team)
 page_main.link(button=G.I_MAIN_GOTO_TEAM, destination=page_team)
 # 收集 collection
 # 收集 collection
 page_collection = Page(G.I_CHECK_COLLECTION)
 page_collection = Page(G.I_CHECK_COLLECTION)
+page_collection.additional = [GGA.I_UI_CANCEL_SAMLL]
 page_collection.link(button=G.I_BACK_Y, destination=page_main)
 page_collection.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_COLLECTION, destination=page_collection)
 page_main.link(button=G.I_MAIN_GOTO_COLLECTION, destination=page_collection)
 # 珍旅居
 # 珍旅居

+ 6 - 6
tasks/GameUi/page/page_img_3.json

@@ -29,19 +29,19 @@
   {
   {
     "itemName": "main_goto_daily",
     "itemName": "main_goto_daily",
     "imageName": "page_main_goto_daily.png",
     "imageName": "page_main_goto_daily.png",
-    "roiFront": "765,616,63,38",
-    "roiBack": "735,590,120,100",
+    "roiFront": "779,612,51,67",
+    "roiBack": "754,595,89,97",
     "method": "Template matching",
     "method": "Template matching",
-    "threshold": 0.6,
+    "threshold": 0.7,
     "description": "进入花合战"
     "description": "进入花合战"
   },
   },
   {
   {
     "itemName": "main_goto_mall",
     "itemName": "main_goto_mall",
     "imageName": "page_main_goto_mall.png",
     "imageName": "page_main_goto_mall.png",
-    "roiFront": "663,623,33,42",
-    "roiBack": "620,590,120,100",
+    "roiFront": "663,661,41,22",
+    "roiBack": "644,613,81,78",
     "method": "Template matching",
     "method": "Template matching",
-    "threshold": 0.5,
+    "threshold": 0.7,
     "description": "description"
     "description": "description"
   },
   },
   {
   {

BIN
tasks/GameUi/page/page_main_goto_daily.png


BIN
tasks/GameUi/page/page_main_goto_mall.png


+ 1 - 1
tasks/GlobalGame/assets.py

@@ -56,7 +56,7 @@ 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=(472,389,128,62), roi_back=(472,389,128,62), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_samll.png")
+	I_UI_CANCEL_SAMLL = RuleImage(roi_front=(472,389,128,62), roi_back=(360,377,272,185), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_cancel_samll.png")
 	# description 
 	# description 
 	I_UI_UNCHECK = RuleImage(roi_front=(567,343,33,36), roi_back=(497,303,216,100), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_uncheck.png")
 	I_UI_UNCHECK = RuleImage(roi_front=(567,343,33,36), roi_back=(497,303,216,100), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_uncheck.png")
 	# 勾选 
 	# 勾选 

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

@@ -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": "472,389,128,62",
     "roiFront": "472,389,128,62",
-    "roiBack": "472,389,128,62",
+    "roiBack": "360,377,272,185",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "短一点的取消"
     "description": "短一点的取消"