Skip to content

Commit 5e74f4e

Browse files
committed
Merge remote-tracking branch 'origin/release8.1'
2 parents 10095da + a5b27b0 commit 5e74f4e

File tree

59 files changed

+315
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+315
-99
lines changed

Book/1.1运行指南.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@
33

44
**使用[Rider2023.3](https://www.jetbrains.com/zh-cn/rider/)**(更新到最新版),需要安装以下内容:
55
- 安装.Net8
6-
- 不支持VS,新人用VS搞出各种问题请不要来问我,我也没用过VS,后期搞熟了可以自己改用VS
6+
- 不支持VS,新人用VS搞出各种问题请不要来问我,我也没用过VS,后期搞熟了可以自己改用VS
77

8-
2. 该分支必须使用Unity**2022.3.15**(初学者请在此版本用熟后再切换其他版本)
8+
2. 该分支必须使用Unity**2022.3.15**(初学者请在此版本用熟后再切换其他版本)
9+
10+
3. 整个过程请开启全局翻墙,否则各种unity包 nuget包下载不下来,报memerypack等错误
911

10-
3. 启动UnityHub,打开(Open) -> 选中'ET/Unity'文件夹所在目录后打开工程
12+
4. 启动UnityHub,打开(Open) -> 选中'ET/Unity'文件夹所在目录后打开工程
1113

12-
4. 在Project视图中选中'Assets/Resources/GlobalConfig',把AppType选择成'**Demo(状态同步)**'或者'**LockStep(帧同步)**'
14+
5. 在Project视图中选中'Assets/Resources/GlobalConfig',把AppType选择成'**Demo(状态同步)**'或者'**LockStep(帧同步)**'
1315

14-
5. Assets/Resources/GlobalConfig CodeMode选择**Client Server**, 点击Unity菜单 -> ET -> Compile(或按快捷键**F6**)进行编译
16+
6. Assets/Resources/GlobalConfig CodeMode选择**Client Server** (Unity BuildSettings切换到Windows平台,其它平台不支持ClientServer模式), 点击Unity菜单 -> ET -> Compile(或按快捷键**F6**)进行编译
1517

16-
6. 打开ET.sln,**编译整个ET.sln**,注意要翻墙,否则可能nuget包下载不下来,导致编译出错(翻墙后如果还有报错解决不了可以尝试先用VS打开ET.sln编译一次后再回到Rider重新编译一次)
18+
7. 打开ET.sln,**编译整个ET.sln**,注意要翻墙,否则可能nuget包下载不下来,导致编译出错(翻墙后如果还有报错解决不了可以尝试先用VS打开ET.sln编译一次后再回到Rider重新编译一次)
1719

18-
7. Unity中双击'Assets/Scenes'目录中的**Init**场景,点击Play(▶)即可运行
20+
8. Unity中双击'Assets/Scenes'目录中的**Init**场景,点击Play(▶)即可运行
1921

20-
8. 帧同步默认是一个人匹配,如果需要多人匹配,修改**LSConstValue.cs**中的**MatchCount** 客户端服务端重启即可
22+
9. 帧同步默认是一个人匹配,如果需要多人匹配,修改**LSConstValue.cs**中的**MatchCount** 客户端服务端重启即可
2123

22-
9. 注意要独立启动服务器,右键UnityHub,以管理员身份运行UnityHub,然后启动Unity(没有管理员启动是不行的,因为服务端要开启http服务,普通权限开不了),
24+
10. 注意要独立启动服务器,右键UnityHub,以管理员身份运行UnityHub,然后启动Unity(没有管理员启动是不行的,因为服务端要开启http服务,普通权限开不了),
2325
停止Unity Play,点开Unity菜单->ET->Server Tools->Start Server(Single Process),这样就单独启动了服务端。打开Unity菜单 -> ET -> BuildTool中CodeMode改成Client,点击Unity Play,登录。
2426
如果还是连接不上报10037错误,注意看ET/Logs目录,看有没有Error日志。 如果要用rider启动服务器,rider也必须用管理员权限启动
2527
注意一定要用 netsh http delete urlacl 命令删除掉所有自己添加的urlacl,具体使用方法请谷歌
2628

27-
10. 有问题请论坛提问,贴出服务端error log跟客户端error log,没有日志无法回复
29+
11. 有问题请论坛提问,贴出服务端error log跟客户端error log,没有日志无法回复
2830

2931
# 打包过程
3032
1. 点击HybridCLR -> Installer,点击安装,等待安装完成
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System.Collections.Immutable;
2+
using Microsoft.CodeAnalysis;
3+
using Microsoft.CodeAnalysis.CSharp;
4+
using Microsoft.CodeAnalysis.CSharp.Syntax;
5+
using Microsoft.CodeAnalysis.Diagnostics;
6+
7+
namespace ET.Analyzer
8+
{
9+
[DiagnosticAnalyzer(LanguageNames.CSharp)]
10+
public class DisableNormalClassDeclaratonInModelAssemblyAnalyzer : DiagnosticAnalyzer
11+
{
12+
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(EntityClassDeclarationAnalyzerrRule.Rule);
13+
14+
public override void Initialize(AnalysisContext context)
15+
{
16+
if (!AnalyzerGlobalSetting.EnableAnalyzer)
17+
{
18+
return;
19+
}
20+
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
21+
context.EnableConcurrentExecution();
22+
context.RegisterCompilationStartAction(analysisContext =>
23+
{
24+
if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName, AnalyzeAssembly.AllModel))
25+
{
26+
analysisContext.RegisterSyntaxNodeAction(Analyze,SyntaxKind.ClassDeclaration);
27+
}
28+
});
29+
30+
}
31+
32+
private void Analyze(SyntaxNodeAnalysisContext context)
33+
{
34+
if (context.Node is not ClassDeclarationSyntax classDeclarationSyntax)
35+
{
36+
return;
37+
}
38+
39+
var namedTypeSymbol = context.SemanticModel.GetDeclaredSymbol(classDeclarationSyntax);
40+
41+
if (namedTypeSymbol==null)
42+
{
43+
return;
44+
}
45+
46+
if (namedTypeSymbol.IsStatic)
47+
{
48+
return;
49+
}
50+
51+
if (namedTypeSymbol.HasAttributeInTypeAndBaseTyes(Definition.EnableClassAttribute))
52+
{
53+
return;
54+
}
55+
56+
Diagnostic diagnostic = Diagnostic.Create(EntityClassDeclarationAnalyzerrRule.Rule, classDeclarationSyntax.Identifier.GetLocation(), namedTypeSymbol);
57+
context.ReportDiagnostic(diagnostic);
58+
}
59+
}
60+
}
61+

