diff --git a/autowsgr/__init__.py b/autowsgr/__init__.py index 86f9d3bc..fe3b0a16 100644 --- a/autowsgr/__init__.py +++ b/autowsgr/__init__.py @@ -1 +1 @@ -__version__ = "0.2.2.30" +__version__ = "0.2.2.31" diff --git a/autowsgr/controller/run_timer.py b/autowsgr/controller/run_timer.py index be22f277..3004bfb7 100644 --- a/autowsgr/controller/run_timer.py +++ b/autowsgr/controller/run_timer.py @@ -200,7 +200,20 @@ def restart(self, times=0, *args, **kwargs): self.Windows.connect_android() self.restart(times + 1, *args, **kwargs) + def is_other_device_login(self, timeout=2): + """检查是否有其他设备登录顶号""" + return self.wait_image(IMG.error_image["user_remote_login"], timeout=timeout) != None + + def process_other_device_login(self, timeout=2): + """处理其他设备登录顶号 + 重新登录以后写,暂时留空,直接抛出错误 + """ + if self.is_other_device_login(timeout): + self.logger.error("other device login") + raise CriticalErr("other device login") + def is_bad_network(self, timeout=10): + """检查是否为网络状况问题""" return self.wait_images([IMG.error_image["bad_network"]] + [IMG.symbol_image[10]], timeout=timeout) != None def process_bad_network(self, extra_info="", timeout=10): @@ -276,6 +289,9 @@ def wait_pages(self, names, timeout=10, gap=0.1, after_wait=0.1): if self.process_bad_network("can't wait pages"): res = self.wait_pages(names, timeout, gap, after_wait) return res + if self.is_other_device_login(): + self.process_other_device_login() + raise TimeoutError(f"identify timeout of{str(names)}") def get_now_page(self): @@ -360,6 +376,8 @@ def walk_to(self, end, try_times=0): except TimeoutError as exception: if try_times > 3: raise TimeoutError("can't access the page") + if self.is_other_device_login(): + self.process_other_device_login() if not self.is_bad_network(timeout=2): self.logger.debug("wrong path is operated,anyway we find a way to solve,processing") self.logger.debug("wrong info is:", exception) @@ -391,6 +409,9 @@ def go_main_page(self, QuitOperationTime=0, List=[], ExList=[]): ValueError: _description_ """ if QuitOperationTime > 200: + if self.is_other_device_login(): + self.process_other_device_login() + if self.is_bad_network(timeout=3): if self.process_bad_network("can't go main page"): self.go_main_page(0, List) diff --git a/autowsgr/data/images/error_image/bad_network.PNG b/autowsgr/data/images/error_image/bad_network.PNG index 7896a71c..543f0e1f 100644 Binary files a/autowsgr/data/images/error_image/bad_network.PNG and b/autowsgr/data/images/error_image/bad_network.PNG differ diff --git a/autowsgr/data/images/error_image/remote_login_confirm.PNG b/autowsgr/data/images/error_image/remote_login_confirm.PNG new file mode 100644 index 00000000..9eab0340 Binary files /dev/null and b/autowsgr/data/images/error_image/remote_login_confirm.PNG differ diff --git a/autowsgr/data/images/error_image/user_remote_login.PNG b/autowsgr/data/images/error_image/user_remote_login.PNG new file mode 100644 index 00000000..ef80a9e4 Binary files /dev/null and b/autowsgr/data/images/error_image/user_remote_login.PNG differ diff --git a/autowsgr/fight/common.py b/autowsgr/fight/common.py index e7c50de1..c769231b 100644 --- a/autowsgr/fight/common.py +++ b/autowsgr/fight/common.py @@ -437,6 +437,8 @@ def update_state(self): except ImageNotFoundErr as _: # 处理点击延迟或者网络波动导致的匹配失败 self.logger.error("Image Match Failed, Processing") + if self.timer.is_other_device_login(): + self.timer.process_other_device_login() # TODO: 处理其他设备登录 if self.timer.is_bad_network(timeout=5): self.timer.process_bad_network(extra_info="update_state", timeout=5) if self.Info.last_state == "spot_enemy_success":