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

Merge pull request #928 from yEs1do/fix(Restart_login)

修复登录体验服可能出现弹窗 bug
huangrunheng 1 год назад
Родитель
Сommit
2d1005618a

+ 4 - 0
tasks/Restart/assets.py

@@ -89,6 +89,10 @@ class RestartAssets:
 	I_CHARACTARS = RuleImage(roi_front=(246,535,100,31), roi_back=(219,523,173,57), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_charactars.png")
 	# description 
 	I_CREATE_ACCOUNT = RuleImage(roi_front=(555,636,169,52), roi_back=(504,614,263,100), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_create_account.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=(435,404,172,56), roi_back=(435,404,172,56), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_early_server_cancel.png")
 
 
 	# Ocr Rule Assets

+ 5 - 0
tasks/Restart/login.py

@@ -117,6 +117,11 @@ class LoginHandler(BaseTask, RestartAssets):
             if self.appear(self.I_CHARACTARS, interval=1):
                 # https://github.com/runhey/OnmyojiAutoScript/issues/585
                 self.device.click(x=246, y=535)
+            # 登录体验服时,点击“进入游戏”速度过快,可能会出现体验服的弹窗
+            if self.appear(self.I_EARLY_SERVER):
+                if self.appear_then_click(self.I_EARLY_SERVER_CANCEL):
+                    logger.info('Cancel switch from early server to normal server')
+                    continue
             if self.ocr_appear_click(self.O_LOGIN_ENTER_GAME, interval=3):
                 self.wait_until_appear(self.I_LOGIN_SPECIFIC_SERVE, True, wait_time=5)
                 continue

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

@@ -124,5 +124,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "early_server",
+    "imageName": "login_early_server.png",
+    "roiFront": "596,269,115,33",
+    "roiBack": "596,269,115,33",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入体验服过快出现弹窗"
+  },
+  {
+    "itemName": "early_server_cancel",
+    "imageName": "login_early_server_cancel.png",
+    "roiFront": "435,404,172,56",
+    "roiBack": "435,404,172,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "取消体验服切换弹窗"
   }
 ]

BIN
tasks/Restart/login/login_early_server.png


BIN
tasks/Restart/login/login_early_server_cancel.png