NLDClient-yudde/.ai/skills/compile-gameplay-dll/SKILL.md

81 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
name: compile-gameplay-dll
description: 编译 GamePlay C# 源码为 GamePlay.dll。触发关键词编译 compile、GamePlay.dll、转换为Dll、build DLL、编译错误、Assembly Definition asmdef。
version: "1.0"
updated: "2026-05-08"
---
# Compile GamePlay DLL
## 触发规则
- 不要主动编译 GamePlay DLL。
- 修改 `GamePlay/` 下代码后,只提醒用户需要编译 DLL。
- 只有用户明确要求“编译 DLL / build DLL / 转换为 DLL / 执行 GamePlay.dll 编译”时,才执行本技能里的编译流程。
将 GamePlay 源码编译为 `GamePlay.dll`
## 前置知识
- **源码位置**: `Assets/Code/Scripts/GamePlay/`(独立 Git 仓库)
- **产物位置**: `Assets/Code/Scripts/GamePlay_Dll/GamePlay.dll`(属于 NLDClient 仓库)
- **编译菜单**: `Tools/文件与路径/转换为Dll`(快捷键 F1
- **Assembly Definition**: `Assets/Code/Scripts/GamePlay/GamePlay.asmdef`
## 不适用场景
- 只修改了 `GamePlay/` 以外的代码Framework/GameWrapper/UI/ 等)→ 不需要编译 DLL
- 只修改了配置表 → 走 `luban-config` 流程即可
## 编译流程
根据是否有 Unity MCP 可用,选择对应路径:
### 路径 A通过 Unity MCP 自动编译(优先)
> **前置检测**:首先确认 Unity MCP (`user-unityMCP`) 是否可用。可用则走此路径,不可用则自动降级到路径 B。
**前置步骤** — 确保代码最新:
1. `git pull` NLDClient 仓库(`../../`
2. `git pull` GamePlay 仓库(`Assets/Code/Scripts/GamePlay`
3. 刷新 Unity
```
CallMcpTool: server="user-unityMCP", toolName="refresh_unity",
arguments={ "mode": "force", "scope": "all", "compile": "request", "wait_for_ready": true }
```
4. 检查编译错误,有错误则停止。
**执行编译**
1. 调用菜单:
```
CallMcpTool: server="user-unityMCP", toolName="execute_menu_item",
arguments={ "menu_path": "Tools/文件与路径/转换为Dll" }
```
2. 等待编译完成 — 轮询 `editor_state`,检查 `isCompiling``false`
3. 检查错误:
```
CallMcpTool: server="user-unityMCP", toolName="read_console",
arguments={ "action": "get", "types": ["error"], "count": "20" }
```
4. 有错误 → 报告并停止;无错误 → 编译成功。
### 路径 B提示用户手动编译无 MCP 时)
> 请在 Unity Editor 中执行:
> 1. 菜单 `Tools/文件与路径/转换为Dll`(或快捷键 F1
> 2. 等待编译完成
> 3. 如有编译错误,将错误信息提供给 AI 修复
## 编译后处理
- 确认 `GamePlay_Dll/GamePlay.dll` 文件时间戳已更新
- 编译成功后 NLDClient 仓库会有变更(更新的 DLL 文件)
- 若需提交,走 `batch-git-ops` 流程NLDClient + GamePlay 两个仓库)
## 安全规则
- 编译前确保所有 .cs 文件已保存
- 不要在编译过程中修改源码文件
- 编译失败时优先检查 Assembly Definition 引用是否完整
- DLL 编译成功后如涉及三仓变更,必须走 batch-git-ops 流程