Files
UnrealLuaDemo/Script/ts/README.md
T

52 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TypeScript Scripts (`Script/ts`)
本目录是基于 **`ts2lua-unreal`**(TypeScriptToLua + UnLua 定制编译器插件)的 TypeScript 脚本工程,编译产物输出至 `../lua`(即 `Script/lua/`)。
## 目录结构
```text
Script/ts/
├── package.json # 依赖 ts2lua-unreal(Git Tag 锁定)与编译脚本
├── package-lock.json # 锁定精确版本
├── tsconfig.json # 继承 ts2lua-unreal/tsconfig.base.json,outDir -> ../lua
├── types/
│ ├── ue/ # UnLua 自动生成的运行时 UE 反射与蓝图 .d.ts(已裁剪 Editor 模块,请勿手改)
│ └── project.d.ts # 本项目自定义非 UE 全局类型声明
└── src/
├── Framework/ # 纯逻辑基础框架模块(@noSelfInFile)
│ ├── Bootstrap.ts
│ ├── EventBus.ts
│ ├── HotReload.ts
│ └── Log.ts
└── Game/ # UnLua 绑定类(@unlua)
├── LuaGameInstance.ts
├── LuaGameMode.ts
├── LuaPlayerController.ts
├── LuaCharacter.ts
└── LuaDemoActor.ts
```
## 常用命令
```bash
cd Script/ts
# 安装依赖
npm install
# 全量编译到 ../lua
npm run build
# 增量监听模式(开发期配合 PIE + UnLua HotReload 使用)
npm run watch
# 查看当前 ts2lua-unreal 版本及本地文档路径
npm run info
```
## 规范与文档
- 项目编码约束:[AGENTS.md](../../AGENTS.md)
- 完整语言约束规范:`node_modules/ts2lua-unreal/docs/ts-unlua-spec.md`
- 接入与版本升级指南:`node_modules/ts2lua-unreal/docs/integration-guide.md`