Compare commits
388 Commits
TEngine4.0
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
eaccfdad5b | ||
![]() |
b6fbdf1d22 | ||
![]() |
e2de2ba994 | ||
![]() |
3b68cb1519 | ||
![]() |
be12d1024a | ||
![]() |
55ffdf4edb | ||
![]() |
511619cb71 | ||
![]() |
5b8793de40 | ||
![]() |
9c9079c55b | ||
![]() |
c8482799c5 | ||
![]() |
cb86d8868e | ||
![]() |
f2c7ff4336 | ||
![]() |
c18cdacdbb | ||
![]() |
b18298cbd9 | ||
![]() |
86b1ff5d7b | ||
![]() |
71eb698038 | ||
![]() |
57c08d4e92 | ||
![]() |
45f5bf3dc7 | ||
![]() |
7a86b80c2b | ||
![]() |
07fb31cc1c | ||
![]() |
4a1f2b52f6 | ||
![]() |
aee8a4a3dc | ||
![]() |
7621ba4b4a | ||
![]() |
53e16dc1ff | ||
![]() |
e26a2937a7 | ||
![]() |
e7344db57d | ||
![]() |
8ab792b778 | ||
![]() |
d6917f28b7 | ||
![]() |
9aef4d4081 | ||
![]() |
7d1de6e9a3 | ||
![]() |
9e0e762a39 | ||
![]() |
ad2bde9259 | ||
![]() |
cb8f15ad88 | ||
![]() |
b4639fcbdc | ||
![]() |
cc9002fe9a | ||
![]() |
e64926a66a | ||
![]() |
32c1edd0a5 | ||
![]() |
c6f1508e84 | ||
![]() |
1f129118a7 | ||
![]() |
6dac7b44a6 | ||
![]() |
2e8d181bed | ||
![]() |
b42daa035e | ||
![]() |
e7b07dfea2 | ||
![]() |
62c05e7c2b | ||
![]() |
4c4a882b21 | ||
![]() |
58d7847079 | ||
![]() |
724f52bbab | ||
![]() |
0b409436a0 | ||
![]() |
cc799ce426 | ||
![]() |
35a9729930 | ||
![]() |
0e34c99398 | ||
![]() |
240da47fc3 | ||
![]() |
04109a43b6 | ||
![]() |
bc82685ec7 | ||
![]() |
1894cd4d72 | ||
![]() |
4c903e8da5 | ||
![]() |
03aabf6b08 | ||
![]() |
c1d9fe5ca7 | ||
![]() |
122b5b27ad | ||
![]() |
9a8de43e95 | ||
![]() |
06d826d4b2 | ||
![]() |
afd0c6a24e | ||
![]() |
7f9dddaec0 | ||
![]() |
d97538481e | ||
![]() |
c72ef8e197 | ||
![]() |
7c9393051c | ||
![]() |
e4c3247546 | ||
![]() |
6e9d23b2dc | ||
![]() |
eae827a600 | ||
![]() |
f916adb71b | ||
![]() |
227283864f | ||
![]() |
32418326b1 | ||
![]() |
6570f87074 | ||
![]() |
81b00ae913 | ||
![]() |
322aaa0a46 | ||
![]() |
8f5b1b2117 | ||
![]() |
54a4c55f3c | ||
![]() |
e37c066f9f | ||
![]() |
b1d06ecef5 | ||
![]() |
27ce7e8ecc | ||
![]() |
8b715ffc8e | ||
![]() |
e8fa910f1f | ||
![]() |
3b3bc7822a | ||
![]() |
3c662e489e | ||
![]() |
5cebc82ba1 | ||
![]() |
5cb72e0b08 | ||
![]() |
500e012f2e | ||
![]() |
82332ba5b4 | ||
![]() |
55a6ab1ffb | ||
![]() |
24313b61ab | ||
![]() |
876b36b3b9 | ||
![]() |
2a62a1f320 | ||
![]() |
b6e6c1c423 | ||
![]() |
230f6a0be5 | ||
![]() |
25ca5f3f2b | ||
![]() |
66c5a41be5 | ||
![]() |
61ba472346 | ||
![]() |
9ce4fb9d88 | ||
![]() |
e405236d4d | ||
![]() |
2e27941755 | ||
![]() |
14bbb993f8 | ||
![]() |
0ba9d1a8b7 | ||
![]() |
2818edb575 | ||
![]() |
5210c1d36b | ||
![]() |
cdc7a8f688 | ||
![]() |
c20f8285d8 | ||
![]() |
f2a63978da | ||
![]() |
36db2f3aba | ||
![]() |
61b2baeaf7 | ||
![]() |
7aab91215c | ||
![]() |
4ae417337b | ||
![]() |
52ac77d5e4 | ||
![]() |
515d55e19a | ||
![]() |
a4221e36f8 | ||
![]() |
58cecd2071 | ||
![]() |
81a794cff3 | ||
![]() |
5e6d98764c | ||
![]() |
385de69cb9 | ||
![]() |
b68a5a84b9 | ||
![]() |
8ede4c7faa | ||
![]() |
f4d89bb420 | ||
![]() |
202df9ff62 | ||
![]() |
e4989425e8 | ||
![]() |
a7b6d6f478 | ||
![]() |
db3fd11cb2 | ||
![]() |
a2fe29af24 | ||
![]() |
bf92b4d568 | ||
![]() |
b060057c36 | ||
![]() |
9bffcce30e | ||
![]() |
be3b6eb8f2 | ||
![]() |
a61d8bd668 | ||
![]() |
fae2afd3c8 | ||
![]() |
a309cd2f98 | ||
![]() |
3dc478c509 | ||
![]() |
c728dc4c0f | ||
![]() |
e9d6c27006 | ||
![]() |
33bdcbd913 | ||
![]() |
ac236e4b6a | ||
![]() |
d6f5e65ab4 | ||
![]() |
95412017e3 | ||
![]() |
07f02acb1e | ||
![]() |
c03170e860 | ||
![]() |
aa5dc9dcb4 | ||
![]() |
53665f669c | ||
![]() |
91403615bc | ||
![]() |
77b2fdceb8 | ||
![]() |
7b7b14a8c3 | ||
![]() |
c7f3511bd3 | ||
![]() |
e089aead36 | ||
![]() |
d169b62fc5 | ||
![]() |
ab10c587f8 | ||
![]() |
bbeecb2855 | ||
![]() |
39c9d327a1 | ||
![]() |
50c72fb341 | ||
![]() |
b0c357bba2 | ||
![]() |
6a1ea3d9b8 | ||
![]() |
6a6caebcff | ||
![]() |
e3bf57f485 | ||
![]() |
77d07e175a | ||
![]() |
106d90da4d | ||
![]() |
dd471eed08 | ||
![]() |
f32e5e79a3 | ||
![]() |
4c325f7ca6 | ||
![]() |
d11b6e628e | ||
![]() |
5e568b203b | ||
![]() |
5bb168a958 | ||
![]() |
6cf5aa46c1 | ||
![]() |
9b72cbcb7c | ||
![]() |
32fbb971e7 | ||
![]() |
d6d2f66902 | ||
![]() |
4a1876897c | ||
![]() |
551727687f | ||
![]() |
aad8ff3ee5 | ||
![]() |
df25a1adad | ||
![]() |
634a392a1f | ||
![]() |
b869a05220 | ||
![]() |
37d88c2d94 | ||
![]() |
f3aa8824d8 | ||
![]() |
99c5afcbc5 | ||
![]() |
4075588c34 | ||
![]() |
fdd9f34132 | ||
![]() |
a2ab6efc71 | ||
![]() |
67025c806e | ||
![]() |
38afa45f9c | ||
![]() |
0dc572f43e | ||
![]() |
0679d924c1 | ||
![]() |
3de8cad99a | ||
![]() |
065d5a7303 | ||
![]() |
c089eb32ba | ||
![]() |
d571a937f8 | ||
![]() |
89210483a9 | ||
![]() |
058ac2c9a5 | ||
![]() |
990222c7c6 | ||
![]() |
d3914a96bb | ||
![]() |
4b178a9fa9 | ||
![]() |
79929c4ac3 | ||
![]() |
38fa4d5cbc | ||
![]() |
3ac6977f93 | ||
![]() |
3facec8f93 | ||
![]() |
0570982b97 | ||
![]() |
f785264873 | ||
![]() |
4911ec074c | ||
![]() |
6ff9546152 | ||
![]() |
5a8dc04b9c | ||
![]() |
d4482cf1c4 | ||
![]() |
c7fad139ba | ||
![]() |
650469a7db | ||
![]() |
c7c00eac9f | ||
![]() |
5a883bc8ec | ||
![]() |
79c1026c7c | ||
![]() |
f2c69d58b2 | ||
![]() |
c38d3b7cfa | ||
![]() |
98cb74537a | ||
![]() |
ed19a75be9 | ||
![]() |
fd82ddf427 | ||
![]() |
e53ceb0095 | ||
![]() |
9afda78735 | ||
![]() |
5734d4f995 | ||
![]() |
dc7ab7fd64 | ||
![]() |
fcb3416acd | ||
![]() |
3df18c006d | ||
![]() |
6cfae215dc | ||
![]() |
1aaa46c82c | ||
![]() |
ca79adce7c | ||
![]() |
b520eba187 | ||
![]() |
b5afaca217 | ||
![]() |
ea2efbf588 | ||
![]() |
a4b1befc5a | ||
![]() |
8dcddfa328 | ||
![]() |
dd37d130da | ||
![]() |
24d7dbc677 | ||
![]() |
491100b932 | ||
![]() |
c84c21574d | ||
![]() |
7914660f8c | ||
![]() |
b00679a276 | ||
![]() |
cd9a10ccac | ||
![]() |
f11098d32e | ||
![]() |
db6e715fa6 | ||
![]() |
c2edf71ee4 | ||
![]() |
75af7c22c7 | ||
![]() |
2f9edf83bf | ||
![]() |
815095efaf | ||
![]() |
3101a64a48 | ||
![]() |
457e0f36a4 | ||
![]() |
0bd30def23 | ||
![]() |
d24db83c8b | ||
![]() |
18a2840777 | ||
![]() |
1d901514e1 | ||
![]() |
983279c56d | ||
![]() |
e9540c620a | ||
![]() |
39be280d88 | ||
![]() |
f9f9122027 | ||
![]() |
682a0bd786 | ||
![]() |
34c514cae8 | ||
![]() |
c707cc1a38 | ||
![]() |
f016fdd0a6 | ||
![]() |
4c0f5a77f9 | ||
![]() |
ae0d00424f | ||
![]() |
c8ecac5815 | ||
![]() |
4f8c1cdfdd | ||
![]() |
dff043e075 | ||
![]() |
e69dc47b8f | ||
![]() |
fc2ef0714c | ||
![]() |
d75c1c8c93 | ||
![]() |
83bea559e4 | ||
![]() |
26689639ed | ||
![]() |
bd6ac5f4da | ||
![]() |
70dcb03a3f | ||
![]() |
59b3649155 | ||
![]() |
2c025efe3b | ||
![]() |
7ae6ef94ba | ||
![]() |
d5bb64b314 | ||
![]() |
4c34858ce0 | ||
![]() |
5adb2f83e5 | ||
![]() |
f10a89180e | ||
![]() |
3e3314858e | ||
![]() |
da57ed845f | ||
![]() |
df570f453a | ||
![]() |
a500a08a30 | ||
![]() |
2daac0e065 | ||
![]() |
514da6e99e | ||
![]() |
7f91241df7 | ||
![]() |
071974ab4f | ||
![]() |
c01e03ff70 | ||
![]() |
6fec792e05 | ||
![]() |
04ecf71eab | ||
![]() |
693ca5bb3d | ||
![]() |
90f84a2764 | ||
![]() |
6107b41770 | ||
![]() |
1423a3716a | ||
![]() |
6a87db76ee | ||
![]() |
3a6170dca6 | ||
![]() |
9d137d613a | ||
![]() |
ba77ec6b45 | ||
![]() |
b661da68f2 | ||
![]() |
e1040110bb | ||
![]() |
2d53fa1687 | ||
![]() |
c4ef07f13e | ||
![]() |
1f2d99ddc9 | ||
![]() |
edf4925a7a | ||
![]() |
5d67238c8f | ||
![]() |
6cfd352482 | ||
![]() |
40373c473d | ||
![]() |
d799f9fdf0 | ||
![]() |
15735c3d2d | ||
![]() |
818a74f437 | ||
![]() |
f248757401 | ||
![]() |
6ada0e7de7 | ||
![]() |
7ea472f97e | ||
![]() |
fb8528ff52 | ||
![]() |
e3ac92ef46 | ||
![]() |
be6a19c26a | ||
![]() |
e7f0636f30 | ||
![]() |
fb38e96e9e | ||
![]() |
dd658c7e1d | ||
![]() |
4d7cb7641d | ||
![]() |
ae075b1fad | ||
![]() |
02827ce3b8 | ||
![]() |
1a0e3f91e0 | ||
![]() |
6d376b0e07 | ||
![]() |
cb73c9a9eb | ||
![]() |
7dda73a7ac | ||
![]() |
9bcb636ed7 | ||
![]() |
bd0cfc5577 | ||
![]() |
ff613e4130 | ||
![]() |
fea1ae2278 | ||
![]() |
866c440479 | ||
![]() |
48ff839d64 | ||
![]() |
69be3cfa23 | ||
![]() |
5f2c27ecf0 | ||
![]() |
ef17cd851b | ||
![]() |
f186d6b058 | ||
![]() |
4385123976 | ||
![]() |
1334dc30f9 | ||
![]() |
af822add2c | ||
![]() |
ffb1f214ad | ||
![]() |
213aaed426 | ||
![]() |
623d301e41 | ||
![]() |
2870383afe | ||
![]() |
1ad435958a | ||
![]() |
386787c6ec | ||
![]() |
cd65dde4c3 | ||
![]() |
8321e77421 | ||
![]() |
1b6f80952e | ||
![]() |
b52e655c30 | ||
![]() |
8c0df95626 | ||
![]() |
0d1e308f1c | ||
![]() |
f8797538fd | ||
![]() |
fe4e168041 | ||
![]() |
8e9047d3a3 | ||
![]() |
04bfaeccc8 | ||
![]() |
d66c823c15 | ||
![]() |
0ec1424f0a | ||
![]() |
01f8eb9d57 | ||
![]() |
f5021a9688 | ||
![]() |
a632f7a5ad | ||
![]() |
5f968f4154 | ||
![]() |
c9fe83c2bd | ||
![]() |
2c00d103cb | ||
![]() |
1d56437d9f | ||
![]() |
69db1ff977 | ||
![]() |
48887b1aee | ||
![]() |
381ea8bb8d | ||
![]() |
7401edac15 | ||
![]() |
b1c7f30be9 | ||
![]() |
cfaf82a623 | ||
![]() |
6992d12c6c | ||
![]() |
119d9683ad | ||
![]() |
9478868513 | ||
![]() |
6ed32082e1 | ||
![]() |
6ee515e8c5 | ||
![]() |
b839afa76a | ||
![]() |
d9605b348a | ||
![]() |
dfef83919c | ||
![]() |
f5f983f220 | ||
![]() |
d61b1206ee | ||
![]() |
3650ba1a8b | ||
![]() |
8f14a4d2cb | ||
![]() |
dc22e595c9 | ||
![]() |
0e70f7d446 | ||
![]() |
039569b2d4 | ||
![]() |
ea38004ba2 | ||
![]() |
cc97c0583a | ||
![]() |
887094a4b1 | ||
![]() |
0d09a7e73b | ||
![]() |
d8f8514f9d | ||
![]() |
f2f6b2422f | ||
![]() |
3a9cad9397 |
@@ -13,11 +13,12 @@
|
|||||||

|

|
||||||
|
|
||||||
### 4.打包运行
|
### 4.打包运行
|
||||||
* 1.运行菜单 HybridCLR/Define Symbols/Enable HybridCLR 运行开启HybridCLR热更新
|
* 1.运行菜单 HybridCLR/Install... 安装HybridCLR,每次更新HybridCLR版本需要重新执行一次安装。
|
||||||
* 2.运行菜单 HybridCLR/Generate/All 进行必要的生成操作。这一步不可遗漏!!!
|
* 2.运行菜单 HybridCLR/Define Symbols/Enable HybridCLR 运行开启HybridCLR热更新。
|
||||||
* 3.运行菜单 HybridCLR/Build/BuildAssets And CopyTo AssemblyPath,生成热更新dll并copy到热更程序集中。
|
* 3.运行菜单 HybridCLR/Generate/All 进行必要的生成操作。这一步不可遗漏!!!
|
||||||
* 4.运行菜单 YooAsset/AssetBundle Builder 构建AB
|
* 4.运行菜单 HybridCLR/Build/BuildAssets And CopyTo AssemblyPath,生成热更新dll并copy到热更程序集中。
|
||||||
* 5.打开Build Settings对话框,点击Build And Run,打包并且运行热更新示例工程。
|
* 5.运行菜单 YooAsset/AssetBundle Builder 构建AB。
|
||||||
|
* 6.打开Build Settings对话框,点击Build And Run,打包并且运行热更新示例工程。
|
||||||
|
|
||||||
### 遇到问题请查看HybridlCLR的<a href="https://hybridclr.doc.code-philosophy.com/docs/help/commonerrors"><strong>常见错误(commonerrors)</strong></a>
|
### 遇到问题请查看HybridlCLR的<a href="https://hybridclr.doc.code-philosophy.com/docs/help/commonerrors"><strong>常见错误(commonerrors)</strong></a>
|
||||||
|
|
||||||
@@ -33,26 +34,30 @@
|
|||||||
### 目录结构
|
### 目录结构
|
||||||
```
|
```
|
||||||
Assets
|
Assets
|
||||||
├── AssetRaw 资源目录
|
├── AssetArt // 美术资源目录
|
||||||
├── Atlas 图集目录
|
│ └── Atlas // 自动生成图集目录
|
||||||
├── GameScripts 热更程序集目录
|
├── AssetRaw // 热更资源目录
|
||||||
├── Scenes 主场景目录
|
│ ├── UIRaw // UI图片目录
|
||||||
└── TEngine
|
│ │ ├── Atlas // 需要自动生成图集的UI素材目录
|
||||||
├── AssetSetting YooAsset资源设置
|
│ │ └── Raw // 不需要自动生成图集的UI素材目录
|
||||||
├── Editor TEngine-Editor程序集
|
├── Editor // 编辑器脚本目录
|
||||||
└── Runtime TEngine-Runtime程序集
|
├── HybridCLRData // hybridclr相关目录
|
||||||
|
├── Scenes // 主场景目录
|
||||||
|
├── GameScripts // 程序集目录
|
||||||
|
└── TEngine // 框架核心目录
|
||||||
|
├── AssetSetting // YooAsset资源设置
|
||||||
|
├── Editor // TEngine-Editor程序集
|
||||||
|
└── Runtime // TEngine-Runtime程序集
|
||||||
```
|
```
|
||||||
|
|
||||||
### 热更新程序集划分
|
### 热更新程序集划分
|
||||||
```
|
```
|
||||||
Assets/GameScripts
|
Assets/GameScripts
|
||||||
├── Editor 编辑器程序集
|
├── Main // 主程序程序集(启动器与流程)
|
||||||
├── HotFix 游戏热更程序集目录 [Folder]
|
└── HotFix // 游戏热更程序集目录 [Folder]
|
||||||
| ├── GameBase 游戏基础框架程序集 [Dll]
|
├── GameBase // 游戏基础框架程序集 [Dll]
|
||||||
| ├── GameProto 游戏配置协议程序集 [Dll]
|
├── GameProto // 游戏配置协议程序集 [Dll]
|
||||||
| ├── BattleCore 游戏核心战斗程序集 [Dll]
|
└── GameLogic // 游戏业务逻辑程序集 [Dll]
|
||||||
| └── GameLogic 游戏业务逻辑程序集 [Dll]
|
├── GameApp.cs // 热更主入口
|
||||||
| ├── GameApp.cs 热更主入口
|
└── GameApp_RegisterSystem.cs // 热更主入口注册系统
|
||||||
| └── GameApp_RegisterSystem.cs 热更主入口注册系统
|
|
||||||
└── Runtime Runtime程序集
|
|
||||||
```
|
```
|
@@ -1,16 +1,16 @@
|
|||||||
# TEngine
|
# TEngine
|
||||||
|
|
||||||
## TEngine-Runtime
|
## TEngine-Runtime
|
||||||
### AOT内核基于Gameframework,最简化以及商业化适配。
|
### AOT内核基于Gameframework,优化、最简化以及商业化适配。
|
||||||

