- Python 后端 + 单页前端 + Android(Chaquopy) 壳 - 曲库 1343 首 / 称号 2800 个 - 机台身份与店铺信息已抹除,字段留空 - 打包脚本含 16KB 页对齐与自动脱敏
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""
|
||
GetUserOption.py —— 取用户游戏设置(GetUserOptionApi)
|
||
================================================================================
|
||
|
||
取玩家的音符速度、判定显示、音量等游戏内设置(48 个字段)。
|
||
|
||
对应接口:GetUserOptionApi
|
||
请求体 :UserIdRequestVO
|
||
响应 :userOption 的字段直接平铺在响应顶层
|
||
依据 :source/Assembly-CSharp/Net.VO.Mai2/UserOptionRequestVO.cs
|
||
|
||
★ 形态提醒:Get 侧响应是**平铺**的(顶层直接就是 optionKind/noteSpeed/...),
|
||
而回传 Upsert 时要包成单元素数组 userOption:[{...}]。
|
||
裁剪时要丢掉 tempoVolume(真机 Upsert 报文里没有这个字段)。
|
||
|
||
调用示例:
|
||
from api import GetUserOption
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from typing import Any, Dict, Optional
|
||
|
||
from config import CLIENT_ID, TIMEOUT_MS
|
||
|
||
from .LogSetup import log_info
|
||
from .MaimaiNet import MaimaiNetClient
|
||
from .UserGetterCommon import _get, UserIdRequestVO
|
||
|
||
|
||
def GetUserOption(
|
||
user_id: int,
|
||
*,
|
||
client_id: str = CLIENT_ID,
|
||
timeout_ms: Optional[int] = None,
|
||
client: Optional[MaimaiNetClient] = None,
|
||
) -> Dict[str, Any]:
|
||
"""
|
||
取用户游戏设置(对应 GetUserOptionApi)。
|
||
|
||
返回:
|
||
原始响应 dict,设置字段平铺在顶层
|
||
"""
|
||
log_info("取用户游戏设置:user_id=" + str(user_id))
|
||
return _get("GetUserOptionApi", UserIdRequestVO(userId=user_id), user_id,
|
||
client_id=client_id, timeout_ms=timeout_ms, client=client)
|