From 4284b479402c4ee7c2c3d70495f474d04a2df8a2 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Fri, 22 Sep 2023 17:23:30 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=94=B9=E8=BF=9BPython=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=B8=ADincremental=5Fpath=E5=8F=82=E6=95=B0=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Python/sample.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Python/sample.py b/src/Python/sample.py index ee2d248566..b91091612f 100644 --- a/src/Python/sample.py +++ b/src/Python/sample.py @@ -24,18 +24,22 @@ if __name__ == "__main__": # 设置更新器的路径和目标版本并更新 Updater(path, Version.Stable).update() - # 外服需要再额外传入增量资源路径,例如 - # incremental_path=path / 'resource' / 'global' / 'YoStarEN' + # 加载 dll 及资源 # - # 活动关导航需额外下载,可通过增量资源路径加载。 - # import urllib.request - # ota_tasks_url = 'https://ota.maa.plus/MaaAssistantArknights/api/resource/tasks.json' - # ota_tasks_path = path / 'cache' / 'resource' / 'tasks.json' - # ota_tasks_path.parent.mkdir(parents=True, exist_ok=True) - # with open(ota_tasks_path, 'w', encoding='utf-8') as f: - # with urllib.request.urlopen(ota_tasks_url) as u: - # f.write(u.read().decode('utf-8')) - # Asst.load(path=path, incremental_path=path / 'cache') + # incremental_path 参数表示增量资源所在路径。两种用法举例: + # 1. 传入外服的增量资源路径: + # Asst.load(path=path, incremental_path=path / 'resource' / 'global' / 'YoStarEN') + # 2. 加载活动关导航(需额外下载): + # # 下载活动关导航 + # import urllib.request + # ota_tasks_url = 'https://ota.maa.plus/MaaAssistantArknights/api/resource/tasks.json' + # ota_tasks_path = path / 'cache' / 'resource' / 'tasks.json' + # ota_tasks_path.parent.mkdir(parents=True, exist_ok=True) + # with open(ota_tasks_path, 'w', encoding='utf-8') as f: + # with urllib.request.urlopen(ota_tasks_url) as u: + # f.write(u.read().decode('utf-8')) + # # 加载 + # Asst.load(path=path, incremental_path=path / 'cache') Asst.load(path=path) # 若需要获取详细执行信息,请传入 callback 参数