|

|
||||||
|
|
||||||
## AOT游戏框架模块基类。
|
## AOT游戏框架模块基类。
|
||||||
#### 框架思路为面向接口编程,如Resource资源模块,开发白皮书为先定义IResourceManager的接口规范,然后编写ResourceManager继承框架具体实现(GameFrameworkModule)以及实现接口。最后实现调用层GameFrameworkModuleBase,调用层可以拓展编辑器供开发者自定义模块参数。
|
#### 框架思路为面向接口编程,如Resource资源模块,开发白皮书为先定义IResourceManager的接口规范,然后编写ResourceManager继承框架具体实现(ModuleImp)以及实现接口。最后实现调用层Module,调用层可以拓展编辑器供开发者自定义模块参数。
|
||||||
``` csharp
|
``` csharp
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏框架模块抽象类。GameFrameworkModule为具体框架模块实现。
|
/// 游戏框架模块抽象类。ModuleImp为具体框架模块实现。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal abstract class GameFrameworkModule
|
internal abstract class ModuleImp
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取游戏框架模块优先级。
|
/// 获取游戏框架模块优先级。
|
||||||
@@ -34,16 +34,16 @@ internal abstract class GameFrameworkModule
|
|||||||
//=====================================================================//
|
//=====================================================================//
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏框架模块抽象类。GameFrameworkModuleBase 为Mono调用层。
|
/// 游戏框架模块抽象类。Module 为Mono调用层。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class GameFrameworkModuleBase : MonoBehaviour
|
public abstract class Module : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏框架模块初始化。
|
/// 游戏框架模块初始化。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
GameEntry.RegisterModule(this);
|
ModuleSystem.RegisterModule(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -51,17 +51,15 @@ public abstract class GameFrameworkModuleBase : MonoBehaviour
|
|||||||
## 热更域程序集设计与说明
|
## 热更域程序集设计与说明
|
||||||
```
|
```
|
||||||
Assets/GameScripts
|
Assets/GameScripts
|
||||||
├── Editor 编辑器程序集
|
├── Main // 主程序程序集(启动器与流程)
|
||||||
├── HotFix 游戏热更程序集目录 [Folder]
|
└── HotFix // 游戏热更程序集目录 [Folder]
|
||||||
| ├── GameBase 游戏基础框架程序集 [Dll]
|
├── GameBase // 游戏基础框架程序集 [Dll]
|
||||||
| ├── GameProto 游戏配置协议程序集 [Dll]
|
├── GameProto // 游戏配置协议程序集 [Dll]
|
||||||
| ├── BattleCore 游戏核心战斗程序集 [Dll]
|
└── GameLogic // 游戏业务逻辑程序集 [Dll]
|
||||||
| └── GameLogic 游戏业务逻辑程序集 [Dll]
|
├── GameApp.cs 热更主入口
|
||||||
| ├── GameApp.cs 热更主入口
|
└── GameApp_RegisterSystem.cs 热更主入口注册系统
|
||||||
| └── GameApp_RegisterSystem.cs 热更主入口注册系统
|
|
||||||
└── Runtime Runtime程序集
|
|
||||||
```
|
```
|
||||||
游戏内主要玩法逻辑包括UI会在GameLogic中编写,GameBase则存放一些通用性的逻辑,GameProto存放与服务区交互的协议以及配置表逻辑,BattleCore为帧同步分离的逻辑层做预留。若有项目需求完全可以进行自定义增删HotFix程序集。
|
游戏内主要玩法逻辑包括UI会在GameLogic中编写,GameBase则存放一些通用性的逻辑,GameProto存放与服务区交互的协议以及配置表逻辑。若有项目需求完全可以进行自定义增删HotFix程序集。
|
||||||
|
|
||||||
PS:注意增删程序集后需要同步到HybridClr的Setting面板以及TEngineSetting的面板。TEngineSettings面板有按钮可以从HybridClr中同步AOT与热更程序集。
|
PS:注意增删程序集后需要同步到HybridClr的Setting面板以及TEngineSetting的面板。TEngineSettings面板有按钮可以从HybridClr中同步AOT与热更程序集。
|
||||||
|
|
||||||
|
@@ -1,11 +1,19 @@
|
|||||||
# 3-6.配置表模块 - ConfigLoader
|
# 3-6.配置表模块 - ConfigSystem
|
||||||
接入最佳游戏配置解决方案 - <a href="https://github.com/focus-creative-games/luban"><strong>Luban</strong></a>
|
接入最佳游戏配置解决方案 - <a href="https://github.com/focus-creative-games/luban"><strong>Luban</strong></a>
|
||||||
|
|
||||||
<a href="https://luban.doc.code-philosophy.com/#/manual/traits"><strong>Luban文档 </strong></a>
|
<a href="https://luban.doc.code-philosophy.com/#/manual/traits"><strong>Luban文档 </strong></a>
|
||||||
|
|
||||||
### 在TEngine中Luban工具集位于以下目录
|
### 在TEngine中Luban配置表目录位于以下目录
|
||||||

|

|
||||||
|
|
||||||
|
### 安装luban配置表
|
||||||
|
1.在TEngine根目录同级克隆下最新的luban-next仓库。
|
||||||
|

|
||||||
|
2.Tools目录执行build-luban完成
|
||||||
|

|
||||||
|
|
||||||
|
3.转表则去luban配置目录执行对应bat
|
||||||
|
|
||||||
TEngine内置默认使用懒加载配置,也支持基于UniTask的异步加载,同步加载,包括服务器的Task异步加载,使用对应转表的bat即可。
|
TEngine内置默认使用懒加载配置,也支持基于UniTask的异步加载,同步加载,包括服务器的Task异步加载,使用对应转表的bat即可。
|
||||||
|
|
||||||
### 介绍
|
### 介绍
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
### ProcedureInitPackage - 流程初始化Package
|
### ProcedureInitPackage - 流程初始化Package
|
||||||
|
|
||||||
|
### ProcedurePreload - 流程预加载
|
||||||
|
|
||||||
### ProcedureInitResources - 流程初始化Resources
|
### ProcedureInitResources - 流程初始化Resources
|
||||||
|
|
||||||
### ProcedureUpdateVersion - 流程更新版本Version
|
### ProcedureUpdateVersion - 流程更新版本Version
|
||||||
@@ -20,5 +22,6 @@
|
|||||||
|
|
||||||
### ProcedureClearCache - 流程清理缓存
|
### ProcedureClearCache - 流程清理缓存
|
||||||
|
|
||||||
|
### ProcedureLoadAssembly - 流程加载进入热更新程序集
|
||||||
|
|
||||||
### ProcedureLoadAssembly - 流程加载进入热更新程序集
|
### ProcedureStartGame - 流程开始游戏
|
@@ -13,4 +13,14 @@
|
|||||||

|

|
||||||
|
|
||||||
### IOS真机运行
|
### IOS真机运行
|
||||||

|

|
||||||
|
|
||||||
|
### WebGL真机运行
|
||||||
|

|
||||||
|
|
||||||
|
### 索尼 PS5 真机运行
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|

|
16
Books/Donate.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
## <strong>Buy me a coffee.
|
||||||
|
|
||||||
|
您的赞助会让我们做得更快更好,如果觉得TEngine对您有帮助,不妨赞助我买杯咖啡吧~
|
||||||
|
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
|
||||||
|
<img src="src/Donate-微信.jpg" alt="logo" width="384" height="562">
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
|
||||||
|
<img src="src/Donate-支付宝.jpg" alt="logo" width="384" height="562">
|
||||||
|
|
||||||
|
</p>
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 74 KiB |
BIN
Books/src/3-6-2.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Books/src/3-6-3.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
Books/src/Console Output.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
Books/src/Console Viewer.png
Normal file
After Width: | Height: | Size: 477 KiB |
BIN
Books/src/Donate-微信.jpg
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
Books/src/Donate-支付宝.jpg
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
Books/src/WebGL-RunSuccessed.png
Normal file
After Width: | Height: | Size: 101 KiB |
9
BuildCLI/build_android.bat
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
cd /d %~dp0
|
||||||
|
|
||||||
|
call path_define.bat
|
||||||
|
|
||||||
|
%UNITYEDITOR_PATH%/Unity.exe %WORKSPACE% -logFile %BUILD_LOGFILE% -executeMethod TEngine.ReleaseTools.AutomationBuildAndroid -quit -batchmode -CustomArgs:Language=en_US; %WORKSPACE%
|
||||||
|
|
||||||
|
@REM for /f "delims=[" %%i in (%BUILD_LOGFILE%) do echo %%i
|
||||||
|
|
||||||
|
pause
|
18
BuildCLI/build_android.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
source ./path_define.sh
|
||||||
|
|
||||||
|
"${UNITYEDITOR_PATH}/Unity" "${WORKSPACE}" \
|
||||||
|
-logFile "${BUILD_LOGFILE}" \
|
||||||
|
-executeMethod TEngine.ReleaseTools.AutomationBuildAndroid \
|
||||||
|
-quit -batchmode \
|
||||||
|
-CustomArgs:Language=en_US "${WORKSPACE}"
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
echo "$line"
|
||||||
|
done < "${BUILD_LOGFILE}"
|
||||||
|
|
||||||
|
echo "按任意键继续..."
|
||||||
|
read -k1
|
6
BuildCLI/path_define.bat
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
cd /d %~dp0
|
||||||
|
|
||||||
|
set WORKSPACE=G:/github/TEngine/UnityProject
|
||||||
|
set UNITYEDITOR_PATH=G:/UnityEditor/2021.3.20f1c1/Editor
|
||||||
|
set BUILD_DLL_LOGFILE=./build_dll.log
|
||||||
|
set BUILD_LOGFILE=./build.log
|
14
BuildCLI/path_define.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
export WORKSPACE="/Users/your_user/github/TEngine/UnityProject" # 请替换为 macOS 上的实际路径
|
||||||
|
export UNITYEDITOR_PATH="/Applications/Unity/Hub/Editor/2021.3.20f1c1/Unity.app/Contents/MacOS" # 请替换为 macOS 上的 Unity 路径
|
||||||
|
export BUILD_DLL_LOGFILE="./build_dll.log"
|
||||||
|
export BUILD_LOGFILE="./build.log"
|
||||||
|
|
||||||
|
echo "环境变量已设置:"
|
||||||
|
echo "WORKSPACE=${WORKSPACE}"
|
||||||
|
echo "UNITYEDITOR_PATH=${UNITYEDITOR_PATH}"
|
||||||
|
echo "BUILD_DLL_LOGFILE=${BUILD_DLL_LOGFILE}"
|
||||||
|
echo "BUILD_LOGFILE=${BUILD_LOGFILE}"
|
@@ -1,48 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using GameBase;
|
|
||||||
using GameConfig;
|
|
||||||
using TEngine;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 配置加载器。
|
|
||||||
/// </summary>
|
|
||||||
public class ConfigSystem : Singleton<ConfigSystem>
|
|
||||||
{
|
|
||||||
private bool _init = false;
|
|
||||||
|
|
||||||
private Tables _tables;
|
|
||||||
|
|
||||||
public Tables Tables
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!_init)
|
|
||||||
{
|
|
||||||
Load();
|
|
||||||
}
|
|
||||||
return _tables;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载配置。
|
|
||||||
/// </summary>
|
|
||||||
public void Load()
|
|
||||||
{
|
|
||||||
_tables = new Tables(LoadByteBuf);
|
|
||||||
_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载二进制配置。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file">FileName</param>
|
|
||||||
/// <returns>ByteBuf</returns>
|
|
||||||
private ByteBuf LoadByteBuf(string file)
|
|
||||||
{
|
|
||||||
var textAssets = GameModule.Resource.LoadAsset<TextAsset>(file);
|
|
||||||
byte[] ret = textAssets.bytes;
|
|
||||||
return new ByteBuf(ret);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,61 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using GameBase;
|
|
||||||
using GameConfig;
|
|
||||||
using TEngine;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 配置加载器。
|
|
||||||
/// </summary>
|
|
||||||
public class ConfigSystem : Singleton<ConfigSystem>
|
|
||||||
{
|
|
||||||
private bool _init = false;
|
|
||||||
|
|
||||||
private Tables _tables;
|
|
||||||
|
|
||||||
public Tables Tables
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!_init)
|
|
||||||
{
|
|
||||||
Load();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _tables;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载配置。
|
|
||||||
/// </summary>
|
|
||||||
public void Load()
|
|
||||||
{
|
|
||||||
_tables = new Tables(LoadIdxByteBuf, LoadByteBuf);
|
|
||||||
_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载二进制配置。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file">FileName</param>
|
|
||||||
/// <returns>ByteBuf</returns>
|
|
||||||
private ByteBuf LoadByteBuf(string file)
|
|
||||||
{
|
|
||||||
var textAssets = GameModule.Resource.LoadAsset<TextAsset>(file);
|
|
||||||
byte[] ret = textAssets.bytes;
|
|
||||||
return new ByteBuf(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加载懒加载Index。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private ByteBuf LoadIdxByteBuf(string file)
|
|
||||||
{
|
|
||||||
var textAssets = GameModule.Resource.LoadAsset<TextAsset>($"Idx_{file}");
|
|
||||||
byte[] ret = textAssets.bytes;
|
|
||||||
return new ByteBuf(ret);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,87 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
parent_def_type = x.parent_def_type
|
|
||||||
export_fields = x.export_fields
|
|
||||||
hierarchy_export_fields = x.hierarchy_export_fields
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {{x.namespace_with_top_module}}
|
|
||||||
{
|
|
||||||
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
|
|
||||||
{
|
|
||||||
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
|
|
||||||
{
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{cs_deserialize '_buf' field.convention_name field.ctype}}
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
foreach(var _v in {{field.convention_name}})
|
|
||||||
{
|
|
||||||
{{field.convention_name}}_Index.Add(_v.{{field.index_field.convention_name}}, _v);
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static {{name}} Deserialize{{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
{{~if x.is_abstract_type~}}
|
|
||||||
switch (_buf.ReadInt())
|
|
||||||
{
|
|
||||||
{{~for child in x.hierarchy_not_abstract_children~}}
|
|
||||||
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
default: throw new SerializationException();
|
|
||||||
}
|
|
||||||
{{~else~}}
|
|
||||||
return new {{x.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} { get; private set; }
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.convention_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
public {{field.cs_ref_validator_define}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~if (gen_datetime_mills field.ctype) ~}}
|
|
||||||
public long {{field.convention_name}}_Millis => {{field.convention_name}} * 1000L;
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_text_key~}}
|
|
||||||
public {{cs_define_text_key_field field}} { get; }
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~if !x.is_abstract_type~}}
|
|
||||||
public const int __ID__ = {{x.id}};
|
|
||||||
public override int GetTypeId() => __ID__;
|
|
||||||
{{~end~}}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return "{{full_name}}{ "
|
|
||||||
{{~for field in hierarchy_export_fields ~}}
|
|
||||||
+ "{{field.convention_name}}:" + {{cs_to_string field.convention_name field.ctype}} + ","
|
|
||||||
{{~end~}}
|
|
||||||
+ "}";
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,413 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace {{x.namespace_with_top_module}}
|
|
||||||
{
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
key_type = x.key_ttype
|
|
||||||
key_type1 = x.key_ttype1
|
|
||||||
key_type2 = x.key_ttype2
|
|
||||||
value_type = x.value_ttype
|
|
||||||
}}
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public partial class {{name}}
|
|
||||||
{
|
|
||||||
public static {{name}} Instance { get; private set; }
|
|
||||||
{{~if x.is_map_table ~}}
|
|
||||||
private bool _readAll = false;
|
|
||||||
private Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> _dataMap;
|
|
||||||
private List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
public Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> DataMap
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAll)
|
|
||||||
{
|
|
||||||
ReadAll();
|
|
||||||
_readAll = true;
|
|
||||||
}
|
|
||||||
return _dataMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public List<{{cs_define_type value_type}}> DataList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAll)
|
|
||||||
{
|
|
||||||
ReadAll();
|
|
||||||
_readAll = true;
|
|
||||||
}
|
|
||||||
return _dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private Dictionary<{{cs_define_type key_type}},int> _indexMap;
|
|
||||||
public List<{{cs_define_type key_type}}> Indexes;
|
|
||||||
private System.Func<ByteBuf> _dataLoader;
|
|
||||||
|
|
||||||
private void ReadAll()
|
|
||||||
{
|
|
||||||
_dataList.Clear();
|
|
||||||
foreach(var index in Indexes)
|
|
||||||
{
|
|
||||||
var v = Get(index);
|
|
||||||
_dataMap[index] = v;
|
|
||||||
_dataList.Add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
|
|
||||||
{
|
|
||||||
Instance = this;
|
|
||||||
_dataMap = new Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}>();
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
_indexMap = new Dictionary<{{cs_define_type key_type}}, int>();
|
|
||||||
_dataLoader = new System.Func<ByteBuf>(() => _loader(_tbName));
|
|
||||||
|
|
||||||
for (int n = _buf.ReadSize(); n > 0; --n)
|
|
||||||
{
|
|
||||||
{{cs_define_type key_type}} key;
|
|
||||||
{{cs_deserialize '_buf' 'key' key_type}}
|
|
||||||
int index = _buf.ReadInt();
|
|
||||||
_indexMap[key] = index;
|
|
||||||
}
|
|
||||||
Indexes = _indexMap.Keys.ToList();
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~if value_type.is_dynamic~}}
|
|
||||||
public T GetOrDefaultAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}}
|
|
||||||
{
|
|
||||||
if(_indexMap.TryGetValue(key,out var _))
|
|
||||||
{
|
|
||||||
return (T)Get(key);
|
|
||||||
}
|
|
||||||
return default(T);
|
|
||||||
}
|
|
||||||
public T GetAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => (T)Get(key);
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type value_type}} this[{{cs_define_type key_type}} key] => Get(key);
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_define_type key_type}} key)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
if(_dataMap.TryGetValue(key, out _v))
|
|
||||||
{
|
|
||||||
return _v;
|
|
||||||
}
|
|
||||||
ResetByteBuf(_indexMap[key]);
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataMap[_v.{{x.index_field.convention_name}}] = _v;
|
|
||||||
_v.Resolve(tables);
|
|
||||||
if(_indexMap.Count == _dataMap.Count)
|
|
||||||
{
|
|
||||||
_buf = null;
|
|
||||||
}
|
|
||||||
return _v;
|
|
||||||
}
|
|
||||||
public {{cs_define_type value_type}} GetOrDefault({{cs_define_type key_type}} key)
|
|
||||||
{
|
|
||||||
if(_indexMap.TryGetValue(key,out var _))
|
|
||||||
{
|
|
||||||
return Get(key);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
{{~else if x.is_list_table ~}}
|
|
||||||
private bool _readAllList = false;
|
|
||||||
private List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
public List<{{cs_define_type value_type}}> DataList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAllList)
|
|
||||||
{
|
|
||||||
ReadAllList();
|
|
||||||
_readAllList = true;
|
|
||||||
}
|
|
||||||
return _dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private System.Func<ByteBuf> _dataLoader;
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
private bool _readAll;
|
|
||||||
private {{cs_table_union_map_type_name x}} _dataMapUnion;
|
|
||||||
public {{cs_table_union_map_type_name x}} DataMapUnion
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAll)
|
|
||||||
{
|
|
||||||
ReadAll();
|
|
||||||
_readAll = true;
|
|
||||||
}
|
|
||||||
return _dataMapUnion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ReadAll()
|
|
||||||
{
|
|
||||||
foreach(var index in Indexes)
|
|
||||||
{
|
|
||||||
var ({{cs_table_get_param_name_list x}}) = index;
|
|
||||||
var v = Get({{cs_table_get_param_name_list x}});
|
|
||||||
_dataMapUnion[({{cs_table_get_param_name_list x}})] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ReadAllList()
|
|
||||||
{
|
|
||||||
_dataList.Clear();
|
|
||||||
foreach(var index in Indexes)
|
|
||||||
{
|
|
||||||
var ({{cs_table_get_param_name_list x}}) = index;
|
|
||||||
var v = Get({{cs_table_get_param_name_list x}});
|
|
||||||
_dataList.Add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private Dictionary<({{cs_table_get_param_def_list x}}),int> _indexMap;
|
|
||||||
public List<({{cs_table_get_param_def_list x}})> Indexes;
|
|
||||||
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
private bool _readAll{{idx.index_field.convention_name}} = false;
|
|
||||||
private Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> _dataMap_{{idx.index_field.name}};
|
|
||||||
public Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> DataMap_{{idx.index_field.name}}
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAll{{idx.index_field.convention_name}})
|
|
||||||
{
|
|
||||||
ReadAll{{idx.index_field.convention_name}}();
|
|
||||||
_readAll{{idx.index_field.convention_name}} = true;
|
|
||||||
}
|
|
||||||
return _dataMap_{{idx.index_field.name}};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~if for.first ~}}
|
|
||||||
private void ReadAllList()
|
|
||||||
{
|
|
||||||
_dataList.Clear();
|
|
||||||
foreach(var index in Indexes_{{idx.index_field.name}})
|
|
||||||
{
|
|
||||||
var v = GetBy{{idx.index_field.convention_name}}(index);
|
|
||||||
_dataList.Add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
private void ReadAll{{idx.index_field.convention_name}}()
|
|
||||||
{
|
|
||||||
foreach(var index in Indexes_{{idx.index_field.name}})
|
|
||||||
{
|
|
||||||
var v = GetBy{{idx.index_field.convention_name}}(index);
|
|
||||||
_dataMap_{{idx.index_field.name}}[index] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private Dictionary<{{cs_define_type idx.type}},int> _indexMap_{{idx.index_field.name}};
|
|
||||||
public List<{{cs_define_type idx.type}}> Indexes_{{idx.index_field.name}};
|
|
||||||
{{~end~}}
|
|
||||||
{{~else~}}
|
|
||||||
private bool _readAll = false;
|
|
||||||
private Dictionary<int,int> _indexMap;
|
|
||||||
public List<int> Indexes;
|
|
||||||
private Dictionary<int, {{cs_define_type value_type}}> _dataMap;
|
|
||||||
private Dictionary<int, {{cs_define_type value_type}}> DataMap
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if(!_readAll)
|
|
||||||
{
|
|
||||||
ReadAllList();
|
|
||||||
}
|
|
||||||
return _dataMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ReadAllList()
|
|
||||||
{
|
|
||||||
_dataList.Clear();
|
|
||||||
foreach(var index in Indexes)
|
|
||||||
{
|
|
||||||
var v = Get(index);
|
|
||||||
_dataList.Add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
public {{name}}(ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
|
|
||||||
{
|
|
||||||
Instance = this;
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
_dataLoader = new System.Func<ByteBuf>(()=> _loader(_tbName));
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
_dataMapUnion = new {{cs_table_union_map_type_name x}}();
|
|
||||||
_indexMap = new Dictionary<({{cs_table_get_param_def_list x}}),int>();
|
|
||||||
{{key_value ='('}}
|
|
||||||
for (int i = _buf.ReadSize(); i > 0; i--)
|
|
||||||
{
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
{{field_name = 'key'+for.index}}
|
|
||||||
{{cs_define_type idx.type}} {{field_name}};
|
|
||||||
{{cs_deserialize '_buf' field_name idx.type}}
|
|
||||||
{{~if for.last~}}
|
|
||||||
{{key_value=key_value+field_name+')'}}
|
|
||||||
{{~else~}}
|
|
||||||
{{key_value=key_value+field_name+', '}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
_indexMap.Add({{key_value}}, _buf.ReadInt());
|
|
||||||
}
|
|
||||||
Indexes = _indexMap.Keys.ToList();
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_dataMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}>();
|
|
||||||
_indexMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}},int>();
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
|
|
||||||
int size = _buf.ReadSize();
|
|
||||||
for(int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
{{cs_define_type idx.type}} key_{{idx.index_field.name}};
|
|
||||||
{{cs_deserialize '_buf' 'key_'+idx.index_field.name idx.type}}
|
|
||||||
{{~end~}}
|
|
||||||
int index = _buf.ReadInt();
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_indexMap_{{idx.index_field.name}}.Add(key_{{idx.index_field.name}},index);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
Indexes_{{idx.index_field.name}} = _indexMap_{{idx.index_field.name}}.Keys.ToList();
|
|
||||||
{{~end~}}
|
|
||||||
{{~else~}}
|
|
||||||
_indexMap = new Dictionary<int,int>();
|
|
||||||
_dataMap = new Dictionary<int, {{cs_define_type value_type}}>();
|
|
||||||
int size = _buf.ReadSize();
|
|
||||||
for(int i = 0; i < size; i++)
|
|
||||||
{
|
|
||||||
_indexMap.Add(i,_buf.ReadInt());
|
|
||||||
}
|
|
||||||
Indexes = _indexMap.Keys.ToList();
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_table_get_param_def_list x}})
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} __v;
|
|
||||||
if(_dataMapUnion.TryGetValue(({{cs_table_get_param_name_list x}}), out __v))
|
|
||||||
{
|
|
||||||
return __v;
|
|
||||||
}
|
|
||||||
ResetByteBuf(_indexMap[({{cs_table_get_param_name_list x}})]);
|
|
||||||
|
|
||||||
{{cs_deserialize '_buf' '__v' value_type}}
|
|
||||||
_dataList.Add(__v);
|
|
||||||
_dataMapUnion.Add(({{cs_table_get_param_name_list x}}), __v);
|
|
||||||
__v.Resolve(tables);
|
|
||||||
if(_indexMap.Count == _dataMapUnion.Count)
|
|
||||||
{
|
|
||||||
_buf = null;
|
|
||||||
}
|
|
||||||
return __v;
|
|
||||||
}
|
|
||||||
{{~else if !x.index_list.empty? ~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
public {{cs_define_type value_type}} GetBy{{idx.index_field.convention_name}}({{cs_define_type idx.type}} key)
|
|
||||||
{
|
|
||||||
if(_dataMap_{{idx.index_field.name}}.TryGetValue(key,out var value))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
int index = _indexMap_{{idx.index_field.name}}[key];
|
|
||||||
ResetByteBuf(index);
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataMap_{{idx.index_field.name}}[key] = _v;
|
|
||||||
_v.Resolve(tables);
|
|
||||||
return _v;
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
{{~else if x.index_list.empty? ~}}
|
|
||||||
public {{cs_define_type value_type}} this[int index] => Get(index);
|
|
||||||
public {{cs_define_type value_type}} Get(int index)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
if(_dataMap.TryGetValue(index, out _v))
|
|
||||||
{
|
|
||||||
return _v;
|
|
||||||
}
|
|
||||||
ResetByteBuf(_indexMap[index]);
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataMap[index] = _v;
|
|
||||||
_v.Resolve(tables);
|
|
||||||
if(_indexMap.Count == _dataMap.Count)
|
|
||||||
{
|
|
||||||
_buf = null;
|
|
||||||
}
|
|
||||||
return _v;
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
{{~else~}}
|
|
||||||
|
|
||||||
private {{cs_define_type value_type}} _data;
|
|
||||||
|
|
||||||
public {{name}} (ByteBuf _buf, string _tbName, System.Func<string, ByteBuf> _loader)
|
|
||||||
{
|
|
||||||
Instance = this;
|
|
||||||
ByteBuf _dataBuf = _loader(_tbName);
|
|
||||||
int n = _buf.ReadSize();
|
|
||||||
int m = _dataBuf.ReadSize();
|
|
||||||
if (n != 1 || m != 1) throw new SerializationException("table mode=one, but size != 1");
|
|
||||||
{{cs_deserialize '_dataBuf' '_data' value_type}}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} => _data.{{field.convention_name}};
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
public {{cs_define_type field.ref_type}} {{field.convention_name}}_Ref => _data.{{field.convention_name}}_Ref;
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~if x.is_map_table||x.is_list_table ~}}
|
|
||||||
private void ResetByteBuf(int readerInex = 0)
|
|
||||||
{
|
|
||||||
if( _buf == null)
|
|
||||||
{
|
|
||||||
if (_buf == null)
|
|
||||||
{
|
|
||||||
_buf = _dataLoader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_buf.ReaderIndex = readerInex;
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~if x.mode != 'ONE'~}}
|
|
||||||
private ByteBuf _buf = null;
|
|
||||||
private Dictionary<string, object> tables;
|
|
||||||
{{~end~}}
|
|
||||||
public void CacheTables(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
{{~if x.mode == 'ONE'~}}
|
|
||||||
_data.Resolve(_tables);
|
|
||||||
{{~else~}}
|
|
||||||
tables = _tables;
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
partial void PostInit();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
namespace = x.namespace
|
|
||||||
tables = x.tables
|
|
||||||
|
|
||||||
}}
|
|
||||||
namespace {{namespace}}
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class {{name}}
|
|
||||||
{
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{~if table.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{table.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{table.full_name}} {{table.name}} {get; }
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{name}}(System.Func<string, ByteBuf> idxLoader,System.Func<string, ByteBuf> dataLoader)
|
|
||||||
{
|
|
||||||
var tables = new System.Collections.Generic.Dictionary<string, object>();
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}} = new {{table.full_name}}(idxLoader("{{table.output_data_file}}"),"{{table.output_data_file}}",dataLoader);
|
|
||||||
tables.Add("{{table.full_name}}", {{table.name}});
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
PostInit();
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}}.CacheTables(tables);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,95 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using Bright.Serialization;
|
|
||||||
using Cysharp.Threading.Tasks;
|
|
||||||
using GameBase;
|
|
||||||
using GameConfig;
|
|
||||||
using TEngine;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 配置加载器
|
|
||||||
/// </summary>
|
|
||||||
public class ConfigSystem : Singleton<ConfigSystem>
|
|
||||||
{
|
|
||||||
private bool _init = false;
|
|
||||||
|
|
||||||
private Tables _tables;
|
|
||||||
|
|
||||||
public Tables Tables
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!_init)
|
|
||||||
{
|
|
||||||
#if !UNITY_WEBGL
|
|
||||||
_init = true;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Log.Error("Config not loaded. You need Take LoadAsync at first.");
|
|
||||||
}
|
|
||||||
return _tables;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Dictionary<string, TextAsset> _configs = new Dictionary<string, TextAsset>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 异步加载配置。
|
|
||||||
/// </summary>
|
|
||||||
public async UniTask LoadAsync()
|
|
||||||
{
|
|
||||||
_tables = new Tables();
|
|
||||||
await _tables.LoadAsync(LoadByteBufAsync);
|
|
||||||
_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 异步加载二进制配置。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="file">FileName</param>
|
|
||||||
/// <returns>ByteBuf</returns>
|
|
||||||
private async UniTask<ByteBuf> LoadByteBufAsync(string file)
|
|
||||||
{
|
|
||||||
#if false
|
|
||||||
GameTickWatcher gameTickWatcher = new GameTickWatcher();
|
|
||||||
#endif
|
|
||||||
byte[] ret;
|
|
||||||
var location = file;
|
|
||||||
if (_configs.TryGetValue(location, out var config))
|
|
||||||
{
|
|
||||||
ret = config.bytes;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var textAssets = await GameModule.Resource.LoadAssetAsync<TextAsset>(location, CancellationToken.None);
|
|
||||||
ret = textAssets.bytes;
|
|
||||||
RegisterTextAssets(file, textAssets);
|
|
||||||
}
|
|
||||||
#if false
|
|
||||||
Log.Warning($"LoadByteBuf {file} used time {gameTickWatcher.ElapseTime()}");
|
|
||||||
#endif
|
|
||||||
return new ByteBuf(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 注册配置资源。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">资源Key。</param>
|
|
||||||
/// <param name="value">资源实例。</param>
|
|
||||||
/// <returns>注册成功。</returns>
|
|
||||||
private bool RegisterTextAssets(string key, TextAsset value)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_configs[key] = value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,115 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
parent_def_type = x.parent_def_type
|
|
||||||
export_fields = x.export_fields
|
|
||||||
hierarchy_export_fields = x.hierarchy_export_fields
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{cs_start_name_space_grace x.namespace_with_top_module}}
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
|
|
||||||
{
|
|
||||||
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
|
|
||||||
{
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{cs_deserialize '_buf' field.convention_name field.ctype}}
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
foreach(var _v in {{field.convention_name}})
|
|
||||||
{
|
|
||||||
{{field.convention_name}}_Index.Add(_v.{{field.index_field.convention_name}}, _v);
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static {{name}} Deserialize{{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
{{~if x.is_abstract_type~}}
|
|
||||||
switch (_buf.ReadInt())
|
|
||||||
{
|
|
||||||
{{~for child in x.hierarchy_not_abstract_children~}}
|
|
||||||
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
default: throw new SerializationException();
|
|
||||||
}
|
|
||||||
{{~else~}}
|
|
||||||
return new {{x.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} { get; private set; }
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.convention_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
public {{field.cs_ref_validator_define}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~if (gen_datetime_mills field.ctype) ~}}
|
|
||||||
public long {{field.convention_name}}_Millis => {{field.convention_name}} * 1000L;
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_text_key~}}
|
|
||||||
public {{cs_define_text_key_field field}} { get; }
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~if !x.is_abstract_type~}}
|
|
||||||
public const int __ID__ = {{x.id}};
|
|
||||||
public override int GetTypeId() => __ID__;
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{x.cs_method_modifier}} void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
{{~if parent_def_type~}}
|
|
||||||
base.Resolve(_tables);
|
|
||||||
{{~end~}}
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
{{cs_ref_validator_resolve field}}
|
|
||||||
{{~else if field.has_recursive_ref~}}
|
|
||||||
{{cs_recursive_resolve field '_tables'}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public {{x.cs_method_modifier}} void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
{{~if parent_def_type~}}
|
|
||||||
base.TranslateText(translator);
|
|
||||||
{{~end~}}
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.gen_text_key~}}
|
|
||||||
{{cs_translate_text field 'translator'}}
|
|
||||||
{{~else if field.has_recursive_text~}}
|
|
||||||
{{cs_recursive_translate_text field 'translator'}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return "{{full_name}}{ "
|
|
||||||
{{~for field in hierarchy_export_fields ~}}
|
|
||||||
+ "{{field.convention_name}}:" + {{cs_to_string field.convention_name field.ctype}} + ","
|
|
||||||
{{~end~}}
|
|
||||||
+ "}";
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
partial void PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{cs_end_name_space_grace x.namespace_with_top_module}}
|
|
@@ -1,173 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
|
||||||
{{cs_start_name_space_grace x.namespace_with_top_module}}
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
key_type = x.key_ttype
|
|
||||||
key_type1 = x.key_ttype1
|
|
||||||
key_type2 = x.key_ttype2
|
|
||||||
value_type = x.value_ttype
|
|
||||||
}}
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public partial class {{name}}
|
|
||||||
{
|
|
||||||
{{~if x.is_map_table ~}}
|
|
||||||
private readonly Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> _dataMap;
|
|
||||||
private readonly List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
_dataMap = new Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}>();
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
|
|
||||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataList.Add(_v);
|
|
||||||
_dataMap.Add(_v.{{x.index_field.convention_name}}, _v);
|
|
||||||
}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> DataMap => _dataMap;
|
|
||||||
public List<{{cs_define_type value_type}}> DataList => _dataList;
|
|
||||||
|
|
||||||
{{~if value_type.is_dynamic~}}
|
|
||||||
public T GetOrDefaultAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
|
|
||||||
public T GetAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => (T)_dataMap[key];
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type value_type}} GetOrDefault({{cs_define_type key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_define_type key_type}} key) => _dataMap[key];
|
|
||||||
public {{cs_define_type value_type}} this[{{cs_define_type key_type}} key] => _dataMap[key];
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.Resolve(_tables);
|
|
||||||
}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.TranslateText(translator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~else if x.is_list_table ~}}
|
|
||||||
private readonly List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
private {{cs_table_union_map_type_name x}} _dataMapUnion;
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
private Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> _dataMap_{{idx.index_field.name}};
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
|
|
||||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataList.Add(_v);
|
|
||||||
}
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
_dataMapUnion = new {{cs_table_union_map_type_name x}}();
|
|
||||||
foreach(var _v in _dataList)
|
|
||||||
{
|
|
||||||
_dataMapUnion.Add(({{cs_table_key_list x "_v"}}), _v);
|
|
||||||
}
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_dataMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}>();
|
|
||||||
{{~end~}}
|
|
||||||
foreach(var _v in _dataList)
|
|
||||||
{
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_dataMap_{{idx.index_field.name}}.Add(_v.{{idx.index_field.convention_name}}, _v);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<{{cs_define_type value_type}}> DataList => _dataList;
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_table_get_param_def_list x}}) => _dataMapUnion.TryGetValue(({{cs_table_get_param_name_list x}}), out {{cs_define_type value_type}} __v) ? __v : null;
|
|
||||||
{{~else if !x.index_list.empty? ~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
public {{cs_define_type value_type}} GetBy{{idx.index_field.convention_name}}({{cs_define_type idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{cs_define_type value_type}} __v) ? __v : null;
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.Resolve(_tables);
|
|
||||||
}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.TranslateText(translator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~else~}}
|
|
||||||
|
|
||||||
private readonly {{cs_define_type value_type}} _data;
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
int n = _buf.ReadSize();
|
|
||||||
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
|
|
||||||
{{cs_deserialize '_buf' '_data' value_type}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} => _data.{{field.convention_name}};
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
_data.Resolve(_tables);
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
_data.TranslateText(translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
partial void PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{cs_end_name_space_grace x.namespace_with_top_module}}
|
|
@@ -1,53 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using Cysharp.Threading.Tasks;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
namespace = x.namespace
|
|
||||||
tables = x.tables
|
|
||||||
}}
|
|
||||||
namespace {{namespace}}
|
|
||||||
{
|
|
||||||
|
|
||||||
public sealed class {{name}}
|
|
||||||
{
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{~if table.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{table.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{table.full_name}} {{table.name}} {get; private set; }
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{name}}() { }
|
|
||||||
|
|
||||||
public async UniTask LoadAsync(System.Func<string, UniTask<ByteBuf>> loader)
|
|
||||||
{
|
|
||||||
var tables = new System.Collections.Generic.Dictionary<string, object>();
|
|
||||||
List<UniTask> list = new List<UniTask>();
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
list.Add(UniTask.Create(async () =>
|
|
||||||
{
|
|
||||||
{{table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
|
|
||||||
tables.Add("{{table.full_name}}", {{table.name}});
|
|
||||||
}));
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
await UniTask.WhenAll(list);
|
|
||||||
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}}.Resolve(tables);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}}.TranslateText(translator);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,115 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
parent_def_type = x.parent_def_type
|
|
||||||
export_fields = x.export_fields
|
|
||||||
hierarchy_export_fields = x.hierarchy_export_fields
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{cs_start_name_space_grace x.namespace_with_top_module}}
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
|
|
||||||
{
|
|
||||||
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
|
|
||||||
{
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{cs_deserialize '_buf' field.convention_name field.ctype}}
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
foreach(var _v in {{field.convention_name}})
|
|
||||||
{
|
|
||||||
{{field.convention_name}}_Index.Add(_v.{{field.index_field.convention_name}}, _v);
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static {{name}} Deserialize{{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
{{~if x.is_abstract_type~}}
|
|
||||||
switch (_buf.ReadInt())
|
|
||||||
{
|
|
||||||
{{~for child in x.hierarchy_not_abstract_children~}}
|
|
||||||
case {{child.full_name}}.__ID__: return new {{child.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
default: throw new SerializationException();
|
|
||||||
}
|
|
||||||
{{~else~}}
|
|
||||||
return new {{x.full_name}}(_buf);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} { get; private set; }
|
|
||||||
{{~if field.index_field~}}
|
|
||||||
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.convention_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
public {{field.cs_ref_validator_define}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~if (gen_datetime_mills field.ctype) ~}}
|
|
||||||
public long {{field.convention_name}}_Millis => {{field.convention_name}} * 1000L;
|
|
||||||
{{~end~}}
|
|
||||||
{{~if field.gen_text_key~}}
|
|
||||||
public {{cs_define_text_key_field field}} { get; }
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~if !x.is_abstract_type~}}
|
|
||||||
public const int __ID__ = {{x.id}};
|
|
||||||
public override int GetTypeId() => __ID__;
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{x.cs_method_modifier}} void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
{{~if parent_def_type~}}
|
|
||||||
base.Resolve(_tables);
|
|
||||||
{{~end~}}
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.gen_ref~}}
|
|
||||||
{{cs_ref_validator_resolve field}}
|
|
||||||
{{~else if field.has_recursive_ref~}}
|
|
||||||
{{cs_recursive_resolve field '_tables'}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public {{x.cs_method_modifier}} void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
{{~if parent_def_type~}}
|
|
||||||
base.TranslateText(translator);
|
|
||||||
{{~end~}}
|
|
||||||
{{~ for field in export_fields ~}}
|
|
||||||
{{~if field.gen_text_key~}}
|
|
||||||
{{cs_translate_text field 'translator'}}
|
|
||||||
{{~else if field.has_recursive_text~}}
|
|
||||||
{{cs_recursive_translate_text field 'translator'}}
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return "{{full_name}}{ "
|
|
||||||
{{~for field in hierarchy_export_fields ~}}
|
|
||||||
+ "{{field.convention_name}}:" + {{cs_to_string field.convention_name field.ctype}} + ","
|
|
||||||
{{~end~}}
|
|
||||||
+ "}";
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
partial void PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{cs_end_name_space_grace x.namespace_with_top_module}}
|
|
@@ -1,173 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
|
||||||
{{cs_start_name_space_grace x.namespace_with_top_module}}
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
key_type = x.key_ttype
|
|
||||||
key_type1 = x.key_ttype1
|
|
||||||
key_type2 = x.key_ttype2
|
|
||||||
value_type = x.value_ttype
|
|
||||||
}}
|
|
||||||
{{~if x.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{x.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public partial class {{name}}
|
|
||||||
{
|
|
||||||
{{~if x.is_map_table ~}}
|
|
||||||
private readonly Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> _dataMap;
|
|
||||||
private readonly List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
_dataMap = new Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}>();
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
|
|
||||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataList.Add(_v);
|
|
||||||
_dataMap.Add(_v.{{x.index_field.convention_name}}, _v);
|
|
||||||
}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<{{cs_define_type key_type}}, {{cs_define_type value_type}}> DataMap => _dataMap;
|
|
||||||
public List<{{cs_define_type value_type}}> DataList => _dataList;
|
|
||||||
|
|
||||||
{{~if value_type.is_dynamic~}}
|
|
||||||
public T GetOrDefaultAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => _dataMap.TryGetValue(key, out var v) ? (T)v : null;
|
|
||||||
public T GetAs<T>({{cs_define_type key_type}} key) where T : {{cs_define_type value_type}} => (T)_dataMap[key];
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type value_type}} GetOrDefault({{cs_define_type key_type}} key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_define_type key_type}} key) => _dataMap[key];
|
|
||||||
public {{cs_define_type value_type}} this[{{cs_define_type key_type}} key] => _dataMap[key];
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.Resolve(_tables);
|
|
||||||
}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.TranslateText(translator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~else if x.is_list_table ~}}
|
|
||||||
private readonly List<{{cs_define_type value_type}}> _dataList;
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
private {{cs_table_union_map_type_name x}} _dataMapUnion;
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
private Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}> _dataMap_{{idx.index_field.name}};
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
_dataList = new List<{{cs_define_type value_type}}>();
|
|
||||||
|
|
||||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
|
||||||
{
|
|
||||||
{{cs_define_type value_type}} _v;
|
|
||||||
{{cs_deserialize '_buf' '_v' value_type}}
|
|
||||||
_dataList.Add(_v);
|
|
||||||
}
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
_dataMapUnion = new {{cs_table_union_map_type_name x}}();
|
|
||||||
foreach(var _v in _dataList)
|
|
||||||
{
|
|
||||||
_dataMapUnion.Add(({{cs_table_key_list x "_v"}}), _v);
|
|
||||||
}
|
|
||||||
{{~else if !x.index_list.empty?~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_dataMap_{{idx.index_field.name}} = new Dictionary<{{cs_define_type idx.type}}, {{cs_define_type value_type}}>();
|
|
||||||
{{~end~}}
|
|
||||||
foreach(var _v in _dataList)
|
|
||||||
{
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
_dataMap_{{idx.index_field.name}}.Add(_v.{{idx.index_field.convention_name}}, _v);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
{{~end~}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<{{cs_define_type value_type}}> DataList => _dataList;
|
|
||||||
|
|
||||||
{{~if x.is_union_index~}}
|
|
||||||
public {{cs_define_type value_type}} Get({{cs_table_get_param_def_list x}}) => _dataMapUnion.TryGetValue(({{cs_table_get_param_name_list x}}), out {{cs_define_type value_type}} __v) ? __v : null;
|
|
||||||
{{~else if !x.index_list.empty? ~}}
|
|
||||||
{{~for idx in x.index_list~}}
|
|
||||||
public {{cs_define_type value_type}} GetBy{{idx.index_field.convention_name}}({{cs_define_type idx.type}} key) => _dataMap_{{idx.index_field.name}}.TryGetValue(key, out {{cs_define_type value_type}} __v) ? __v : null;
|
|
||||||
{{~end~}}
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.Resolve(_tables);
|
|
||||||
}
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
foreach(var v in _dataList)
|
|
||||||
{
|
|
||||||
v.TranslateText(translator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{~else~}}
|
|
||||||
|
|
||||||
private readonly {{cs_define_type value_type}} _data;
|
|
||||||
|
|
||||||
public {{name}}(ByteBuf _buf)
|
|
||||||
{
|
|
||||||
int n = _buf.ReadSize();
|
|
||||||
if (n != 1) throw new SerializationException("table mode=one, but size != 1");
|
|
||||||
{{cs_deserialize '_buf' '_data' value_type}}
|
|
||||||
PostInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
|
|
||||||
{{~if field.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{field.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{cs_define_type field.ctype}} {{field.convention_name}} => _data.{{field.convention_name}};
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public void Resolve(Dictionary<string, object> _tables)
|
|
||||||
{
|
|
||||||
_data.Resolve(_tables);
|
|
||||||
PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
_data.TranslateText(translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
partial void PostInit();
|
|
||||||
partial void PostResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
{{cs_end_name_space_grace x.namespace_with_top_module}}
|
|
@@ -1,46 +0,0 @@
|
|||||||
using Bright.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
{{
|
|
||||||
name = x.name
|
|
||||||
namespace = x.namespace
|
|
||||||
tables = x.tables
|
|
||||||
}}
|
|
||||||
namespace {{namespace}}
|
|
||||||
{
|
|
||||||
|
|
||||||
public sealed class {{name}}
|
|
||||||
{
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{~if table.comment != '' ~}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{table.escape_comment}}
|
|
||||||
/// </summary>
|
|
||||||
{{~end~}}
|
|
||||||
public {{table.full_name}} {{table.name}} {get; private set; }
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
public {{name}}() { }
|
|
||||||
|
|
||||||
public async Task LoadAsync(System.Func<string, Task<ByteBuf>> loader)
|
|
||||||
{
|
|
||||||
var tables = new System.Collections.Generic.Dictionary<string, object>();
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}} = new {{table.full_name}}(await loader("{{table.output_data_file}}"));
|
|
||||||
tables.Add("{{table.full_name}}", {{table.name}});
|
|
||||||
{{~end~}}
|
|
||||||
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}}.Resolve(tables);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TranslateText(System.Func<string, string, string> translator)
|
|
||||||
{
|
|
||||||
{{~for table in tables ~}}
|
|
||||||
{{table.name}}.TranslateText(translator);
|
|
||||||
{{~end~}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
<module name="Battle">
|
|
||||||
<enum name="ActorAttrDataType">
|
|
||||||
<var name="None" alias="无效数据" value="0"/>
|
|
||||||
<var name="MaxHp" alias="最大血量" value="1"/>
|
|
||||||
<var name="Attack" alias="攻击力" value="2"/>
|
|
||||||
<var name="PhyDamage" alias="物理伤害" value="3"/>
|
|
||||||
<var name="PhyDef" alias="物理防御" value="4"/>
|
|
||||||
<var name="MagicDamage" alias="法术伤害" value="5"/>
|
|
||||||
<var name="MagicDef" alias="法术防御" value="6"/>
|
|
||||||
<var name="MoveSpeed" alias="移动速度" value="7"/>
|
|
||||||
<var name="AttackSpeed" alias="攻击速度" value="8"/>
|
|
||||||
<var name="Hit" alias="命中率" value="9"/>
|
|
||||||
<var name="Dodge" alias="闪避率" value="10"/>
|
|
||||||
<var name="CriticalAtkRatio" alias="暴击率" value="11"/>
|
|
||||||
<var name="SanValue" alias="San值(疯狂值)" value="12"/>
|
|
||||||
<var name="MaxMp" alias="最大MP" value="13"/>
|
|
||||||
|
|
||||||
<var name="PhyDamageRatio" alias="物理伤害倍率" value="14"/>
|
|
||||||
<var name="MagicDamageRatio" alias="魔法伤害倍率" value="15"/>
|
|
||||||
<var name="CriticalRatio" alias="暴击倍率" value="16"/>
|
|
||||||
<var name="CriticalReduce" alias="暴击减免" value="17"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<enum name="ActorAttrAddType">
|
|
||||||
<var name="NONE" alias="无效数据" value="0"/>
|
|
||||||
<var name="ABSOLUTE_VAL" alias="加法计算" value="1"/>
|
|
||||||
<var name="SUM_PERCENT_VAL" alias="多个项结果累加,然后对加法做乘法" value="2"/>
|
|
||||||
<var name="MUL_PERCENT_VAL" alias="每一项都是对最终结果做乘法" value="3"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<bean name="ResAttrImpactData" sep="," parent="">
|
|
||||||
<var name="DataType" type="ActorAttrDataType"/>
|
|
||||||
<var name="AddType" type="ActorAttrAddType"/>
|
|
||||||
<var name="Value" type="float"/>
|
|
||||||
</bean>
|
|
||||||
</module>
|
|
@@ -1,68 +0,0 @@
|
|||||||
<module name="Battle">
|
|
||||||
<enum name="BuffTimeType">
|
|
||||||
<var name="BUFF_TIME_DURING" alias="指定持续时间" value="0"/>
|
|
||||||
<var name="BUFF_TIME_INFINIT" alias="无尽时间" value="1"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<enum name="BuffReplaceType">
|
|
||||||
<var name="BUFF_REPLACE_INSTEAD" alias="更新时间范围" value="0"/>
|
|
||||||
<var name="BUFF_REPLACE_FORBIT" alias="不允许叠加" value="1"/>
|
|
||||||
<var name="BUFF_REPLACE_ADD_TIME" alias="累加时间范围" value="2"/>
|
|
||||||
<var name="BUFF_REPLACE_ADD_ATTR" alias="叠加数值" value="3"/>
|
|
||||||
<var name="BUFF_REPLACE_TYPE_COUNT" alias="叠加种类" value="4"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<enum name="BuffStateID">
|
|
||||||
<var name="BUFF_STATE_NONE" alias="无状态" value="0"/>
|
|
||||||
<var name="BUFF_STATE_STUN" alias="眩晕状态" value="1"/>
|
|
||||||
<var name="BUFF_STATE_UNDEAD" alias="无敌状态" value="2"/>
|
|
||||||
<var name="BUFF_STATE_INVISIBLE" alias="隐身状态" value="3"/>
|
|
||||||
<var name="BUFF_STATE_BIGGER" alias="体形变大" value="4"/>
|
|
||||||
<var name="BUFF_STATE_NO_MOVE" alias="定身,不能移动" value="5"/>
|
|
||||||
<var name="BUFF_STATE_NO_SKILL" alias="沉默,不能放技能" value="6"/>
|
|
||||||
<var name="BUFF_STATE_SLEEP" alias="昏睡" value="7"/>
|
|
||||||
<var name="BUFF_STATE_FORCE_COLLIDER" alias="强制开启阻挡" value="8"/>
|
|
||||||
<var name="BUFF_STATE_IGNORE_COLLIDER" alias="无视阻挡" value="9"/>
|
|
||||||
<var name="BUFF_STATE_MAX" alias="最大状态" value="10"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<enum name="BuffResultType">
|
|
||||||
<var name="BUFF_RESULT_NONE" alias="无" value="0"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_ATK_UP" alias="物理攻击提升" value="1"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_ATK_DOWN" alias="物理攻击降低" value="2"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_DEF_UP" alias="物理防御提升" value="3"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_DEF_DOWN" alias="物理防御降低" value="4"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_HIT_UP" alias="物理命中提升" value="5"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_HIT_DOWN" alias="物理命中降低" value="6"/>
|
|
||||||
<var name="BUFF_RESULT_PHY_LOSE_HP" alias="物理持续掉血" value="7"/>
|
|
||||||
|
|
||||||
<var name="BUFF_RESULT_MAG_ATK_UP" alias="法术攻击提升" value="8"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_ATK_DOWN" alias="法术攻击降低" value="9"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_DEF_UP" alias="法术防御提升" value="10"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_DEF_DOWN" alias="法术防御降低" value="11"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_HIT_UP" alias="法术命中提升" value="12"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_HIT_DOWN" alias="法术命中降低" value="13"/>
|
|
||||||
<var name="BUFF_RESULT_MAG_LOSE_HP" alias="法术持续掉血" value="14"/>
|
|
||||||
|
|
||||||
<var name="BUFF_RESULT_CIRT_UP" alias="暴击率提升" value="15"/>
|
|
||||||
<var name="BUFF_RESULT_CIRT_DOWN" alias="暴击率降低" value="16"/>
|
|
||||||
<var name="BUFF_RESULT_CIRT_VALUE_UP" alias="暴击倍率提升" value="17"/>
|
|
||||||
<var name="BUFF_RESULT_CIRT_VALUE_DOWN" alias="暴击倍率降低" value="18"/>
|
|
||||||
|
|
||||||
<var name="BUFF_RESULT_MOVE_SPEED_UP" alias="移速提升" value="19"/>
|
|
||||||
<var name="BUFF_RESULT_MOVE_SPEED_DOWN" alias="移速降低" value="20"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<bean name="BuffTriggleState" sep="," parent="">
|
|
||||||
<var name="StateID" type="BuffStateID"/>
|
|
||||||
<var name="StateParam" type="float"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean name="BuffDotTickConfig" sep="," parent="">
|
|
||||||
<!-- 触发间隔,如果为0, 则只加一次 -->
|
|
||||||
<var name="TickTime" type="float"/>
|
|
||||||
<!-- 1增加buff的时候立刻触发,否则等待TickTime后再触发 -->
|
|
||||||
<var name="TickWhenAdd" type="int"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</module>
|
|
@@ -1,25 +0,0 @@
|
|||||||
<module name="Battle">
|
|
||||||
<enum name="SkillMagicType"> 技能元素类型
|
|
||||||
<var name="SKILL_TYPE_NONE" alias="无类型" value="0"/>
|
|
||||||
<var name="SKILL_TYPE_DMG_PHY" alias="物理伤害属性" value="1"/>
|
|
||||||
<var name="SKILL_TYPE_DMG_MAGIC" alias="魔法伤害属性" value="2"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<enum name="SkillAttrDamageType"> 伤害类型
|
|
||||||
<var name="ATTR_TYPE_NONE" alias="无数值" value="0"/>
|
|
||||||
<var name="ATTR_TYPE_DMG_WEAPON" alias="按释放者的伤害类型*X%+固定值计算,目标有防御计算" value="1"/>
|
|
||||||
<var name="ATTR_TYPE_DMG_NO_DEFEND" alias="按释放者的伤害类型*X%+固定值计算(无视目标的防御)" value="2"/>
|
|
||||||
<var name="ATTR_TYPE_DMG_TARGET_HP_NO_DEFEND" alias="按受击者的气血上限*X%+固定值计算(无视目标的防御)" value="3"/>
|
|
||||||
<var name="ATTR_TYPE_HP_AS_ATK" alias="按释放者的攻击类型*X%+固定值计算,恢复当前生命" value="4"/>
|
|
||||||
<var name="ATTR_TYPE_HP_RATIO" alias="按受击者的HP上限*X%+固定值计算,恢复当前生命" value="5"/>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<bean name="SkillAttrDamageData" sep="," parent="">
|
|
||||||
<var name="MagicType" type="SkillMagicType"/>
|
|
||||||
<var name="AttrType" type="SkillAttrDamageType"/>
|
|
||||||
<var name="Param1" type="float"/>
|
|
||||||
<var name="Param2" type="float"/>
|
|
||||||
<var name="Param3" type="float"/>
|
|
||||||
<var name="MaxLimit" type="float"/>
|
|
||||||
</bean>
|
|
||||||
</module>
|
|
@@ -1,23 +0,0 @@
|
|||||||
<root>
|
|
||||||
|
|
||||||
<topmodule name="GameConfig"/>
|
|
||||||
|
|
||||||
<externalselector name="unity"/>
|
|
||||||
|
|
||||||
<patch name="cn"/>
|
|
||||||
<patch name="en"/>
|
|
||||||
|
|
||||||
<group name="c,client" default="1"/> client
|
|
||||||
<group name="s,server" default="1"/> server
|
|
||||||
<group name="e" default="1"/> editor
|
|
||||||
|
|
||||||
<import name="."/>
|
|
||||||
|
|
||||||
<importexcel name="__tables__.xlsx" type="table"/> 相对data目录
|
|
||||||
<importexcel name="__enums__.xlsx" type="enum"/>相对data目录
|
|
||||||
<importexcel name="__beans__.xlsx" type="bean"/>相对data目录
|
|
||||||
|
|
||||||
<service name="server" manager="Tables" group="s"/>
|
|
||||||
<service name="client" manager="Tables" group="c"/>
|
|
||||||
<service name="all" manager="Tables" group="c,s,e"/>
|
|
||||||
</root>
|
|
58
Configs/GameConfig/CustomTemplate/ConfigSystem.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using Luban;
|
||||||
|
using GameConfig;
|
||||||
|
using TEngine;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置加载器。
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigSystem
|
||||||
|
{
|
||||||
|
private static ConfigSystem _instance;
|
||||||
|
|
||||||
|
public static ConfigSystem Instance => _instance ??= new ConfigSystem();
|
||||||
|
|
||||||
|
private bool _init = false;
|
||||||
|
|
||||||
|
private Tables _tables;
|
||||||
|
|
||||||
|
public Tables Tables
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!_init)
|
||||||
|
{
|
||||||
|
Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _tables;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IResourceModule _resourceModule;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载配置。
|
||||||
|
/// </summary>
|
||||||
|
public void Load()
|
||||||
|
{
|
||||||
|
_tables = new Tables(LoadByteBuf);
|
||||||
|
_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载二进制配置。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="file">FileName</param>
|
||||||
|
/// <returns>ByteBuf</returns>
|
||||||
|
private ByteBuf LoadByteBuf(string file)
|
||||||
|
{
|
||||||
|
if (_resourceModule == null)
|
||||||
|
{
|
||||||
|
_resourceModule = ModuleSystem.GetModule<IResourceModule>();
|
||||||
|
}
|
||||||
|
TextAsset textAsset = _resourceModule.LoadAsset<TextAsset>(file);
|
||||||
|
byte[] bytes = textAsset.bytes;
|
||||||
|
return new ByteBuf(bytes);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,55 @@
|
|||||||
|
using Luban;
|
||||||
|
|
||||||
|
{{namespace_with_grace_begin __namespace}}
|
||||||
|
public partial class {{__name}}
|
||||||
|
{
|
||||||
|
#region The Tables
|
||||||
|
|
||||||
|
{{~for table in __tables ~}}
|
||||||
|
{{~if table.comment != '' ~}}
|
||||||
|
/// <summary>
|
||||||
|
/// {{escape_comment table.comment}}
|
||||||
|
/// </summary>
|
||||||
|
{{~end~}}
|
||||||
|
private {{table.full_name}} m_{{table.name}};
|
||||||
|
public {{table.full_name}} {{format_property_name __code_style table.name}}
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_{{table.name}} == null)
|
||||||
|
{
|
||||||
|
m_{{table.name}} = new {{table.full_name}}(defaultLoader("{{table.output_data_file}}"));
|
||||||
|
m_{{table.name}}.ResolveRef(this);
|
||||||
|
}
|
||||||
|
return m_{{table.name}};
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
m_{{table.name}} = value;
|
||||||
|
m_{{table.name}}.ResolveRef(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{~end~}}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
System.Func<string, ByteBuf> defaultLoader;
|
||||||
|
|
||||||
|
public {{__name}}(System.Func<string, ByteBuf> loader)
|
||||||
|
{
|
||||||
|
SetDefaultLoader(loader);
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDefaultLoader(System.Func<string, ByteBuf> loader)
|
||||||
|
{
|
||||||
|
defaultLoader = null;
|
||||||
|
defaultLoader = loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public partial void Init();
|
||||||
|
|
||||||
|
public void Init(){}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{namespace_with_grace_end __namespace}}
|
29
Configs/GameConfig/CustomTemplate/ExternalTypeUtil.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public static class ExternalTypeUtil
|
||||||
|
{
|
||||||
|
public static Vector2 NewVector2(GameConfig.vector2 v)
|
||||||
|
{
|
||||||
|
return new Vector2(v.X, v.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 NewVector3(GameConfig.vector3 v)
|
||||||
|
{
|
||||||
|
return new Vector3(v.X, v.Y, v.Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector4 NewVector4(GameConfig.vector4 v)
|
||||||
|
{
|
||||||
|
return new Vector4(v.X, v.Y, v.Z, v.W);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2Int NewVector2Int(GameConfig.vector2int v)
|
||||||
|
{
|
||||||
|
return new Vector2Int(v.X, v.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3Int NewVector3Int(GameConfig.vector3int v)
|
||||||
|
{
|
||||||
|
return new Vector3Int(v.X, v.Y, v.Z);
|
||||||
|
}
|
||||||
|
}
|
BIN
Configs/GameConfig/Datas/__beans__.xlsx
Normal file
BIN
Configs/GameConfig/Datas/__enums__.xlsx
Normal file
BIN
Configs/GameConfig/Datas/__tables__.xlsx
Normal file
BIN
Configs/GameConfig/Datas/item.xlsx
Normal file
46
Configs/GameConfig/Defines/builtin.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<module name="">
|
||||||
|
<bean name="vector2" valueType="1" sep=",">
|
||||||
|
<var name="x" type="float" />
|
||||||
|
<var name="y" type="float" />
|
||||||
|
<mapper target="client" codeTarget="cs-bin,cs-simple-json,cs-newtonsoft-json">
|
||||||
|
<option name="type" value="UnityEngine.Vector2" />
|
||||||
|
<option name="constructor" value="ExternalTypeUtil.NewVector2" />
|
||||||
|
</mapper>
|
||||||
|
</bean>
|
||||||
|
<bean name="vector3" valueType="1" sep=",">
|
||||||
|
<var name="x" type="float" />
|
||||||
|
<var name="y" type="float" />
|
||||||
|
<var name="z" type="float" />
|
||||||
|
<mapper target="client" codeTarget="cs-bin,cs-simple-json,cs-newtonsoft-json">
|
||||||
|
<option name="type" value="UnityEngine.Vector3" />
|
||||||
|
<option name="constructor" value="ExternalTypeUtil.NewVector3" />
|
||||||
|
</mapper>
|
||||||
|
</bean>
|
||||||
|
<bean name="vector4" valueType="1" sep=",">
|
||||||
|
<var name="x" type="float" />
|
||||||
|
<var name="y" type="float" />
|
||||||
|
<var name="z" type="float" />
|
||||||
|
<var name="w" type="float" />
|
||||||
|
<mapper target="client" codeTarget="cs-bin,cs-simple-json,cs-newtonsoft-json">
|
||||||
|
<option name="type" value="UnityEngine.Vector4" />
|
||||||
|
<option name="constructor" value="ExternalTypeUtil.NewVector4" />
|
||||||
|
</mapper>
|
||||||
|
</bean>
|
||||||
|
<bean name="vector2int" valueType="1" sep=",">
|
||||||
|
<var name="x" type="int" />
|
||||||
|
<var name="y" type="int" />
|
||||||
|
<mapper target="client" codeTarget="cs-bin,cs-simple-json,cs-newtonsoft-json">
|
||||||
|
<option name="type" value="UnityEngine.Vector2Int" />
|
||||||
|
<option name="constructor" value="ExternalTypeUtil.NewVector2Int" />
|
||||||
|
</mapper>
|
||||||
|
</bean>
|
||||||
|
<bean name="vector3int" valueType="1" sep=",">
|
||||||
|
<var name="x" type="int" />
|
||||||
|
<var name="y" type="int" />
|
||||||
|
<var name="z" type="int" />
|
||||||
|
<mapper target="client" codeTarget="cs-bin,cs-simple-json,cs-newtonsoft-json">
|
||||||
|
<option name="type" value="UnityEngine.Vector3" />
|
||||||
|
<option name="constructor" value="ExternalTypeUtil.NewVector3" />
|
||||||
|
</mapper>
|
||||||
|
</bean>
|
||||||
|
</module>
|
22
Configs/GameConfig/gen_code_bin_to_project.bat
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Cd /d %~dp0
|
||||||
|
echo %CD%
|
||||||
|
|
||||||
|
set WORKSPACE=../..
|
||||||
|
set LUBAN_DLL=%WORKSPACE%\Tools\Luban\Luban.dll
|
||||||
|
set CONF_ROOT=.
|
||||||
|
set DATA_OUTPATH=%WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/
|
||||||
|
set CODE_OUTPATH=%WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig/
|
||||||
|
|
||||||
|
xcopy /s /e /i /y "%CONF_ROOT%\CustomTemplate\ConfigSystem.cs" "%WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs"
|
||||||
|
xcopy /s /e /i /y "%CONF_ROOT%\CustomTemplate\ExternalTypeUtil.cs" "%WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ExternalTypeUtil.cs"
|
||||||
|
|
||||||
|
dotnet %LUBAN_DLL% ^
|
||||||
|
-t client ^
|
||||||
|
-c cs-bin ^
|
||||||
|
-d bin^
|
||||||
|
--conf %CONF_ROOT%\luban.conf ^
|
||||||
|
-x code.lineEnding=crlf ^
|
||||||
|
-x outputCodeDir=%CODE_OUTPATH% ^
|
||||||
|
-x outputDataDir=%DATA_OUTPATH%
|
||||||
|
pause
|
||||||
|
|
24
Configs/GameConfig/gen_code_bin_to_project.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
echo "当前目录: $(pwd)"
|
||||||
|
|
||||||
|
export WORKSPACE="$(realpath ../../)"
|
||||||
|
export LUBAN_DLL="${WORKSPACE}/Tools/Luban/Luban.dll"
|
||||||
|
export CONF_ROOT="$(pwd)"
|
||||||
|
export DATA_OUTPATH="${WORKSPACE}/UnityProject/Assets/AssetRaw/Configs/bytes/"
|
||||||
|
export CODE_OUTPATH="${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig/"
|
||||||
|
|
||||||
|
cp -R "${CONF_ROOT}/CustomTemplate/ConfigSystem.cs" \
|
||||||
|
"${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/ConfigSystem.cs"
|
||||||
|
cp -R "${CONF_ROOT}/CustomTemplate/ExternalTypeUtil.cs" \
|
||||||
|
"${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/ExternalTypeUtil.cs"
|
||||||
|
|
||||||
|
dotnet "${LUBAN_DLL}" \
|
||||||
|
-t client \
|
||||||
|
-c cs-bin \
|
||||||
|
-d bin \
|
||||||
|
--conf "${CONF_ROOT}/luban.conf" \
|
||||||
|
-x code.lineEnding=crlf \
|
||||||
|
-x outputCodeDir="${CODE_OUTPATH}" \
|
||||||
|
-x outputDataDir="${DATA_OUTPATH}"
|
23
Configs/GameConfig/gen_code_bin_to_project_lazyload.bat
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Cd /d %~dp0
|
||||||
|
echo %CD%
|
||||||
|
|
||||||
|
set WORKSPACE=../..
|
||||||
|
set LUBAN_DLL=%WORKSPACE%\Tools\Luban\Luban.dll
|
||||||
|
set CONF_ROOT=.
|
||||||
|
set DATA_OUTPATH=%WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/
|
||||||
|
set CODE_OUTPATH=%WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig/
|
||||||
|
|
||||||
|
xcopy /s /e /i /y "%CONF_ROOT%\CustomTemplate\ConfigSystem.cs" "%WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs"
|
||||||
|
xcopy /s /e /i /y "%CONF_ROOT%\CustomTemplate\ExternalTypeUtil.cs" "%WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ExternalTypeUtil.cs"
|
||||||
|
|
||||||
|
dotnet %LUBAN_DLL% ^
|
||||||
|
-t client ^
|
||||||
|
-c cs-bin ^
|
||||||
|
-d bin^
|
||||||
|
--conf %CONF_ROOT%\luban.conf ^
|
||||||
|
--customTemplateDir %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_LazyLoad ^
|
||||||
|
-x code.lineEnding=crlf ^
|
||||||
|
-x outputCodeDir=%CODE_OUTPATH% ^
|
||||||
|
-x outputDataDir=%DATA_OUTPATH%
|
||||||
|
pause
|
||||||
|
|
25
Configs/GameConfig/gen_code_bin_to_project_lazyload.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
echo "当前目录: $(pwd)"
|
||||||
|
|
||||||
|
export WORKSPACE="$(realpath ../../)"
|
||||||
|
export LUBAN_DLL="${WORKSPACE}/Tools/Luban/Luban.dll"
|
||||||
|
export CONF_ROOT="$(pwd)"
|
||||||
|
export DATA_OUTPATH="${WORKSPACE}/UnityProject/Assets/AssetRaw/Configs/bytes/"
|
||||||
|
export CODE_OUTPATH="${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig/"
|
||||||
|
|
||||||
|
cp -R "${CONF_ROOT}/CustomTemplate/ConfigSystem.cs" \
|
||||||
|
"${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/ConfigSystem.cs"
|
||||||
|
cp -R "${CONF_ROOT}/CustomTemplate/ExternalTypeUtil.cs" \
|
||||||
|
"${WORKSPACE}/UnityProject/Assets/GameScripts/HotFix/GameProto/ExternalTypeUtil.cs"
|
||||||
|
|
||||||
|
dotnet "${LUBAN_DLL}" \
|
||||||
|
-t client \
|
||||||
|
-c cs-bin \
|
||||||
|
-d bin \
|
||||||
|
--conf "${CONF_ROOT}/luban.conf" \
|
||||||
|
--customTemplateDir "${CONF_ROOT}/CustomTemplate/CustomTemplate_Client_LazyLoad" \
|
||||||
|
-x code.lineEnding=crlf \
|
||||||
|
-x outputCodeDir="${CODE_OUTPATH}" \
|
||||||
|
-x outputDataDir="${DATA_OUTPATH}"
|
19
Configs/GameConfig/gen_code_bin_to_server.bat
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Cd /d %~dp0
|
||||||
|
echo %CD%
|
||||||
|
|
||||||
|
set WORKSPACE=../../
|
||||||
|
set LUBAN_DLL=%WORKSPACE%/Tools/Luban/Luban.dll
|
||||||
|
set CONF_ROOT=.
|
||||||
|
set DATA_OUTPATH=%WORKSPACE%/Server/GameConfig
|
||||||
|
set CODE_OUTPATH=%WORKSPACE%/Server/Hotfix/Config/GameConfig
|
||||||
|
|
||||||
|
dotnet %LUBAN_DLL% ^
|
||||||
|
-t server^
|
||||||
|
-c cs-bin ^
|
||||||
|
-d bin^
|
||||||
|
--conf %CONF_ROOT%\luban.conf ^
|
||||||
|
-x code.lineEnding=crlf ^
|
||||||
|
-x outputCodeDir=%CODE_OUTPATH% ^
|
||||||
|
-x outputDataDir=%DATA_OUTPATH%
|
||||||
|
pause
|
||||||
|
|
19
Configs/GameConfig/gen_code_bin_to_server.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
echo "当前目录: $(pwd)"
|
||||||
|
|
||||||
|
export WORKSPACE="$(realpath ../../)"
|
||||||
|
export LUBAN_DLL="${WORKSPACE}/Tools/Luban/Luban.dll"
|
||||||
|
export CONF_ROOT="$(pwd)"
|
||||||
|
export DATA_OUTPATH="${WORKSPACE}/Server/GameConfig"
|
||||||
|
export CODE_OUTPATH="${WORKSPACE}/Server/Hotfix/Config/GameConfig"
|
||||||
|
|
||||||
|
dotnet "${LUBAN_DLL}" \
|
||||||
|
-t server \
|
||||||
|
-c cs-bin \
|
||||||
|
-d bin \
|
||||||
|
--conf "${CONF_ROOT}/luban.conf" \
|
||||||
|
-x code.lineEnding=crlf \
|
||||||
|
-x outputCodeDir="${CODE_OUTPATH}" \
|
||||||
|
-x outputDataDir="${DATA_OUTPATH}"
|
22
Configs/GameConfig/luban.conf
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"groups":
|
||||||
|
[
|
||||||
|
{"names":["c"], "default":true},
|
||||||
|
{"names":["s"], "default":true},
|
||||||
|
{"names":["e"], "default":true}
|
||||||
|
],
|
||||||
|
"schemaFiles":
|
||||||
|
[
|
||||||
|
{"fileName":"Defines", "type":""},
|
||||||
|
{"fileName":"Datas/__tables__.xlsx", "type":"table"},
|
||||||
|
{"fileName":"Datas/__beans__.xlsx", "type":"bean"},
|
||||||
|
{"fileName":"Datas/__enums__.xlsx", "type":"enum"}
|
||||||
|
],
|
||||||
|
"dataDir": "Datas",
|
||||||
|
"targets":
|
||||||
|
[
|
||||||
|
{"name":"server", "manager":"Tables", "groups":["s"], "topModule":"GameConfig"},
|
||||||
|
{"name":"client", "manager":"Tables", "groups":["c"], "topModule":"GameConfig"},
|
||||||
|
{"name":"all", "manager":"Tables", "groups":["c,s,e"], "topModule":"GameConfig"}
|
||||||
|
]
|
||||||
|
}
|
@@ -1,21 +0,0 @@
|
|||||||
cd /d %~dp0
|
|
||||||
set WORKSPACE=..
|
|
||||||
|
|
||||||
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
|
|
||||||
set CONF_ROOT=%WORKSPACE%\Configs
|
|
||||||
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
|
|
||||||
set CUSTOM_TEMP=%WORKSPACE%\Configs\CustomTemplate\CustomTemplate_Client
|
|
||||||
|
|
||||||
xcopy %CUSTOM_TEMP%\ConfigSystem.cs %WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs /s /e /i /y
|
|
||||||
|
|
||||||
%GEN_CLIENT% -j cfg --^
|
|
||||||
-d %CONF_ROOT%\Defines\__root__.xml ^
|
|
||||||
--input_data_dir %CONF_ROOT%\Excels^
|
|
||||||
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
|
|
||||||
--output_data_dir %WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/ ^
|
|
||||||
--gen_types code_cs_unity_bin,data_bin ^
|
|
||||||
-s client
|
|
||||||
|
|
||||||
echo ======== 生成配置文件结束 ========
|
|
||||||
|
|
||||||
pause
|
|
@@ -1,40 +0,0 @@
|
|||||||
cd /d %~dp0
|
|
||||||
set WORKSPACE=..
|
|
||||||
|
|
||||||
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
|
|
||||||
set CONF_ROOT=%WORKSPACE%\Configs
|
|
||||||
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
|
|
||||||
set CUSTOM_TEMP=%WORKSPACE%\Configs\CustomTemplate\CustomTemplate_Client_LazyLoad
|
|
||||||
|
|
||||||
xcopy %CUSTOM_TEMP%\ConfigSystem.cs %WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs /s /e /i /y
|
|
||||||
|
|
||||||
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_LazyLoad -j cfg --^
|
|
||||||
-d %CONF_ROOT%\Defines\__root__.xml ^
|
|
||||||
--input_data_dir %CONF_ROOT%\Excels^
|
|
||||||
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
|
|
||||||
--output_data_dir %WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/ ^
|
|
||||||
--gen_types data_bin ^
|
|
||||||
-s client
|
|
||||||
|
|
||||||
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_LazyLoad -j cfg --^
|
|
||||||
-d %CONF_ROOT%\Defines\__root__.xml ^
|
|
||||||
--input_data_dir %CONF_ROOT%\Excels^
|
|
||||||
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
|
|
||||||
--output_data_dir ..\GenerateDatas\bidx ^
|
|
||||||
--gen_types code_cs_unity_bin,data_bidx ^
|
|
||||||
-s client
|
|
||||||
|
|
||||||
echo ======== 生成配置文件结束 ========
|
|
||||||
set WORKSPACE=..
|
|
||||||
|
|
||||||
set "prefix=Idx_"
|
|
||||||
|
|
||||||
for %%a in (%DATA_OUTPUT%\bidx\*) do (
|
|
||||||
ren "%%a" "Idx_%%~nxa"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo ======== 所有文件已添加前缀 ========
|
|
||||||
|
|
||||||
xcopy %DATA_OUTPUT%\bidx\ %WORKSPACE%\UnityProject\Assets\AssetRaw\Configs\bidx\ /s /e /i /y
|
|
||||||
|
|
||||||
pause
|
|
@@ -1,21 +0,0 @@
|
|||||||
cd /d %~dp0
|
|
||||||
set WORKSPACE=..
|
|
||||||
|
|
||||||
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
|
|
||||||
set CONF_ROOT=%WORKSPACE%\Configs
|
|
||||||
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
|
|
||||||
set CUSTOM_TEMP=%WORKSPACE%\Configs\CustomTemplate\CustomTemplate_Client_UniTask
|
|
||||||
|
|
||||||
xcopy %CUSTOM_TEMP%\ConfigSystem.cs %WORKSPACE%\UnityProject\Assets\GameScripts\HotFix\GameProto\ConfigSystem.cs /s /e /i /y
|
|
||||||
|
|
||||||
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Client_UniTask -j cfg --^
|
|
||||||
-d %CONF_ROOT%\Defines\__root__.xml ^
|
|
||||||
--input_data_dir %CONF_ROOT%\Excels^
|
|
||||||
--output_code_dir %WORKSPACE%/UnityProject/Assets/GameScripts/HotFix/GameProto/GameConfig ^
|
|
||||||
--output_data_dir %WORKSPACE%/UnityProject/Assets/AssetRaw/Configs/bytes/ ^
|
|
||||||
--gen_types code_cs_unity_bin,data_bin ^
|
|
||||||
-s client
|
|
||||||
|
|
||||||
echo ======== 生成配置文件结束 ========
|
|
||||||
|
|
||||||
pause
|
|
@@ -1,18 +0,0 @@
|
|||||||
cd /d %~dp0
|
|
||||||
set WORKSPACE=..
|
|
||||||
|
|
||||||
set GEN_CLIENT=%WORKSPACE%\Tools\Luban.ClientServer\Luban.ClientServer.exe
|
|
||||||
set CONF_ROOT=%WORKSPACE%\Configs
|
|
||||||
set DATA_OUTPUT=%ROOT_PATH%..\GenerateDatas
|
|
||||||
|
|
||||||
%GEN_CLIENT% --template_search_path %CONF_ROOT%\CustomTemplate\CustomTemplate_Server_Task -j cfg --^
|
|
||||||
-d %CONF_ROOT%\Defines\__root__.xml ^
|
|
||||||
--input_data_dir %CONF_ROOT%\Excels^
|
|
||||||
--output_code_dir %WORKSPACE%/DotNet/Logic/src/Config/GameConfig ^
|
|
||||||
--output_data_dir ..\DotNet\Config\GameConfig ^
|
|
||||||
--gen_types code_cs_bin,data_bin ^
|
|
||||||
-s server
|
|
||||||
|
|
||||||
echo ======== 生成配置文件结束 ========
|
|
||||||
|
|
||||||
pause
|
|
63
README.md
@@ -23,19 +23,18 @@
|
|||||||
<a style="text-decoration:none">
|
<a style="text-decoration:none">
|
||||||
<img src="https://img.shields.io/github/languages/top/ALEXTANGXIAO/TEngine" alt="topLanguage" />
|
<img src="https://img.shields.io/github/languages/top/ALEXTANGXIAO/TEngine" alt="topLanguage" />
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://deepwiki.com/Alex-Rachel/TEngine" style="text-decoration:none">
|
||||||
|
<img src="https://deepwiki.com/badge.svg" alt="DeepWiki" />
|
||||||
|
</a>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
# <strong>TEngine
|
# <strong>TEngine
|
||||||
|
|
||||||
#### TEngine是一个简单(新手友好开箱即用)且强大的Unity框架全平台解决方案,对于需要一套上手快、文档清晰、高性能且可拓展性极强的商业级解决方案的开发者或者团队来说是一个很好的选择。
|
#### TEngine是一个简单(新手友好开箱即用)且强大的Unity框架全平台解决方案,对于需要一套上手快、文档清晰、高性能且可拓展性极强的商业级解决方案的开发者或者团队来说是一个很好的选择。
|
||||||
|
|
||||||
|
|
||||||
## <a href="http://1.12.241.46:5000/"><strong>文档快速入门 »</strong></a>
|
|
||||||
|
|
||||||
## 文档快速预览 - 5分钟
|
## 文档快速预览 - 5分钟
|
||||||
* [全平台跑通示意](Books/99-各平台运行RunAble.md): 全平台跑通示意。
|
* [全平台跑通示意](Books/99-各平台运行RunAble.md): 全平台跑通示意。
|
||||||
* [01_介绍](Books/0-介绍.md): 简单介绍。
|
* [01_介绍](Books/0-介绍.md): 简单介绍。
|
||||||
@@ -46,49 +45,49 @@
|
|||||||
* [06_对象池模块](Books/3-4-%E5%AF%B9%E8%B1%A1%E6%B1%A0%E6%A8%A1%E5%9D%97.md): 展示对象池模块概览。
|
* [06_对象池模块](Books/3-4-%E5%AF%B9%E8%B1%A1%E6%B1%A0%E6%A8%A1%E5%9D%97.md): 展示对象池模块概览。
|
||||||
* [07_配置表模块](Books/3-6-%E9%85%8D%E7%BD%AE%E8%A1%A8%E6%A8%A1%E5%9D%97.md): 展示配置表模块概览。
|
* [07_配置表模块](Books/3-6-%E9%85%8D%E7%BD%AE%E8%A1%A8%E6%A8%A1%E5%9D%97.md): 展示配置表模块概览。
|
||||||
* [08_流程模块](Books/3-7-%E6%B5%81%E7%A8%8B%E6%A8%A1%E5%9D%97.md): 展示商业化流程模块。
|
* [08_流程模块](Books/3-7-%E6%B5%81%E7%A8%8B%E6%A8%A1%E5%9D%97.md): 展示商业化流程模块。
|
||||||
|
* [09_UI模块](Books/3-5-UI模块.md): 展示商业化UI模块。
|
||||||
|
|
||||||
|
|
||||||
## <strong>为什么要使用TEngine
|
## <strong>为什么要使用TEngine
|
||||||
0. 开箱即用5分钟即可上手整套开发流程,代码整洁,思路清晰,功能强大。高内聚低耦合。您可以很轻易的把您不需要的模块进行移除替换。
|
0. 开箱即用5分钟即可上手整套开发流程,代码整洁,思路清晰,功能强大。高内聚低耦合。您可以很轻易的把您不需要的模块进行移除替换。
|
||||||
1. 严格按照商业要求使用次世代的HybridClr进行热更新、最佳的Luban配置表(TEngine支持懒加载、异步加载、同步加载配置。)、百万DAU游戏验证过的YooAsset资源框架(框架管理资源引用与释放。),全平台热更新流程已跑通。
|
1. 严格按照商业要求使用次世代的HybridClr进行热更新、最佳的Luban配置表(TEngine支持懒加载、异步加载、同步加载配置。)、百万DAU游戏验证过的YooAsset资源框架(框架管理资源引用与释放。),全平台热更新流程已跑通。
|
||||||
2. 严格按照商业化流程执行的热更新、商业化的UI开发流程、以及资源管理等等,设计并实现了YooAsset资源自动释放、支持LRU、ARC严格管理资源内存。
|
2. 严格按照商业化流程执行的热更新、商业化的UI开发流程、以及资源管理等等,设计并实现了YooAsset资源自动释放、支持LRU、ARC严格管理资源内存。
|
||||||
3. C#双端解决方案,服务器使用Fantasy,是一套源于ETServer,但极为简洁,性能更强,更好上手的一套商业级服务器框架。
|
3. 支持全平台,已有项目使用TEngine上架Steam、Wechat-minigame、AppStore。
|
||||||
4. 支持全平台,已有项目使用TEngine上架Steam、Wechat-minigame、AppStore。
|
|
||||||
|
|
||||||
## <strong>资源重要拓展概念
|
## <strong>最新的Demo飞机大战位于demo分支
|
||||||
* AssetReference (资源引用标识) 通用加载资源的时候绑定一个引用标识使你无需关心手动Dispose资源句柄。
|
|
||||||
|
|
||||||
* AssetGroup(资源组数据)进行资源分组绑定管理内存中的生命周期资源生命周期托管给资源组的根节点进行Dispose。
|
## <strong>服务器相关
|
||||||
|
TEngine本身为纯净的客户端。不强绑定任何服务器。但是个人开发以及中小型公司开发双端则推荐C#服务器。
|
||||||
|
|
||||||
* LruCacheTable (Least Recently Used Cache缓存表)
|
|
||||||
|
|
||||||
* ArcCacheTable (Adaptive Replacement Cache缓存表)
|
|
||||||
|
|
||||||
## <strong>为什么服务器使用C#
|
|
||||||
Net Core现在已经更新到了8.0的版本,在性能和设计上其实是远超JAVA和GO。在JAVAER还在为JVM更新和添加更多功能时,其实他们已经被国内大环境所包围了,看不到.Net Core的性能之强,组件化的结构。国内大环境是JAVA和GO的天下这个不可否认,但是国外C#也确实很多。其实.Net Core最大的问题是大多数自己人都不知道他的优点(AOT、JIT混合编译、热重载等等),甚至很多守旧派抵制core。GO喜欢吹性能,但其实目前来看,除了协程的轻量级,大多数性能测试其实不如JAVA和.Net。简单可以说出了C++的性能以外,Net Core其实都打得过。
|
Net Core现在已经更新到了8.0的版本,在性能和设计上其实是远超JAVA和GO。在JAVAER还在为JVM更新和添加更多功能时,其实他们已经被国内大环境所包围了,看不到.Net Core的性能之强,组件化的结构。国内大环境是JAVA和GO的天下这个不可否认,但是国外C#也确实很多。其实.Net Core最大的问题是大多数自己人都不知道他的优点(AOT、JIT混合编译、热重载等等),甚至很多守旧派抵制core。GO喜欢吹性能,但其实目前来看,除了协程的轻量级,大多数性能测试其实不如JAVA和.Net。简单可以说出了C++的性能以外,Net Core其实都打得过。
|
||||||
<strong>当然作为商业级解决方案服务器的耦合度也极低,如果不喜欢您也可以很轻松直接移除替换成你的服务器。</strong>
|
|
||||||
|
需要服务器可以合并<a href="https://github.com/ALEXTANGXIAO/GameNetty"><strong>GameNetty</strong></a>过来,或者分支Fantasy为接好的带有Fantasy服务器的双端分支。
|
||||||
|
|
||||||
## <strong>项目结构概览
|
## <strong>项目结构概览
|
||||||
```
|
```
|
||||||
Assets
|
Assets
|
||||||
|
├── AssetArt // 美术资源目录
|
||||||
|
│ └── Atlas // 自动生成图集目录
|
||||||
├── AssetRaw // 热更资源目录
|
├── AssetRaw // 热更资源目录
|
||||||
├── Atlas // 自动生成图集目录
|
│ ├── UIRaw // UI图片目录
|
||||||
|
│ │ ├── Atlas // 需要自动生成图集的UI素材目录
|
||||||
|
│ │ └── Raw // 不需要自动生成图集的UI素材目录
|
||||||
|
├── Editor // 编辑器脚本目录
|
||||||
├── HybridCLRData // hybridclr相关目录
|
├── HybridCLRData // hybridclr相关目录
|
||||||
|
├── Scenes // 主场景目录
|
||||||
├── TEngine // 框架核心目录
|
├── TEngine // 框架核心目录
|
||||||
└── GameScripts // 程序集目录
|
└── GameScripts // 程序集目录
|
||||||
├── Editor // 编辑器程序集
|
├── Procedure // 启动器与流程
|
||||||
├── Main // 主程序程序集(启动器与流程)
|
|
||||||
└── HotFix // 游戏热更程序集目录 [Folder]
|
└── HotFix // 游戏热更程序集目录 [Folder]
|
||||||
├── GameBase // 游戏基础框架程序集 [Dll]
|
├── GameProto // 游戏配置协议程序集 [Dll]
|
||||||
├── GameProto // 游戏配置协议程序集 [Dll]
|
|
||||||
├── BattleCore // 游戏核心战斗程序集 [Dll]
|
|
||||||
└── GameLogic // 游戏业务逻辑程序集 [Dll]
|
└── GameLogic // 游戏业务逻辑程序集 [Dll]
|
||||||
├── GameApp.cs // 热更主入口
|
└── GameApp.cs // 热更主入口
|
||||||
└── GameApp_RegisterSystem.cs // 热更主入口注册系统
|
|
||||||
```
|
|
||||||
|
|
||||||
- 必要:项目使用了以下第三方插件,请自行购买导入:
|
|
||||||
- /Unity/Assets/Plugins/Sirenix
|
TEngine
|
||||||
|
├── Editor // TEngine编辑器核心代码
|
||||||
|
└── Runtime // TEngine运行时核心代码
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## <strong>优质开源项目推荐
|
## <strong>优质开源项目推荐
|
||||||
@@ -99,7 +98,13 @@ Assets
|
|||||||
|
|
||||||
#### <a href="https://github.com/focus-creative-games/hybridclr"><strong>HybridCLR</strong></a> - 特性完整、零成本、高性能、低内存的近乎完美的Unity全平台原生c#热更方案
|
#### <a href="https://github.com/focus-creative-games/hybridclr"><strong>HybridCLR</strong></a> - 特性完整、零成本、高性能、低内存的近乎完美的Unity全平台原生c#热更方案
|
||||||
|
|
||||||
#### <a href="https://github.com/qq362946/Fantasy"><strong>Fantasy</strong></a> - Fantasy是一套源于ETServer但极为简洁,性能更强,更好上手的一套商业级服务器框架。
|
#### <a href="https://github.com/qq362946/Fantasy"><strong>Fantasy</strong></a> - Fantasy是一套源于ETServer但极为简洁,更好上手的一套商业级服务器框架。
|
||||||
|
|
||||||
## <strong>交流群
|
#### <a href="https://github.com/ALEXTANGXIAO/GameNetty"><strong>GameNetty</strong></a> - GameNetty是一套源于ETServer,首次拆分最新的ET8.1的前后端解决方案(包),客户端最精简大约750k,完美做成包的形式,几乎零成本 无侵入的嵌入进你的框架。
|
||||||
### <a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=MzOcQIzGVLQ5AC5LHaqqA3h_F6lZ_DX4&authKey=LctqAWGHkJ7voQvuj1oaSe5tsGrc1XmQG3U4QniieGUlxY3lC7FtDIpEvPOX0vT8&noverify=0&group_code=862987645">群 号:862987645 </strong></a>
|
|
||||||
|
#### <a href="https://github.com/Herta-Space-Station/FixedPoint"><strong>FixedPoint</strong></a> - 性能极限的定点数学库FixedPoint。
|
||||||
|
|
||||||
|
|
||||||
|
## <strong>Buy me a 奶茶.
|
||||||
|
|
||||||
|
[您的赞助会让我们做得更快更好,如果觉得TEngine对您有帮助,不妨请我可爱的女儿买杯奶茶吧~](Books/Donate.md)
|
||||||
|
3
Tools/FileServer/instal.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
npm install yumu-static-server -g
|
3
Tools/FileServer/start.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
server -p 8081 -cors
|
13
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/.idea.SourceGenerator.iml
|
||||||
|
/contentModel.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
1
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
SourceGenerator
|
253
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/CopilotChatHistory.xml
generated
Normal file
4
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
8
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Tools/GameEventSourceGenerator/.idea/.idea.SourceGenerator/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@@ -0,0 +1,568 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using Microsoft.CodeAnalysis.Diagnostics;
|
||||||
|
using Microsoft.CodeAnalysis.FlowAnalysis;
|
||||||
|
using Exception = System.Exception;
|
||||||
|
|
||||||
|
namespace Analyzer
|
||||||
|
{
|
||||||
|
public static class AnalyzerHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取语法树节点的子节点中第一个指定类型节点
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="syntaxNode">语法树节点</param>
|
||||||
|
/// <typeparam name="T">指定语法节点类型</typeparam>
|
||||||
|
/// <returns>第一个指定类型节点</returns>
|
||||||
|
public static T? GetFirstChild<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||||
|
{
|
||||||
|
foreach (SyntaxNode? childNode in syntaxNode.ChildNodes())
|
||||||
|
{
|
||||||
|
if (childNode.GetType() == typeof(T))
|
||||||
|
{
|
||||||
|
return childNode as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SyntaxNode? GetFirstChild(this SyntaxNode syntaxNode)
|
||||||
|
{
|
||||||
|
var childNodes = syntaxNode.ChildNodes();
|
||||||
|
if (childNodes.Count() > 0)
|
||||||
|
{
|
||||||
|
return childNodes.First();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取语法树节点的子节点中最后一个指定类型节点
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="syntaxNode">语法树节点</param>
|
||||||
|
/// <typeparam name="T">指定语法节点类型</typeparam>
|
||||||
|
/// <returns>最后一个指定类型节点</returns>
|
||||||
|
public static T? GetLastChild<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||||
|
{
|
||||||
|
foreach (SyntaxNode? childNode in syntaxNode.ChildNodes().Reverse())
|
||||||
|
{
|
||||||
|
if (childNode.GetType() == typeof(T))
|
||||||
|
{
|
||||||
|
return childNode as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取语法节点所属的ClassDeclarationSyntax
|
||||||
|
/// </summary>
|
||||||
|
public static ClassDeclarationSyntax? GetParentClassDeclaration(this SyntaxNode syntaxNode)
|
||||||
|
{
|
||||||
|
SyntaxNode? parentNode = syntaxNode.Parent;
|
||||||
|
while (parentNode != null)
|
||||||
|
{
|
||||||
|
if (parentNode is ClassDeclarationSyntax classDeclarationSyntax)
|
||||||
|
{
|
||||||
|
return classDeclarationSyntax;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentNode = parentNode.Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// INamedTypeSymbol 是否有指定的Attribute
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasAttribute(this ITypeSymbol typeSymbol, string AttributeName)
|
||||||
|
{
|
||||||
|
foreach (AttributeData? attributeData in typeSymbol.GetAttributes())
|
||||||
|
{
|
||||||
|
if (attributeData.AttributeClass?.ToString() == AttributeName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool HasAttributeInTypeAndBaseTyes(this ITypeSymbol typeSymbol, string AttributeName)
|
||||||
|
{
|
||||||
|
if (typeSymbol.HasAttribute(AttributeName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var baseType in typeSymbol.BaseTypes())
|
||||||
|
{
|
||||||
|
if (baseType.HasAttribute(AttributeName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<ITypeSymbol> BaseTypes(this ITypeSymbol typeSymbol)
|
||||||
|
{
|
||||||
|
ITypeSymbol? baseType = typeSymbol.BaseType;
|
||||||
|
while (baseType != null)
|
||||||
|
{
|
||||||
|
yield return baseType;
|
||||||
|
baseType = baseType.BaseType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// INamedTypeSymbol 是否有指定的基类Attribute
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasBaseAttribute(this INamedTypeSymbol namedTypeSymbol, string AttributeName)
|
||||||
|
{
|
||||||
|
foreach (AttributeData? attributeData in namedTypeSymbol.GetAttributes())
|
||||||
|
{
|
||||||
|
INamedTypeSymbol? attributeType = attributeData.AttributeClass?.BaseType;
|
||||||
|
while (attributeType != null)
|
||||||
|
{
|
||||||
|
if (attributeType.ToString() == AttributeName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
attributeType = attributeType.BaseType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// INamedTypeSymbol 获取指定类型的第一个Attribute
|
||||||
|
/// </summary>
|
||||||
|
public static AttributeData? GetFirstAttribute(this INamedTypeSymbol namedTypeSymbol, string AttributeName)
|
||||||
|
{
|
||||||
|
foreach (AttributeData? attributeData in namedTypeSymbol.GetAttributes())
|
||||||
|
{
|
||||||
|
if (attributeData.AttributeClass?.ToString() == AttributeName)
|
||||||
|
{
|
||||||
|
return attributeData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// INamedTypeSymbol 是否含有指定接口
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasInterface(this INamedTypeSymbol namedTypeSymbol, string InterfaceName)
|
||||||
|
{
|
||||||
|
foreach (INamedTypeSymbol? iInterface in namedTypeSymbol.AllInterfaces)
|
||||||
|
{
|
||||||
|
if (iInterface.IsInterface(InterfaceName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 某个接口symbol 是否是指定的接口
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsInterface(this INamedTypeSymbol namedTypeSymbol, string InterfaceName)
|
||||||
|
{
|
||||||
|
return $"{namedTypeSymbol.GetNameSpace()}.{namedTypeSymbol.Name}" == InterfaceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断指定的程序集是否需要分析
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsAssemblyNeedAnalyze(string? assemblyName, params string[] analyzeAssemblyNames)
|
||||||
|
{
|
||||||
|
if (assemblyName == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string analyzeAssemblyName in analyzeAssemblyNames)
|
||||||
|
{
|
||||||
|
if (assemblyName == analyzeAssemblyName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取 成员访问语法节点的父级类型
|
||||||
|
/// </summary>
|
||||||
|
public static ITypeSymbol? GetMemberAccessSyntaxParentType(this MemberAccessExpressionSyntax memberAccessExpressionSyntax,
|
||||||
|
SemanticModel semanticModel)
|
||||||
|
{
|
||||||
|
SyntaxNode? firstChildSyntaxNode = memberAccessExpressionSyntax.GetFirstChild();
|
||||||
|
if (firstChildSyntaxNode == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ISymbol? firstChildSymbol = semanticModel.GetSymbolInfo(firstChildSyntaxNode).Symbol;
|
||||||
|
if (firstChildSymbol == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is ILocalSymbol localSymbol)
|
||||||
|
{
|
||||||
|
return localSymbol.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is IParameterSymbol parameterSymbol)
|
||||||
|
{
|
||||||
|
return parameterSymbol.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is IPropertySymbol propertySymbol)
|
||||||
|
{
|
||||||
|
return propertySymbol.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
return methodSymbol.ReturnType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is IFieldSymbol fieldSymbol)
|
||||||
|
{
|
||||||
|
return fieldSymbol.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstChildSymbol is IEventSymbol eventSymbol)
|
||||||
|
{
|
||||||
|
return eventSymbol.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取最近的指定类型祖先节点
|
||||||
|
/// </summary>
|
||||||
|
public static T? GetNeareastAncestor<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||||
|
{
|
||||||
|
foreach (var ancestorNode in syntaxNode.Ancestors())
|
||||||
|
{
|
||||||
|
if (ancestorNode is T Tancestor)
|
||||||
|
{
|
||||||
|
return Tancestor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断函数是否是否含有指定类型的参数
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasParameterType(this IMethodSymbol methodSymbol, string parameterType, out IParameterSymbol? cencelTokenSymbol)
|
||||||
|
{
|
||||||
|
foreach (var parameterSymbol in methodSymbol.Parameters)
|
||||||
|
{
|
||||||
|
if (parameterSymbol.Type.ToString() == parameterType)
|
||||||
|
{
|
||||||
|
cencelTokenSymbol = parameterSymbol;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cencelTokenSymbol = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有指定类型的子节点
|
||||||
|
/// </summary>
|
||||||
|
public static IEnumerable<T> DescendantNodes<T>(this SyntaxNode syntaxNode) where T : SyntaxNode
|
||||||
|
{
|
||||||
|
foreach (var descendantNode in syntaxNode.DescendantNodes())
|
||||||
|
{
|
||||||
|
if (descendantNode is T node)
|
||||||
|
{
|
||||||
|
yield return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取与该语法节点同层级的上一个节点
|
||||||
|
/// </summary>
|
||||||
|
public static SyntaxNode? PreviousNode(this SyntaxNode syntaxNode)
|
||||||
|
{
|
||||||
|
if (syntaxNode.Parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
foreach (var childNode in syntaxNode.Parent.ChildNodes())
|
||||||
|
{
|
||||||
|
if (childNode == syntaxNode)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return syntaxNode.Parent.ChildNodes().ElementAt(index - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取与该语法节点同层级的下一个节点
|
||||||
|
/// </summary>
|
||||||
|
public static SyntaxNode? NextNode(this SyntaxNode syntaxNode)
|
||||||
|
{
|
||||||
|
if (syntaxNode.Parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
foreach (var childNode in syntaxNode.Parent.ChildNodes())
|
||||||
|
{
|
||||||
|
if (childNode == syntaxNode)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == syntaxNode.Parent.ChildNodes().Count() - 1)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return syntaxNode.Parent.ChildNodes().ElementAt(index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取await表达式所在的控制流block
|
||||||
|
/// </summary>
|
||||||
|
public static BasicBlock? GetAwaitStatementControlFlowBlock(StatementSyntax statementSyntax, AwaitExpressionSyntax awaitExpressionSyntax, SemanticModel semanticModel)
|
||||||
|
{
|
||||||
|
// 跳过 return 表达式
|
||||||
|
if (statementSyntax.IsKind(SyntaxKind.ReturnStatement))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var methodSyntax = statementSyntax.GetNeareastAncestor<MethodDeclarationSyntax>();
|
||||||
|
if (methodSyntax == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建表达式所在函数的控制流图
|
||||||
|
var controlFlowGraph = ControlFlowGraph.Create(methodSyntax, semanticModel);
|
||||||
|
|
||||||
|
if (controlFlowGraph == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statementSyntax is LocalDeclarationStatementSyntax)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicBlock? block = controlFlowGraph.Blocks.FirstOrDefault(x => x.Operations.Any(y => y.Syntax.Contains(statementSyntax)));
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断类是否为partial类
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsPartial(this ClassDeclarationSyntax classDeclaration)
|
||||||
|
{
|
||||||
|
foreach (var modifier in classDeclaration.Modifiers)
|
||||||
|
{
|
||||||
|
if (modifier.IsKind(SyntaxKind.PartialKeyword))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string? GetNameSpace(this INamedTypeSymbol namedTypeSymbol)
|
||||||
|
{
|
||||||
|
INamespaceSymbol? namespaceSymbol = namedTypeSymbol.ContainingNamespace;
|
||||||
|
string? namespaceName = namespaceSymbol?.Name;
|
||||||
|
while (namespaceSymbol?.ContainingNamespace != null)
|
||||||
|
{
|
||||||
|
namespaceSymbol = namespaceSymbol.ContainingNamespace;
|
||||||
|
if (string.IsNullOrEmpty(namespaceSymbol.Name))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespaceName = $"{namespaceSymbol.Name}.{namespaceName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(namespaceName))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return namespaceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据语义模型的文件路径 判断是否需要分析
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSemanticModelNeedAnalyze(SemanticModel semanticModel, params string[] filePaths)
|
||||||
|
{
|
||||||
|
foreach (var filePath in filePaths)
|
||||||
|
{
|
||||||
|
if (semanticModel.SyntaxTree.FilePath.Contains(filePath))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型symbol是否有指定名字 指定参数的方法
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasMethodWithParams(this INamedTypeSymbol namedTypeSymbol, string methodName, params ITypeSymbol[] typeSymbols)
|
||||||
|
{
|
||||||
|
foreach (var member in namedTypeSymbol.GetMembers())
|
||||||
|
{
|
||||||
|
if (member is not IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (methodSymbol.Name != methodName)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeSymbols.Length != methodSymbol.Parameters.Length)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeSymbols.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEqual = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < typeSymbols.Length; i++)
|
||||||
|
{
|
||||||
|
if (typeSymbols[i].ToString() != methodSymbol.Parameters[i].Type.ToString())
|
||||||
|
{
|
||||||
|
isEqual = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEqual)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型symbol是否有指定名字 指定参数的方法
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasMethodWithParams(this INamedTypeSymbol namedTypeSymbol, string methodName, params string[] typeSymbols)
|
||||||
|
{
|
||||||
|
foreach (var member in namedTypeSymbol.GetMembers())
|
||||||
|
{
|
||||||
|
if (member is not IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (methodSymbol.Name != methodName)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeSymbols.Length != methodSymbol.Parameters.Length)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeSymbols.Length == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEqual = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < typeSymbols.Length; i++)
|
||||||
|
{
|
||||||
|
if (typeSymbols[i] != methodSymbol.Parameters[i].Type.ToString())
|
||||||
|
{
|
||||||
|
isEqual = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEqual)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 方法symbol 是否有指定的attribute
|
||||||
|
/// </summary>
|
||||||
|
public static bool HasAttribute(this IMethodSymbol methodSymbol, string AttributeName)
|
||||||
|
{
|
||||||
|
foreach (AttributeData? attributeData in methodSymbol.GetAttributes())
|
||||||
|
{
|
||||||
|
if (attributeData?.AttributeClass?.ToString() == AttributeName)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
Tools/GameEventSourceGenerator/SourceGenerator.sln
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.002.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGenerator", "SourceGenerator\SourceGenerator.csproj", "{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{57F17CC8-F26D-496E-B8E9-2601F9FF3CE5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{26B3F75F-AB7F-48F8-B234-F5A26E8CA319}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F02E4A8C-07E7-4C7F-B30A-3D5BE1C7CB98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{23425ADC-1091-46A0-94BF-8EA6A7F5EFD7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CA734AB9-F825-4DDA-BCB1-AD5FC464CAB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {FCBB04E4-2793-4CF8-9278-E932D3B254AC}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@@ -0,0 +1,7 @@
|
|||||||
|
public class Definition
|
||||||
|
{
|
||||||
|
public const string FrameworkNameSpace = "TEngine";
|
||||||
|
public const string NameSpace = "GameLogic";
|
||||||
|
public const string EventInterface = "EventInterface";
|
||||||
|
public const string StringToHash = "RuntimeId.ToRuntimeId";
|
||||||
|
}
|
@@ -0,0 +1,192 @@
|
|||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Analyzer;
|
||||||
|
|
||||||
|
[Generator]
|
||||||
|
public class EventInterfaceGenerator : ISourceGenerator
|
||||||
|
{
|
||||||
|
public void Initialize(GeneratorInitializationContext context)
|
||||||
|
{
|
||||||
|
// 可以在这里进行初始化
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(GeneratorExecutionContext context)
|
||||||
|
{
|
||||||
|
// 获取当前语法树
|
||||||
|
var syntaxTrees = context.Compilation.SyntaxTrees;
|
||||||
|
|
||||||
|
List<string> classNameList = new List<string>();
|
||||||
|
|
||||||
|
foreach (var tree in syntaxTrees)
|
||||||
|
{
|
||||||
|
var root = tree.GetRoot();
|
||||||
|
var interfaces = root.DescendantNodes()
|
||||||
|
.OfType<InterfaceDeclarationSyntax>()
|
||||||
|
.Where(i => i.AttributeLists.Count > 0 &&
|
||||||
|
i.AttributeLists
|
||||||
|
.Any(a => a.Attributes
|
||||||
|
.Any(attr => attr.Name.ToString() == $"{Definition.EventInterface}")));
|
||||||
|
|
||||||
|
foreach (var interfaceNode in interfaces)
|
||||||
|
{
|
||||||
|
var interfaceName = interfaceNode.Identifier.ToString();
|
||||||
|
var fullName = interfaceNode.SyntaxTree.GetRoot()
|
||||||
|
.DescendantNodes()
|
||||||
|
.OfType<NamespaceDeclarationSyntax>()
|
||||||
|
.Select(ns => ns.Name.ToString())
|
||||||
|
.Concat(new[] { interfaceName })
|
||||||
|
.Aggregate((a, b) => a + "." + b);
|
||||||
|
var eventClassName = $"{interfaceName}_Event";
|
||||||
|
var eventClassCode = GenerateEventClass(interfaceName, eventClassName, interfaceNode);
|
||||||
|
|
||||||
|
context.AddSource($"{eventClassName}.g.cs", eventClassCode);
|
||||||
|
|
||||||
|
// 生成实现类
|
||||||
|
var implementationClassCode = GenerateImplementationClass(fullName, interfaceName, interfaceNode,context);
|
||||||
|
context.AddSource($"{interfaceName}_Gen.g.cs", implementationClassCode);
|
||||||
|
|
||||||
|
|
||||||
|
classNameList.Add($"{interfaceName}_Gen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string uniqueFileName = $"GameEventHelper.g.cs";
|
||||||
|
context.AddSource(uniqueFileName, GenerateGameEventHelper(classNameList));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateGameEventHelper(List<string> classNameList)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine($"// <auto-generated>");
|
||||||
|
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||||
|
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||||
|
sb.AppendLine($"// the code is regenerated.");
|
||||||
|
sb.AppendLine($"// </auto-generated>");
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"using UnityEngine;");
|
||||||
|
sb.AppendLine($"using UnityEngine.UI;");
|
||||||
|
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||||
|
sb.AppendLine($"{{");
|
||||||
|
sb.AppendLine($" public static class GameEventHelper");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
sb.AppendLine($" public static void Init()");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
|
||||||
|
foreach (var className in classNameList)
|
||||||
|
{
|
||||||
|
sb.AppendLine($" var m_{className} = new {className}(GameEvent.EventMgr.GetDispatcher());");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
|
||||||
|
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateEventClass(string interfaceName, string className, InterfaceDeclarationSyntax interfaceNode)
|
||||||
|
{
|
||||||
|
var methods = interfaceNode.Members.OfType<MethodDeclarationSyntax>();
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine($"// <auto-generated>");
|
||||||
|
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||||
|
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||||
|
sb.AppendLine($"// the code is regenerated.");
|
||||||
|
sb.AppendLine($"// </auto-generated>");
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"using UnityEngine;");
|
||||||
|
sb.AppendLine($"using UnityEngine.UI;");
|
||||||
|
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||||
|
sb.AppendLine("{");
|
||||||
|
sb.AppendLine($" public partial class {className}");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
|
||||||
|
foreach (var method in methods)
|
||||||
|
{
|
||||||
|
var methodName = method.Identifier.ToString();
|
||||||
|
var parameters = string.Join(", ", method.ParameterList.Parameters.Select(p => $"{p.Type} {p.Identifier}"));
|
||||||
|
sb.AppendLine($" public static readonly int {methodName} = {Definition.StringToHash}(\"{className}.{methodName}\");");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateImplementationClass(string interfaceFullName, string interfaceName, InterfaceDeclarationSyntax interfaceNode,GeneratorExecutionContext context)
|
||||||
|
{
|
||||||
|
var semanticModel = context.Compilation.GetSemanticModel(interfaceNode.SyntaxTree);
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine($"// <auto-generated>");
|
||||||
|
sb.AppendLine($"// This code was generated by autoBindTool.");
|
||||||
|
sb.AppendLine($"// Changes to this file may cause incorrect behavior and will be lost if");
|
||||||
|
sb.AppendLine($"// the code is regenerated.");
|
||||||
|
sb.AppendLine($"// </auto-generated>");
|
||||||
|
sb.AppendLine($"//------------------------------------------------------------------------------");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"using UnityEngine;");
|
||||||
|
sb.AppendLine($"using UnityEngine.UI;");
|
||||||
|
sb.AppendLine($"using {Definition.FrameworkNameSpace};");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($"namespace {Definition.NameSpace}");
|
||||||
|
sb.AppendLine($"{{");
|
||||||
|
sb.AppendLine($" public partial class {interfaceName}_Gen : {interfaceName}");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
sb.AppendLine(" private EventDispatcher _dispatcher;");
|
||||||
|
sb.AppendLine($" public {interfaceName}_Gen(EventDispatcher dispatcher)");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
sb.AppendLine(" _dispatcher = dispatcher;");
|
||||||
|
sb.AppendLine($" GameEvent.EventMgr.RegWrapInterface(\"{interfaceFullName}\", this);");
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
|
||||||
|
foreach (var method in interfaceNode.Members.OfType<MethodDeclarationSyntax>())
|
||||||
|
{
|
||||||
|
var methodName = method.Identifier.ToString();
|
||||||
|
var parameters = GenerateParameters(method, semanticModel);
|
||||||
|
|
||||||
|
sb.AppendLine($" public void {methodName}({parameters})");
|
||||||
|
sb.AppendLine(" {");
|
||||||
|
if (method.ParameterList.Parameters.Count > 0)
|
||||||
|
{
|
||||||
|
var paramNames = string.Join(", ", method.ParameterList.Parameters.Select(p => p.Identifier.ToString()));
|
||||||
|
sb.AppendLine($" _dispatcher.Send({interfaceName}_Event.{methodName}, {paramNames});");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.AppendLine($" _dispatcher.Send({interfaceName}_Event.{methodName});");
|
||||||
|
}
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine(" }");
|
||||||
|
sb.AppendLine("}");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GenerateParameters(MethodDeclarationSyntax method, SemanticModel semanticModel)
|
||||||
|
{
|
||||||
|
return string.Join(", ", method.ParameterList.Parameters.Select(p =>
|
||||||
|
{
|
||||||
|
var typeSymbol = semanticModel.GetTypeInfo(p.Type).Type;
|
||||||
|
return typeSymbol != null
|
||||||
|
? $"{typeSymbol.ToDisplayString()} {p.Identifier}"
|
||||||
|
: $"{p.Type} {p.Identifier}";
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>12</LangVersion>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<DevelopmentDependency>true</DevelopmentDependency>
|
||||||
|
<IncludeSymbols>false</IncludeSymbols>
|
||||||
|
<NoWarn>1701;1702;RS2008</NoWarn>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="../Analyzer/Extension/*.cs">
|
||||||
|
<Link>Extension\%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- <Target Name="PostBuild" AfterTargets="PostBuildEvent">-->
|
||||||
|
<!-- <Copy SourceFiles="$(TargetDir)/$(TargetName).dll" DestinationFolder="$(ProjectDir)/../../Unity/Assets/Plugins/" ContinueOnError="false" />-->
|
||||||
|
<!-- </Target>-->
|
||||||
|
|
||||||
|
</Project>
|
@@ -0,0 +1,236 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETStandard,Version=v2.0/",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETStandard,Version=v2.0": {},
|
||||||
|
".NETStandard,Version=v2.0/": {
|
||||||
|
"SourceGenerator/1.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": "3.3.3",
|
||||||
|
"Microsoft.CodeAnalysis.CSharp": "3.9.0",
|
||||||
|
"NETStandard.Library": "2.0.3"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"SourceGenerator.dll": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {},
|
||||||
|
"Microsoft.CodeAnalysis.Common/3.9.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": "3.3.3",
|
||||||
|
"System.Collections.Immutable": "5.0.0",
|
||||||
|
"System.Memory": "4.5.4",
|
||||||
|
"System.Reflection.Metadata": "5.0.0",
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "5.0.0",
|
||||||
|
"System.Text.Encoding.CodePages": "4.5.1",
|
||||||
|
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/Microsoft.CodeAnalysis.dll": {
|
||||||
|
"assemblyVersion": "3.9.0.0",
|
||||||
|
"fileVersion": "3.900.21.12420"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.CSharp/3.9.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Common": "3.9.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.dll": {
|
||||||
|
"assemblyVersion": "3.9.0.0",
|
||||||
|
"fileVersion": "3.900.21.12420"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.NETCore.Platforms/1.1.0": {},
|
||||||
|
"NETStandard.Library/2.0.3": {
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.Platforms": "1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Buffers/4.5.1": {
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Buffers.dll": {
|
||||||
|
"assemblyVersion": "4.0.3.0",
|
||||||
|
"fileVersion": "4.6.28619.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Collections.Immutable/5.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Memory": "4.5.4"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Collections.Immutable.dll": {
|
||||||
|
"assemblyVersion": "5.0.0.0",
|
||||||
|
"fileVersion": "5.0.20.51904"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Memory/4.5.4": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Buffers": "4.5.1",
|
||||||
|
"System.Numerics.Vectors": "4.4.0",
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Memory.dll": {
|
||||||
|
"assemblyVersion": "4.0.1.1",
|
||||||
|
"fileVersion": "4.6.28619.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Numerics.Vectors/4.4.0": {
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Numerics.Vectors.dll": {
|
||||||
|
"assemblyVersion": "4.1.3.0",
|
||||||
|
"fileVersion": "4.6.25519.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Reflection.Metadata/5.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Collections.Immutable": "5.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Reflection.Metadata.dll": {
|
||||||
|
"assemblyVersion": "5.0.0.0",
|
||||||
|
"fileVersion": "5.0.20.51904"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/5.0.0": {
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
|
||||||
|
"assemblyVersion": "5.0.0.0",
|
||||||
|
"fileVersion": "5.0.20.51904"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Text.Encoding.CodePages/4.5.1": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Text.Encoding.CodePages.dll": {
|
||||||
|
"assemblyVersion": "4.1.1.0",
|
||||||
|
"fileVersion": "4.6.27129.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Threading.Tasks.Extensions/4.5.4": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/System.Threading.Tasks.Extensions.dll": {
|
||||||
|
"assemblyVersion": "4.2.0.1",
|
||||||
|
"fileVersion": "4.6.28619.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"SourceGenerator/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers/3.3.3": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==",
|
||||||
|
"path": "microsoft.codeanalysis.analyzers/3.3.3",
|
||||||
|
"hashPath": "microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.Common/3.9.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-HiWjF7PNIEngmFg2Xk8cZ/83lRIRkk9v+5ibbY5B7VvjNGdClGAMuWtZER9F5rGRR41VbJLco9ah73jFTh4vPw==",
|
||||||
|
"path": "microsoft.codeanalysis.common/3.9.0",
|
||||||
|
"hashPath": "microsoft.codeanalysis.common.3.9.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.CSharp/3.9.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-NTsiK3fnoZGemy4dBHrILwg9rL+jDnOJ7aixFu4EOWM1r6MZMrNCIhT2tO4AmIMdfICLPwj910uZRRLpbMnqHg==",
|
||||||
|
"path": "microsoft.codeanalysis.csharp/3.9.0",
|
||||||
|
"hashPath": "microsoft.codeanalysis.csharp.3.9.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"Microsoft.NETCore.Platforms/1.1.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
|
||||||
|
"path": "microsoft.netcore.platforms/1.1.0",
|
||||||
|
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"NETStandard.Library/2.0.3": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
|
||||||
|
"path": "netstandard.library/2.0.3",
|
||||||
|
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Buffers/4.5.1": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==",
|
||||||
|
"path": "system.buffers/4.5.1",
|
||||||
|
"hashPath": "system.buffers.4.5.1.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Collections.Immutable/5.0.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||||
|
"path": "system.collections.immutable/5.0.0",
|
||||||
|
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Memory/4.5.4": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==",
|
||||||
|
"path": "system.memory/4.5.4",
|
||||||
|
"hashPath": "system.memory.4.5.4.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Numerics.Vectors/4.4.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ==",
|
||||||
|
"path": "system.numerics.vectors/4.4.0",
|
||||||
|
"hashPath": "system.numerics.vectors.4.4.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Reflection.Metadata/5.0.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==",
|
||||||
|
"path": "system.reflection.metadata/5.0.0",
|
||||||
|
"hashPath": "system.reflection.metadata.5.0.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Runtime.CompilerServices.Unsafe/5.0.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==",
|
||||||
|
"path": "system.runtime.compilerservices.unsafe/5.0.0",
|
||||||
|
"hashPath": "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Text.Encoding.CodePages/4.5.1": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==",
|
||||||
|
"path": "system.text.encoding.codepages/4.5.1",
|
||||||
|
"hashPath": "system.text.encoding.codepages.4.5.1.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Threading.Tasks.Extensions/4.5.4": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
|
||||||
|
"path": "system.threading.tasks.extensions/4.5.4",
|
||||||
|
"hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
|
@@ -0,0 +1,22 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: System.Reflection.AssemblyCompanyAttribute("SourceGenerator")]
|
||||||
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b7d75c0f6f518a5f2ca0ed9304411302709f8dbe")]
|
||||||
|
[assembly: System.Reflection.AssemblyProductAttribute("SourceGenerator")]
|
||||||
|
[assembly: System.Reflection.AssemblyTitleAttribute("SourceGenerator")]
|
||||||
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
|
// 由 MSBuild WriteCodeFragment 类生成。
|
||||||
|
|
@@ -0,0 +1 @@
|
|||||||
|
1f4b8d9919850399efa15c732e9aadbc83f7ae6889745a83831d20da225de402
|
@@ -0,0 +1,12 @@
|
|||||||
|
is_global = true
|
||||||
|
build_property.TargetFramework = netstandard2.0
|
||||||
|
build_property.TargetPlatformMinVersion = 7.0
|
||||||
|
build_property.UsingMicrosoftNETSdkWeb =
|
||||||
|
build_property.ProjectTypeGuids =
|
||||||
|
build_property.InvariantGlobalization =
|
||||||
|
build_property.PlatformNeutralAssembly =
|
||||||
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
|
build_property.RootNamespace = SourceGenerator
|
||||||
|
build_property.ProjectDir = E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\
|
||||||
|
build_property.EnableComHosting =
|
||||||
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
@@ -0,0 +1 @@
|
|||||||
|
ff752c9a870df6aafb4669266bbcfd2f80f90bfd76a1bae882d02d67457c3ec4
|
@@ -0,0 +1,32 @@
|
|||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.sourcelink.json
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||||
|
G:\github\TEngine\Tools\SourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||||
|
C:\Users\Admin\Downloads\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.deps.json
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.dll
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\bin\Debug\SourceGenerator.pdb
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.AssemblyReference.cache
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfoInputs.cache
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.AssemblyInfo.cs
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.csproj.CoreCompileInputs.cache
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.sourcelink.json
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.dll
|
||||||
|
E:\WorkSpace\ZGame\Tools\GameEventSourceGenerator\SourceGenerator\obj\Debug\SourceGenerator.pdb
|
@@ -0,0 +1 @@
|
|||||||
|
{"documents":{"E:\\WorkSpace\\ZGame\\*":"https://raw.githubusercontent.com/Alex-Rachel/ZGame/b7d75c0f6f518a5f2ca0ed9304411302709f8dbe/*"}}
|
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||||
|
"projectName": "SourceGenerator",
|
||||||
|
"projectPath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"netstandard2.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"netstandard2.0": {
|
||||||
|
"targetAlias": "netstandard2.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"netstandard2.0": {
|
||||||
|
"targetAlias": "netstandard2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CodeAnalysis.Analyzers": {
|
||||||
|
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
|
||||||
|
"suppressParent": "All",
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[3.3.3, )"
|
||||||
|
},
|
||||||
|
"Microsoft.CodeAnalysis.CSharp": {
|
||||||
|
"suppressParent": "All",
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[3.9.0, )"
|
||||||
|
},
|
||||||
|
"NETStandard.Library": {
|
||||||
|
"suppressParent": "All",
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[2.0.3, )",
|
||||||
|
"autoReferenced": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Admin\.nuget\packages\</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\Admin\.nuget\packages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.props')" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Admin\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3</PkgMicrosoft_CodeAnalysis_Analyzers>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||||
|
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.3\build\Microsoft.CodeAnalysis.Analyzers.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "YK6sSPNENOs=",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj",
|
||||||
|
"expectedPackageFiles": [
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.common\\3.9.0\\microsoft.codeanalysis.common.3.9.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.codeanalysis.csharp\\3.9.0\\microsoft.codeanalysis.csharp.3.9.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.buffers\\4.5.1\\system.buffers.4.5.1.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.collections.immutable\\5.0.0\\system.collections.immutable.5.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.numerics.vectors\\4.4.0\\system.numerics.vectors.4.4.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.reflection.metadata\\5.0.0\\system.reflection.metadata.5.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\5.0.0\\system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.text.encoding.codepages\\4.5.1\\system.text.encoding.codepages.4.5.1.nupkg.sha512",
|
||||||
|
"C:\\Users\\Admin\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512"
|
||||||
|
],
|
||||||
|
"logs": []
|
||||||
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
"restore":{"projectUniqueName":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj","projectName":"SourceGenerator","projectPath":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\SourceGenerator.csproj","outputPath":"E:\\WorkSpace\\ZGame\\Tools\\GameEventSourceGenerator\\SourceGenerator\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["netstandard2.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netstandard2.0":{"targetAlias":"netstandard2.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"netstandard2.0":{"targetAlias":"netstandard2.0","dependencies":{"Microsoft.CodeAnalysis.Analyzers":{"include":"Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive","suppressParent":"All","target":"Package","version":"[3.3.3, )"},"Microsoft.CodeAnalysis.CSharp":{"suppressParent":"All","target":"Package","version":"[3.9.0, )"},"NETStandard.Library":{"suppressParent":"All","target":"Package","version":"[2.0.3, )","autoReferenced":true}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.300\\RuntimeIdentifierGraph.json"}}
|
@@ -0,0 +1 @@
|
|||||||
|
17413576752312703
|
@@ -0,0 +1 @@
|
|||||||
|
17413576752312703
|
@@ -1 +0,0 @@
|
|||||||
目前使用luban-classic,请自行导入
|
|