huangrunheng 2 lat temu
rodzic
commit
039fd379b5

+ 1 - 1
tasks/Component/GeneralBattle/general_battle.py

@@ -452,7 +452,7 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
         if not buff:
             return
         logger.info(f'Open buff {buff}')
-        self.ui_click(self.I_BUFF, self.I_CLOUD)
+        self.ui_click(self.I_BUFF, self.I_CLOUD, interval=2)
         if isinstance(buff, BuffClass):
             buff = [buff]
         match_method = {

+ 2 - 0
tasks/GlobalGame/assets.py

@@ -23,6 +23,8 @@ class GlobalGameAssets:
 	I_NETWORK_ERROR = RuleImage(roi_front=(431,253,416,208), roi_back=(431,253,416,208), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_network_error.png")
 	# 我还没有碰到这个情况没能截图 
 	I_CLIENT_CLEAR = RuleImage(roi_front=(578,369,151,72), roi_back=(578,369,151,72), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_client_clear.png")
+	# description 
+	I_CHAT_CLOSE_BUTTON = RuleImage(roi_front=(632,343,49,103), roi_back=(632,343,49,103), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_chat_close_button.png")
 
 
 	# Click Rule Assets

BIN
tasks/GlobalGame/gg/gg_chat_close_button.png


+ 9 - 0
tasks/GlobalGame/gg/image.json

@@ -52,5 +52,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "我还没有碰到这个情况没能截图"
+  },
+  {
+    "itemName": "chat_close_button",
+    "imageName": "gg_chat_close_button.png",
+    "roiFront": "632,343,49,103",
+    "roiBack": "632,343,49,103",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

+ 3 - 1
tasks/Secret/script_task.py

@@ -200,6 +200,8 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
 
         if screenshot:
             self.screenshot()
+        if self.appear(self.I_CHAT_CLOSE_BUTTON):
+            self.ui_click_until_disappear(self.I_CHAT_CLOSE_BUTTON, interval=2)
         text_pos = self.O_SE_NO_PASS.ocr(self.device.image)
         if text_pos != (0, 0, 0, 0):
             # 如果能找得到 未通关 ,那可以挑战
@@ -252,7 +254,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
             self.screenshot()
             if self.appear(self.I_SE_BATTLE_WIN):
                 logger.info('Win battle')
-                self.ui_click_until_disappear(self.I_SE_BATTLE_WIN)
+                self.ui_click_until_disappear(self.I_SE_BATTLE_WIN, interval=2)
                 return True
             if self.appear_then_click(self.I_WIN, interval=1):
                 continue

+ 3 - 2
tasks/base_task.py

@@ -511,9 +511,10 @@ class BaseTask(GlobalGameAssets, CostumeBase):
             elif isinstance(click, RuleOcr) and self.ocr_appear_click(click, interval=interval):
                 continue
 
-    def ui_click_until_disappear(self, click):
+    def ui_click_until_disappear(self, click, interval: float =1):
         """
         点击一个按钮直到消失
+        :param interval:
         :param click:
         :return:
         """
@@ -521,5 +522,5 @@ class BaseTask(GlobalGameAssets, CostumeBase):
             self.screenshot()
             if not self.appear(click):
                 break
-            elif self.appear_then_click(click, interval=1):
+            elif self.appear_then_click(click, interval=interval):
                 continue