Share/Analyzer/Config/Definition.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public static class Definition
9494
public const string EntityWeakRefType = "EntityWeakRef";
9595

9696
public const string DisableNewAttribute = "ET.DisableNewAttribute";
97+
98+
public const string EnableClassAttribute = "ET.EnableClassAttribute";
9799
}
98100
}
99101

Share/Analyzer/Config/DiagnosticIds.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,7 @@ public static class DiagnosticIds
6464
public const string NetMessageAnalyzerRuleId = "ET0030";
6565

6666
public const string DisableNewAnalyzerRuleId = "ET0031";
67+
68+
public const string DisableNormalClassDeclaratonInModelAssemblyAnalyzerRuleId = "ET0032";
6769
}
6870
}

Share/Analyzer/Config/DiagnosticRules.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,22 @@ public static class DisableNewAnalyzerRule
468468
true,
469469
Description);
470470
}
471+
472+
public static class EntityClassDeclarationAnalyzerrRule
473+
{
474+
private const string Title = "Model/ModelView程序集禁止声明非实体类";
475+
476+
private const string MessageFormat = "Model/ModelView程序集禁止声明非Object类:{0}, 除非加上[EnableClass]";
477+
478+
private const string Description = "Model/ModelView程序集禁止声明非实体类, 除非加上[EnableClass] Attribute.";
479+
480+
public static readonly DiagnosticDescriptor Rule =
481+
new DiagnosticDescriptor(DiagnosticIds.DisableNormalClassDeclaratonInModelAssemblyAnalyzerRuleId,
482+
Title,
483+
MessageFormat,
484+
DiagnosticCategories.All,
485+
DiagnosticSeverity.Error,
486+
true,
487+
Description);
488+
}
471489
}

