Forráskód Böngészése

fix(base task): screenshot circular(friend invitation)

huangrunheng 2 éve
szülő
commit
ab51231e45
4 módosított fájl, 12 hozzáadás és 5 törlés
  1. 1 0
      .gitignore
  2. 1 0
      dev_tools/.gitignore
  3. 3 4
      dev_tools/assets_test.py
  4. 7 1
      tasks/base_task.py

+ 1 - 0
.gitignore

@@ -33,6 +33,7 @@ module/config/argument/setting.json
 !dev_tools/Spyxx/spyxx_amd64.exe
 !dev_tools/ViewWizard2/ViewWizard2.exe
 !dev_tools/ViewWizard3/ViewWizard.exe
+dev_tools/assets_test.py
 hya
 deploy/launcher/oas-backend.bat
 deploy/launcher/oas-server.bat

+ 1 - 0
dev_tools/.gitignore

@@ -0,0 +1 @@
+assets_test.py

+ 3 - 4
dev_tools/assets_test.py

@@ -34,11 +34,10 @@ def detect_ocr(file: str, target: RuleOcr):
 
 
 # 图片文件路径 可以是相对路径
-IMAGE_FILE = r"C:\Users\Ryland\Desktop\2024-07-31_21-14-21-574521.png"
+IMAGE_FILE = r"C:\Users\萌萌哒\Desktop\2024-08-15_23-01-04-220349.png"
 if __name__ == '__main__':
-    from tasks.SixRealms.assets import SixRealmsAssets
-    from tasks.GameUi.assets import GameUiAssets
-    targe = SixRealmsAssets.I_BACK_EXIT
+    from tasks.GlobalGame.assets import GlobalGameAssets
+    targe = GlobalGameAssets.I_G_ACCEPT
     print(detect_image(IMAGE_FILE, targe))
 
     # ocr demo

+ 7 - 1
tasks/base_task.py

@@ -104,7 +104,13 @@ class BaseTask(GlobalGameAssets, CostumeBase):
                 raise ScriptError(f'Unknown friend invitation type: {invite_type}')
         if not click_button:
             raise ScriptError(f'Unknown click button type: {invite_type}')
-        self.ui_click_until_disappear(click_button)
+        while 1:
+            self.device.screenshot()
+            if not self.appear(target=click_button):
+                logger.info('Deal with invitation done')
+                break
+            if self.appear_then_click(click_button, interval=0.8):
+                continue
         # 有的时候长战斗 点击后会取消战斗状态
         self.device.detect_record = detect_record
         return True