From 56841ccd94ff64aff096abb570d21ca4ecc09d5e Mon Sep 17 00:00:00 2001 From: popjdh Date: Sat, 17 Dec 2022 11:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Python=E8=A7=A6=E6=8E=A7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Python/asst.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Python/asst.py b/src/Python/asst.py index 4c03a0f420..e02ec0d451 100644 --- a/src/Python/asst.py +++ b/src/Python/asst.py @@ -73,17 +73,22 @@ class Asst: Asst.__lib.AsstDestroy(self.__ptr) self.__ptr = None - def connect(self, adb_path: str, address: str, config: str = 'General'): + def connect(self, adb_path: str, address: str, config: str = 'General', touch_config: str = 'Default'): """ 连接设备 :params: - ``adb_path``: adb 程序的路径 - ``address``: adb 地址+端口 - ``config``: adb 配置,可参考 resource/config.json + ``adb_path``: adb 程序的路径 + ``address``: adb 地址+端口 + ``config``: adb 配置,可参考 resource/config.json + ``touch_config``: 触控配置, 参见 ${MaaAssistantArknights}/src/MaaCore/AsstCaller.cpp#AsstSetInstanceOption + 默认配置为'minitouch', 可选配置'adb', 'maatouch' :return: 是否连接成功 """ + if touch_config != 'Default': + Asst.__lib.AsstSetInstanceOption(self.__ptr, + 2, touch_config.encode('utf-8')) return Asst.__lib.AsstConnect(self.__ptr, adb_path.encode('utf-8'), address.encode('utf-8'), config.encode('utf-8'))