Share/Share.SourceGenerator/Generator/ETSystemGenerator/AttributeTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public AttributeTemplate()
1515
$attribute$
1616
public class $argsTypesUnderLine$_$methodName$System: $methodName$System<$argsTypes$>
1717
{
18-
protected override void $methodName$($argsTypesVars$)
18+
protected override $returnType$ $methodName$($argsTypesVars$)
1919
{
20-
$argsVars0$.$methodName$($argsVarsWithout0$);
20+
$return$$argsVars0$.$methodName$($argsVarsWithout0$);
2121
}
2222
}
2323
""");

Share/Share.SourceGenerator/Generator/ETSystemGenerator/ETSystemGenerator.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ public static partial class {{className}}
166166

167167
SpeicalProcessForArgs();
168168

169+
if (methodSymbol.ReturnType.ToDisplayString() == "void")
170+
{
171+
code = code.Replace("$returnType$", "void");
172+
code = code.Replace("$return$", "");
173+
}else{
174+
code = code.Replace("$returnType$", methodSymbol.ReturnType.ToDisplayString());
175+
code = code.Replace("$return$", "return ");
176+
}
177+
169178
code = code.Replace("$attribute$", attributeString);
170179
code = code.Replace("$attributeType$", attributeType);
171180
code = code.Replace("$methodName$", methodName);

Store/LubanExtension.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ET8-Luban
2+
基于ET8.1集成了功能更完善的Luban(新版)配置工具,导出时支持自定义数据校验,为上线项目配置的数据安全提供了足够的保障。
3+
4+
**使用方式**:点击'ET-BuildTool-ExcelExporter',实际开发时建议自行扩展成按快捷键调用ToolsEditor.ExcelExporter()
5+
6+
**项目链接**:[ET8-Luban](https://github.com/EP-Toushirou/ET8-Luban)

Store/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77

88
[Soft Router](https://gitee.com/wryl/router-et) 防攻击的软路由实现
99

10-
[BundleMaster](https://github.com/mister91jiao/BundleMaster) 基于ETTask的资源加载方案
10+
[BundleMaster](https://github.com/mister91jiao/BundleMaster) 基于ETTask的资源加载方案
11+
12+
[ET8-Luban](https://github.com/EP-Toushirou/ET8-Luban) 基于ET8.1集成了新版Luban配置工具
13+
14+
[ET-YIUI](https://github.com/LiShengYang-yiyi/YIUI) 符合ET设计 基于UGUI的框架

Store/YIUI.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# YIUI-ET
2+
3+
ET7.2 [详细查看7.2分支](https://github.com/LiShengYang-yiyi/YIUI/tree/YIUI-ET7.2)
4+
5+
ET8.0 [详细查看8.0分支](https://github.com/LiShengYang-yiyi/YIUI/tree/YIUI-ET8.0)
6+
7+
ET8.1 [详细查看8.1分支](https://github.com/LiShengYang-yiyi/YIUI/tree/YIUI-ET8.1)
8+
9+
# YIUI视频教程
10+
11+
[YIUI视频教程](https://www.bilibili.com/video/BV1cz4y1s7QS)
12+
13+
14+
0. 总览
15+
1. 安装
16+
2. 初始化项目
17+
3. 主入口
18+
4. Demo资源
19+
5. 登录界面
20+
6. CDE绑定功能
21+
7. 加载界面
22+
8. 主界面
23+
9. 商店界面
24+
10. 无限循环列表
25+
11. 英雄界面
26+
12. UI上显示3D模型
27+
13. 红点系统
28+
14. 多语言
29+
30+
# ET接入YIUI视频教程
31+
32+
[ET接入YIUI视频教程](https://www.bilibili.com/video/BV1s44y1F7aZ)
33+
34+
0. 准备工作
35+
1. 接入YIUI框架
36+
2. ET Core 文件的补充
37+
3. ET.shl 添加YIUI项目
38+
4. ET YIUI 程序集关联
39+
5. ET 生成器 分析器修改
40+
6. Loader 添加YIUI程序集
41+
7. YIUI初始化设置
42+
8. YooAsset设置
43+
9. 拷贝直接使用YIUI原生预制Demo
44+
10. 代码启动YIUI框架
45+
11. 打包设置
46+
47+
48+
#[YIUI-ET7.2 视频介绍](https://www.bilibili.com/video/BV1KC4y1d7NZ)
49+

Unity/Assets/Scripts/Core/Entity/EntitySystemSingleton.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void Awake()
1414

1515
foreach (Type type in CodeTypes.Instance.GetTypes(typeof (EntitySystemAttribute)))
1616
{
17-
object obj = Activator.CreateInstance(type);
17+
SystemObject obj = (SystemObject)Activator.CreateInstance(type);
1818

1919
if (obj is ISystemType iSystemType)
2020
{
@@ -36,7 +36,7 @@ public void Serialize(Entity component)
3636
return;
3737
}
3838

39-
List<object> iSerializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (ISerializeSystem));
39+
List<SystemObject> iSerializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (ISerializeSystem));
4040
if (iSerializeSystems == null)
4141
{
4242
return;
@@ -67,7 +67,7 @@ public void Deserialize(Entity component)
6767
return;
6868
}
6969

70-
List<object> iDeserializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem));
70+
List<SystemObject> iDeserializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem));
7171
if (iDeserializeSystems == null)
7272
{
7373
return;
@@ -94,7 +94,7 @@ public void Deserialize(Entity component)
9494
// GetComponentSystem
9595
public void GetComponentSys(Entity entity, Type type)
9696
{
97-
List<object> iGetSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IGetComponentSysSystem));
97+
List<SystemObject> iGetSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IGetComponentSysSystem));
9898
if (iGetSystem == null)
9999
{
100100
return;
@@ -120,7 +120,7 @@ public void GetComponentSys(Entity entity, Type type)
120120

121121
public void Awake(Entity component)
122122
{
123-
List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem));
123+
List<SystemObject> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem));
124124
if (iAwakeSystems == null)
125125
{
126126
return;
@@ -151,7 +151,7 @@ public void Awake<P1>(Entity component, P1 p1)
151151
return;
152152
}
153153

154-
List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1>));
154+
List<SystemObject> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1>));
155155
if (iAwakeSystems == null)
156156
{
157157
return;
@@ -182,7 +182,7 @@ public void Awake<P1, P2>(Entity component, P1 p1, P2 p2)
182182
return;
183183
}
184184

185-
List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2>));
185+
List<SystemObject> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2>));
186186
if (iAwakeSystems == null)
187187
{
188188
return;
@@ -213,7 +213,7 @@ public void Awake<P1, P2, P3>(Entity component, P1 p1, P2 p2, P3 p3)
213213
return;
214214
}
215215

216-
List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3>));
216+
List<SystemObject> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3>));
217217
if (iAwakeSystems == null)
218218
{
219219
return;
@@ -244,7 +244,7 @@ public void Destroy(Entity component)
244244
return;
245245
}
246246

247-
List<object> iDestroySystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDestroySystem));
247+
List<SystemObject> iDestroySystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDestroySystem));
248248
if (iDestroySystems == null)
249249
{
250250
return;

Unity/Assets/Scripts/Core/Entity/IAwakeSystem.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public interface IAwakeSystem<A, B, C, D>: ISystemType
4848
}
4949

5050
[EntitySystem]
51-
public abstract class AwakeSystem<T> : IAwakeSystem where T: Entity, IAwake
51+
public abstract class AwakeSystem<T> : SystemObject, IAwakeSystem where T: Entity, IAwake
5252
{
5353
Type ISystemType.Type()
5454
{
@@ -74,7 +74,7 @@ void IAwakeSystem.Run(Entity o)
7474
}
7575

7676
[EntitySystem]
77-
public abstract class AwakeSystem<T, A> : IAwakeSystem<A> where T: Entity, IAwake<A>
77+
public abstract class AwakeSystem<T, A> : SystemObject, IAwakeSystem<A> where T: Entity, IAwake<A>
7878
{
7979
Type ISystemType.Type()
8080
{
@@ -100,7 +100,7 @@ void IAwakeSystem<A>.Run(Entity o, A a)
100100
}
101101

102102
[EntitySystem]
103-
public abstract class AwakeSystem<T, A, B> : IAwakeSystem<A, B> where T: Entity, IAwake<A, B>
103+
public abstract class AwakeSystem<T, A, B> : SystemObject, IAwakeSystem<A, B> where T: Entity, IAwake<A, B>
104104
{
105105
Type ISystemType.Type()
106106
{
@@ -126,7 +126,7 @@ void IAwakeSystem<A, B>.Run(Entity o, A a, B b)
126126
}
127127

128128
[EntitySystem]
129-
public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem<A, B, C> where T: Entity, IAwake<A, B, C>
129+
public abstract class AwakeSystem<T, A, B, C> : SystemObject, IAwakeSystem<A, B, C> where T: Entity, IAwake<A, B, C>
130130
{
131131
Type ISystemType.Type()
132132
{
@@ -152,7 +152,7 @@ void IAwakeSystem<A, B, C>.Run(Entity o, A a, B b, C c)
152152
}
153153

154154
[EntitySystem]
155-
public abstract class AwakeSystem<T, A, B, C, D> : IAwakeSystem<A, B, C, D> where T: Entity, IAwake<A, B, C, D>
155+
public abstract class AwakeSystem<T, A, B, C, D> : SystemObject, IAwakeSystem<A, B, C, D> where T: Entity, IAwake<A, B, C, D>
156156
{
157157
Type ISystemType.Type()
158158
{

Unity/Assets/Scripts/Core/Entity/IDeserializeSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IDeserializeSystem: ISystemType
1616
/// </summary>
1717
/// <typeparam name="T"></typeparam>
1818
[EntitySystem]
19-
public abstract class DeserializeSystem<T> : IDeserializeSystem where T: Entity, IDeserialize
19+
public abstract class DeserializeSystem<T> : SystemObject, IDeserializeSystem where T: Entity, IDeserialize
2020
{
2121
void IDeserializeSystem.Run(Entity o)
2222
{

Unity/Assets/Scripts/Core/Entity/IDestroySystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IDestroySystem: ISystemType
1212
}
1313

1414
[EntitySystem]
15-
public abstract class DestroySystem<T> : IDestroySystem where T: Entity, IDestroy
15+
public abstract class DestroySystem<T> : SystemObject, IDestroySystem where T: Entity, IDestroy
1616
{
1717
void IDestroySystem.Run(Entity o)
1818
{

Unity/Assets/Scripts/Core/Entity/IGetComponentSysSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IGetComponentSysSystem: ISystemType
1616
}
1717

1818
[EntitySystem]
19-
public abstract class GetComponentSysSystem<T> : IGetComponentSysSystem where T: Entity, IGetComponentSys
19+
public abstract class GetComponentSysSystem<T> : SystemObject, IGetComponentSysSystem where T: Entity, IGetComponentSys
2020
{
2121
void IGetComponentSysSystem.Run(Entity o, Type type)
2222
{

0 commit comments

Comments
 (0)