msw-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMSW Search
MSW 搜索
MSW has two distinct search targets. They behave differently, so they are covered in separate sections.
- API docs & implementation guides — Vector search that provides the details, code examples, related APIs, and implementation guidance that lacks.
.d.mlua - Resources — REST API to search and browse sprites, animations, sounds, resource packs, and avatars. The only path for obtaining RUIDs.
MSW 拥有两种不同的搜索目标,它们的行为逻辑不同,因此分为单独章节介绍。
- API 文档与实现指南 — 向量搜索,可提供 .d.mlua 中缺失的细节、代码示例、相关 API 及实现指导。
- 资源 — REST API,用于搜索和浏览 sprites、animations、sounds、resource packs 和 avatars,是获取 RUID 的唯一途径。
Routing Table
路由表
| Request type | Go to section |
|---|---|
| "How do I implement this?", "Show me an example", "What related APIs exist?" | Document search |
| ".d.mlua only has the signature; the description is insufficient" | Document search |
| "I don't know the API name (semantic search)" | Document search ( |
| "Implementation guide / best practice / pattern" | Document search ( |
| "I need a SpriteRUID", "Find a sprite for monster / NPC / background" | Resource search |
| "Find an animation / sound / resource pack" | Resource search |
| "Details for this RUID", "Similar resources" | Resource search |
| "Avatar rendering / default avatar" | Resource search |
| 请求类型 | 跳转章节 |
|---|---|
| "如何实现这个功能?"、"给我看示例"、"有哪些相关 API?" | 文档搜索 |
| ".d.mlua 仅包含签名,描述信息不足" | 文档搜索 |
| "我不知道 API 名称(语义搜索)" | 文档搜索( |
| "实现指南 / 最佳实践 / 设计模式" | 文档搜索( |
| "我需要 SpriteRUID"、"查找怪物/NPC/背景的 sprite" | 资源搜索 |
| "查找动画/音效/资源包" | 资源搜索 |
| "该 RUID 的详情"、"相似资源" | 资源搜索 |
| "头像渲染 / 默认头像" | 资源搜索 |
Section 1 — Document Search (APIs & Guides)
章节一 — 文档搜索(API 与指南)
Vector search that supplies the detailed descriptions, code examples, related APIs, and implementation guides missing from .
.d.mlua向量搜索,可补充 缺失的详细描述、代码示例、相关 API 及实现指南。
.d.mluaAccess Methods
访问方式
The same vector search backend can be accessed through two paths. Results are identical.
| Method | Condition | Usage |
|---|---|---|
| MCP tool | | Call |
| Direct curl | Fallback when MCP is not connected | |
同一向量搜索后端可通过两种途径访问,搜索结果完全一致。
| 方式 | 条件 | 使用方法 |
|---|---|---|
| MCP 工具 | 已连接 | 调用 |
| 直接 curl 请求 | MCP 未连接时的备选方案 | |
Decision Flow
决策流程
Need API-related information
│
├─ Checking signature / type / property / enum
│ → Read .d.mlua first (highest priority)
│ → If .d.mlua is insufficient, use vector search
│ (code examples, parameter details, related APIs, etc.)
│
├─ Implementation guide / pattern / best practice
│ → Vector search (type=document)
│
├─ Don't know the API name (semantic search)
│ → Vector search (type=both)
│
└─ How to access vector search:
├─ msw-guide-mcp connected? → MCP tool
└─ Not connected → curl需要 API 相关信息
│
├─ 检查签名 / 类型 / 属性 / 枚举
│ → 优先查看 .d.mlua
│ → 若 .d.mlua 信息不足,使用向量搜索
│ (代码示例、参数细节、相关 API 等)
│
├─ 实现指南 / 设计模式 / 最佳实践
│ → 向量搜索(type=document)
│
├─ 不知道 API 名称(语义搜索)
│ → 向量搜索(type=both)
│
└─ 如何访问向量搜索:
├─ 是否已连接 msw-guide-mcp?→ 使用 MCP 工具
└─ 未连接 → 使用 curlAPI Research Order
API 调研优先级
Priority 1 — .d.mlua (always first)
优先级 1 — .d.mlua(始终优先)
If you know the API name, always read first. Signatures, types, properties, event parameters, and enum values can be confirmed here accurately.
.d.mluaPath:
Environment/NativeScripts/{Component,Service,Event,Enum,Logic,Misc}/Name.d.mlua| Situation | Example |
|---|---|
| Confirm method signature | "Does TransformComponent have SetPosition?" |
| Property type / existence | "What is the type of SpriteRendererComponent.RUID?" |
| Event parameter structure | "What are the AttackEvent constructor parameters?" |
| List of enum values | "What are the BodyMoveType values?" |
| Method existence | "What methods does SpawnService have?" |
若已知 API 名称,务必先查看 。签名、类型、属性、事件参数及枚举值均可在此准确确认。
.d.mlua路径:
Environment/NativeScripts/{Component,Service,Event,Enum,Logic,Misc}/Name.d.mlua| 场景 | 示例 |
|---|---|
| 确认方法签名 | "TransformComponent 是否有 SetPosition 方法?" |
| 属性类型 / 存在性 | "SpriteRendererComponent.RUID 的类型是什么?" |
| 事件参数结构 | "AttackEvent 的构造函数参数有哪些?" |
| 枚举值列表 | "BodyMoveType 的取值有哪些?" |
| 方法存在性 | "SpawnService 有哪些方法?" |
Priority 2 — Vector search (when .d.mlua is not enough)
优先级 2 — 向量搜索(.d.mlua 信息不足时)
.d.mlua| Situation | Search type | Example query |
|---|---|---|
| Need a code example | | |
| Parameter details | | |
| Related API cross-references | | |
| ScriptOverridable check | | |
| Don't know the API name | | |
| "How do I …?" implementation guide | | |
| Pattern / best practice | | |
MCP mapping:=mlua_API_Retriever,type=api=mlua_Document_Retriever.type=document
.d.mlua| 场景 | 搜索类型 | 查询示例 |
|---|---|---|
| 需要代码示例 | | |
| 参数细节 | | |
| 相关 API 交叉引用 | | |
| ScriptOverridable 检查 | | |
| 不知道 API 名称 | | |
| “如何实现……?” 类实现指南 | | |
| 设计模式 / 最佳实践 | | |
MCP 映射关系:=mlua_API_Retriever,type=api=mlua_Document_Retriever。type=document
MCP Tool Usage
MCP 工具使用方法
When is connected:
msw-guide-mcp| Tool | Maps to type | Description |
|---|---|---|
| | API details for Service / Component / Misc etc. (signatures, parameters, examples) |
| | Authoring manuals, guidelines, MLua usage, and other document-style material |
Tool names and parameters follow the latest MCP schema.
Connection check: If a tool call errors out, it is not connected — fall back to curl.
当已连接 时:
msw-guide-mcp| 工具 | 对应类型 | 描述 |
|---|---|---|
| | 服务/组件/杂项等的 API 详情(签名、参数、示例) |
| | 创作手册、指南、MLua 使用说明及其他文档类内容 |
工具名称和参数遵循最新 MCP 规范。
连接检查:若工具调用报错,则说明未连接,需切换至 curl 请求。
Direct curl Usage
直接 curl 请求使用方法
When is not connected:
msw-guide-mcpGET http://10.10.200.51:31817/search?q={query}&type={type}&limit={limit}| Parameter | Required | Value | Description |
|---|---|---|---|
| O | string | Search query (natural language or API name) |
| X | | Search scope (default: |
| X | integer | Max results (default: 5) |
当未连接 时:
msw-guide-mcpGET http://10.10.200.51:31817/search?q={query}&type={type}&limit={limit}| 参数 | 必填 | 取值 | 描述 |
|---|---|---|---|
| 是 | string | 搜索查询(自然语言或 API 名称) |
| 否 | | 搜索范围(默认值: |
| 否 | integer | 最大结果数(默认值:5) |
How to choose type
type如何选择 type
type| Intent | type |
|---|---|
| Specific API spec (parameters, return type, example) | |
| Implementation guidance (how-to, tutorial, concept) | |
| Ambiguous or broad scope | |
| 意图 | type |
|---|---|
| 特定 API 规范(参数、返回类型、示例) | |
| 实现指导(操作步骤、教程、概念) | |
| 模糊或宽泛的搜索范围 | |
Usage Examples
使用示例
bash
undefinedbash
undefinedSpecific API details + example
特定 API 详情 + 示例
Implementation guide
实现指南
Semantic search (when exact API name is unknown)
语义搜索(未知确切 API 名称时)
Response Format
响应格式
json
{
"results": "formatted text with matching documents (title, section, content)"
}json
{
"results": "包含匹配文档的格式化文本(标题、章节、内容)"
}Error Handling
错误处理
| Code | Meaning | Action |
|---|---|---|
| Service is starting up | Retry after a short wait |
| Internal error (OpenSearch) | Fall back to |
| Connection failure | Service not running | Fall back to |
| 状态码 | 含义 | 处理方式 |
|---|---|---|
| 服务正在启动 | 稍作等待后重试 |
| 内部错误(OpenSearch) | 退而查看 |
| 连接失败 | 服务未运行 | 退而查看 |
.d.mlua vs Search — Information Comparison
.d.mlua 与搜索的信息对比
.d.mlua| Information | .d.mlua | Search |
|---|---|---|
| Method signature / types | O | O |
| Property declarations | O | O |
| Detailed method description (DetailDesc) | X | O |
| Code examples (AdditionalPageContent) | X | O |
| Per-parameter descriptions | X | O |
| Related APIs (SeeAlsoAPIs) | X | O |
| Related guides (SeeAlsoGuides) | X | O |
| ScriptOverridable flag | X | O |
| SyncDirection | Partial | O |
| Localized descriptions (Ko/Ja/Es/Zh) | X | O |
.d.mlua| 信息类型 | .d.mlua | 搜索 |
|---|---|---|
| 方法签名 / 类型 | ✅ | ✅ |
| 属性声明 | ✅ | ✅ |
| 详细方法描述(DetailDesc) | ❌ | ✅ |
| 代码示例(AdditionalPageContent) | ❌ | ✅ |
| 逐参数描述 | ❌ | ✅ |
| 相关 API(SeeAlsoAPIs) | ❌ | ✅ |
| 相关指南(SeeAlsoGuides) | ❌ | ✅ |
| ScriptOverridable 标记 | ❌ | ✅ |
| SyncDirection | 部分支持 | ✅ |
| 多语言描述(韩/日/西/中) | ❌ | ✅ |
Maker Editor Syntax → .mlua Conversion Rules
Maker Editor 语法 → .mlua 转换规则
Code examples in search results use Maker Editor syntax. They must be converted before being used in a local file.
.mlua| Item | Maker Editor | .mlua file | Note |
|---|---|---|---|
| Override declaration | | | |
| Block | | | Braces → |
| Exec space | | | Annotation must be explicit |
| Property | | | Add |
Type | | | C# int → mlua integer |
Type | | | Same (double) |
Type | | | Same (single) |
(64-bit double) andnumber(32-bit single) are assignable to each other but remain distinct types. Follow thefloatdeclaration..d.mlua
Conversion example — AttackComponent from search results:
-- Maker Editor syntax (search result)
override int CalcDamage(Entity attacker, Entity defender, string attackInfo) {
return 50
}
override boolean CalcCritical(Entity attacker, Entity defender, string attackInfo) {
return _UtilLogic:RandomDouble() < 0.3
}lua
-- Converted to .mlua
@ExecSpace("ServerOnly")
method integer CalcDamage(Entity attacker, Entity defender, string attackInfo)
return 50
end
@ExecSpace("ServerOnly")
method boolean CalcCritical(Entity attacker, Entity defender, string attackInfo)
return _UtilLogic:RandomDouble() < 0.3
end搜索结果中的代码示例使用Maker Editor 语法,需转换后才能在本地 文件中使用。
.mlua| 项 | Maker Editor | .mlua 文件 | 说明 |
|---|---|---|---|
| 重写声明 | | | |
| 代码块 | | | 大括号替换为 |
| 执行空间 | | | 必须显式添加注解 |
| 属性 | | | 若为同步属性需添加 |
类型 | | | C# int 转换为 mlua integer |
类型 | | | 保持一致(双精度) |
类型 | | | 保持一致(单精度) |
(64 位双精度)和number(32 位单精度)可相互赋值,但属于不同类型,请遵循float中的声明。.d.mlua
转换示例 — 搜索结果中的 AttackComponent:
-- Maker Editor 语法(搜索结果)
override int CalcDamage(Entity attacker, Entity defender, string attackInfo) {
return 50
}
override boolean CalcCritical(Entity attacker, Entity defender, string attackInfo) {
return _UtilLogic:RandomDouble() < 0.3
}lua
-- 转换为 .mlua
@ExecSpace("ServerOnly")
method integer CalcDamage(Entity attacker, Entity defender, string attackInfo)
return 50
end
@ExecSpace("ServerOnly")
method boolean CalcCritical(Entity attacker, Entity defender, string attackInfo)
return _UtilLogic:RandomDouble() < 0.3
endSection 2 — Resource Search (Sprite / Animation / Sound / Resource Pack / Avatar)
章节二 — 资源搜索(Sprite / Animation / Sound / Resource Pack / Avatar)
REST API for searching and browsing MSW resources.
Never guess or fabricate a RUID — always obtain one through this API.
用于搜索和浏览 MSW 资源的 REST API。切勿猜测或编造 RUID — 务必通过此 API 获取。
Base URL
基础 URL
https://resourcesearch-api.future.msw.nxdev.kr- No authentication (public API)
- All endpoints use the prefix
/v3/ - Content-Type: (for POST requests)
application/json; charset=utf-8 - Recommended timeout: 15 seconds
https://resourcesearch-api.future.msw.nxdev.kr- 无需身份验证(公开 API)
- 所有端点均使用 前缀
/v3/ - Content-Type:(POST 请求)
application/json; charset=utf-8 - 推荐超时时间:15 秒
POST body rule — always use a temp file, never inline -d '...'
-d '...'POST 请求体规则 — 务必使用临时文件,切勿直接内联 -d '...'
-d '...'For every POST endpoint in this section (,
, ), write the JSON body to a temp file first
and call curl with :
/v3/search/resources/v3/resources/batch/v3/avatar/render--data-binary "@file"bash
REQ="$TMPDIR/msw_req.json"
cat > "$REQ" <<'JSON'
{ "query": "주황버섯", "types": ["resource_pack"], "categories": ["mob"], "limit": 5 }
JSON
curl -s -X POST https://resourcesearch-api.future.msw.nxdev.kr/v3/search/resources \
-H "Content-Type: application/json; charset=utf-8" \
--data-binary "@$REQ"Why: passing JSON inline () frequently breaks on
non-ASCII input (Korean / Japanese / Chinese / emoji). The shell re-encodes the
argument and the server returns:
-d '{"query":"주황버섯",...}'{ "detail": "There was an error parsing the body" }The temp-file pattern also sidesteps the extra quoting/escaping required on Windows
(PowerShell, Git Bash). Apply it uniformly even when the body is ASCII-only, so the
recipe stays identical across platforms and languages.
On Windows PowerShell, use instead of
and write the file with (or ).
The part is unchanged.
$env:TEMP\msw_req.json$TMPDIR/msw_req.jsonSet-Content -Encoding utf8Out-File -Encoding utf8--data-binary "@file"对于本节中的所有 POST 端点(、、),需先将 JSON 请求体写入临时文件,再通过 调用 curl:
/v3/search/resources/v3/resources/batch/v3/avatar/render--data-binary "@file"bash
REQ="$TMPDIR/msw_req.json"
cat > "$REQ" <<'JSON'
{ "query": "주황버섯", "types": ["resource_pack"], "categories": ["mob"], "limit": 5 }
JSON
curl -s -X POST https://resourcesearch-api.future.msw.nxdev.kr/v3/search/resources \
-H "Content-Type: application/json; charset=utf-8" \
--data-binary "@$REQ"原因:直接内联 JSON()在处理非 ASCII 输入(韩文/日文/中文/表情符号)时经常出错。Shell 会重新编码参数,导致服务器返回:
-d '{"query":"주황버섯",...}'{ "detail": "There was an error parsing the body" }临时文件模式还能避免 Windows(PowerShell、Git Bash)下额外的引号/转义操作。即使请求体仅包含 ASCII 字符,也建议统一使用此模式,确保跨平台和跨语言的操作流程一致。
在 Windows PowerShell 中,使用 替代 ,并通过 (或 )写入文件。 部分保持不变。
$env:TEMP\msw_req.json$TMPDIR/msw_req.jsonSet-Content -Encoding utf8Out-File -Encoding utf8--data-binary "@file"Resource Types
资源类型
| type | Description |
|---|---|
| Static image (PNG) |
| Frame-based animation |
| Finished asset bundling sprites + animations + sounds |
| Sound / audio clip |
| type | 描述 |
|---|---|
| 静态图片(PNG) |
| 逐帧动画 |
| 包含 sprite + 动画 + 音效的成品资源包 |
| 音效/音频片段 |
Categories
分类
| category | Description |
|---|---|
| Monster |
| NPC |
| Map / background / terrain |
| Item |
| Effect |
| Skill |
| UI element |
| category | 描述 |
|---|---|
| 怪物 |
| NPC |
| 地图/背景/地形 |
| 物品 |
| 特效 |
| 技能 |
| UI 元素 |
RUID
RUID
A 32-character hex string that uniquely identifies every resource. Example:
"0017da7385e04bc4b2ddbe5949b4b462"- The field in search results is the RUID
id - is a separate Unity asset GUID (used in
assetGuid)spawn_preset - Never guess or fabricate a RUID — always obtain it from an API response
唯一标识每个资源的 32 位十六进制字符串。示例:
"0017da7385e04bc4b2ddbe5949b4b462"- 搜索结果中的 字段即为 RUID
id - 是独立的 Unity 资源 GUID(用于
assetGuid)spawn_preset - 切勿猜测或编造 RUID,务必从 API 响应中获取
Common Response Fields
通用响应字段
json
{
"id": "32-char hex RUID",
"type": "sprite|animationclip|resource_pack|sound",
"category": "mob|npc|map|item|effect|skill|ui",
"names": {
"ko": ["Korean name"],
"en": ["English name"]
},
"assetGuid": "Unity asset GUID (may or may not exist)",
"payload": {
"width": 64,
"height": 64,
"thumbnail": "https://...",
"pivot": {"x": 32, "y": 32},
"frames": [],
"elements": []
}
}json
{
"id": "32-char hex RUID",
"type": "sprite|animationclip|resource_pack|sound",
"category": "mob|npc|map|item|effect|skill|ui",
"names": {
"ko": ["Korean name"],
"en": ["English name"]
},
"assetGuid": "Unity asset GUID (may or may not exist)",
"payload": {
"width": 64,
"height": 64,
"thumbnail": "https://...",
"pivot": {"x": 32, "y": 32},
"frames": [],
"elements": []
}
}Endpoint Summary
端点汇总
| Method | Endpoint | Purpose |
|---|---|---|
| POST | | Natural-language semantic search |
| GET | | Find similar resources |
| GET | | Single resource details |
| POST | | Batch fetch multiple resources |
| GET | | AI-generated multilingual tags |
| GET | | List by type / category |
| GET | | Random resource recommendation |
| GET | | Resource pack details + components |
| GET | | Default avatar body / head RUIDs |
| GET | | Avatar item details |
| POST | | Render an avatar |
| 方法 | 端点 | 用途 |
|---|---|---|
| POST | | 自然语言语义搜索 |
| GET | | 查找相似资源 |
| GET | | 单个资源详情 |
| POST | | 批量获取多个资源 |
| GET | | AI 生成的多语言标签 |
| GET | | 按类型/分类列出资源 |
| GET | | 随机推荐资源 |
| GET | | 资源包详情及组件 |
| GET | | 默认头像身体/头部 RUID |
| GET | | 头像物品详情 |
| POST | | 渲染头像 |
Resource Routing Guide
资源路由指南
| Situation | Endpoint to use | Reference file |
|---|---|---|
| "Find a slime sprite" | | |
| "Any more monsters like this one?" | | |
| "Details for RUID abc123" | | |
| "Show me a list of monster sprites" | | |
| "What's inside this resource pack?" | | |
| "Render an avatar" | | |
| 场景 | 使用端点 | 参考文档 |
|---|---|---|
| "查找史莱姆 sprite" | | |
| "有没有和这个怪物类似的资源?" | | |
| "RUID abc123 的详情" | | |
| "列出所有怪物 sprite" | | |
| "这个资源包里有什么内容?" | | |
| "渲染头像" | | |
Typical Workflow
典型工作流程
1. Semantic search (POST /v3/search/resources) → obtain RUID
2. Detail lookup (GET /v3/resources/{ruid}) → inspect payload
3. For resource packs → pack details (GET /v3/resources/packs/{pack_id}) → individual element RUIDs
4. Assign the individual RUID to SpriteRendererComponent.SpriteRUIDFor detailed Request/Response of each endpoint, refer to the files under.references/resource/
1. 语义搜索(POST /v3/search/resources)→ 获取 RUID
2. 详情查询(GET /v3/resources/{ruid})→ 查看 payload
3. 若为资源包 → 查看资源包详情(GET /v3/resources/packs/{pack_id})→ 获取单个元素的 RUID
4. 将单个元素的 RUID 赋值给 SpriteRendererComponent.SpriteRUID各端点的详细请求/响应格式,请参考下的文档。references/resource/
Shared Tips
通用技巧
- Keyword choice — Use the exact name if you know it; natural-language Korean/English also works.
- Adjust — Use a larger value (10+) for broad exploration, smaller (3) for precise lookups.
limit - When search fails:
- Document search fails → read directly and check
.d.mluaJSON.mod/APIMetadata/ - Resource search fails → retry with synonyms or a different category; browse with by type/category.
GET /v3/resources - returns
POST→ you almost certainly used inline{"detail":"There was an error parsing the body"}with a non-ASCII value. Switch to the temp-file pattern (-d '{...}') described in Section 2.--data-binary "@file"
- Document search fails → read
- Composite queries are allowed — e.g. for docs,
AttackComponent CalcCriticalfor resources.red slime jump - No guessing — Never guess API names, RUIDs, or enum values; always confirm via search or references.
- 关键词选择:若已知确切名称则使用;自然语言(韩文/英文)同样有效。
- 调整 :宽泛探索时使用较大值(10+),精准查找时使用较小值(3)。
limit - 搜索失败时:
- 文档搜索失败 → 直接查看 并检查
.d.mlua下的 JSON 文件。mod/APIMetadata/ - 资源搜索失败 → 使用同义词或更换分类重试;通过 按类型/分类浏览。
GET /v3/resources - POST 请求返回 → 几乎可以肯定是使用了包含非 ASCII 值的内联
{"detail":"There was an error parsing the body"},请切换至章节二中描述的临时文件模式(-d '{...}')。--data-binary "@file"
- 文档搜索失败 → 直接查看
- 支持复合查询:例如文档搜索使用 ,资源搜索使用
AttackComponent CalcCritical。red slime jump - 切勿猜测:永远不要猜测 API 名称、RUID 或枚举值,务必通过搜索或参考文档确认。