From 006beb88f09fa20c10ab46a0423cebe2abdadd68 Mon Sep 17 00:00:00 2001 From: popjdh Date: Sat, 17 Dec 2022 13:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Python=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Python/asst.py | 8 ++++---- src/Python/sample.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Python/asst.py b/src/Python/asst.py index cfa49bc82f..2f44f3d746 100644 --- a/src/Python/asst.py +++ b/src/Python/asst.py @@ -10,11 +10,11 @@ from enum import Enum, unique, auto JSON = Union[Dict[str, Any], List[Any], int, str, float, bool, Type[None]] - -class ExternalConfigType(Enum): +class InstanceOptionType(Enum): touch_type: 2 deployment_with_pause: 3 + class Asst: CallBackType = ctypes.CFUNCTYPE( None, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p) @@ -78,7 +78,7 @@ class Asst: Asst.__lib.AsstDestroy(self.__ptr) self.__ptr = None - def set_external_config(self, config_type: ExternalConfigType, config_value: str): + def set_instance_option(self, option_type: InstanceOptionType, option_value: str): """ 设置额外配置 参见${MaaAssistantArknights}/src/MaaCore/Assistant.cpp#set_instance_option @@ -90,7 +90,7 @@ class Asst: :return: 是否设置成功 """ return Asst.__lib.AsstSetInstanceOption(self.__ptr, - config_type, config_value.encode('utf-8')) + option_type, option_value.encode('utf-8')) def connect(self, adb_path: str, address: str, config: str = 'General', touch_config: str = 'minitouch'): diff --git a/src/Python/sample.py b/src/Python/sample.py index 26fcd9c0de..53030c2642 100644 --- a/src/Python/sample.py +++ b/src/Python/sample.py @@ -2,7 +2,7 @@ import json import pathlib import time -from asst import ExternalConfigType, Asst, Message +from asst import InstanceOptionType, Asst, Message @Asst.CallBackType @@ -28,9 +28,9 @@ if __name__ == "__main__": ## 设置额外配置 # 触控方案配置 - # asst.set_external_config(ExternalConfigType.touch_type, 'maatouch') + # asst.set_instance_option(InstanceOptionType.touch_type, 'maatouch') # 暂停下干员 - # asst.set_external_config(ExternalConfigType.deployment_with_pause, '1') + # asst.set_instance_option(InstanceOptionType.deployment_with_pause, '1') # 请自行配置 adb 环境变量,或修改为 adb 可执行程序的路径 if asst.connect('adb.exe', '127.0.0.1:5555'):