Преглед изворни кода

用Source generator来生成各种system

tanghai пре 2 година
родитељ
комит
e108432cb1
100 измењених фајлова са 572 додато и 1146 уклоњено
  1. 40 0
      Share/Share.SourceGenerator/Generator/ETSystemGenerator/AttributeTemplate.cs
  2. 93 57
      Share/Share.SourceGenerator/Generator/ETSystemGenerator/ETSystemGenerator.cs
  3. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/BaseAttribute.cs
  4. 0 2
      Unity/Assets/Scripts/Core/Module/EventSystem/EntitySystemAttribute.cs
  5. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs
  6. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/EnterMapHelper.cs
  7. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/LoginHelper.cs
  8. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/MoveHelper.cs
  9. 12 15
      Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs
  10. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/HttpClientHelper.cs
  11. 2 9
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterAddressComponentSystem.cs
  12. 5 5
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs
  13. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs
  14. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs
  15. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs
  16. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitFactory.cs
  17. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitHelper.cs
  18. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs
  19. 6 15
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs
  20. 1 9
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs
  21. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  22. 2 18
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs
  23. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/HttpHelper.cs
  24. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/MessageHelper.cs
  25. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/SceneFactory.cs
  26. 5 7
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Benchmark/BenchmarkClientComponentSystem.cs
  27. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/GateSessionKeyComponentSystem.cs
  28. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/PlayerComponentSystem.cs
  29. 3 6
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/PlayerSystem.cs
  30. 11 15
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/SessionPlayerComponentSystem.cs
  31. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Move/MoveHelper.cs
  32. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Transfer/TransferHelper.cs
  33. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Unit/UnitFactory.cs
  34. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Unit/UnitHelper.cs
  35. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Realm/RealmGateAddressHelper.cs
  36. 5 8
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotCaseSystem.cs
  37. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotManagerComponentSystem.cs
  38. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/Scene/RobotSceneFactory.cs
  39. 7 11
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Watcher/WatcherComponentSystem.cs
  40. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Watcher/WatcherHelper.cs
  41. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomManagerComponentSystem.cs
  42. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs
  43. 4 7
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs
  44. 1 10
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs
  45. 1 9
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs
  46. 3 19
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIEntitySystem.cs
  47. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIHelper.cs
  48. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs
  49. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs
  50. 1 9
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/CellSystem.cs
  51. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorHandleHelper.cs
  52. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorHelper.cs
  53. 4 28
      Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorMessageDispatcherComponentSystem.cs
  54. 2 18
      Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorMessageSenderComponentSystem.cs
  55. 3 32
      Unity/Assets/Scripts/Hotfix/Server/Module/Actor/MailBoxComponentSystem.cs
  56. 4 35
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  57. 3 17
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs
  58. 6 35
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs
  59. 6 12
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs
  60. 3 10
      Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs
  61. 5 11
      Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs
  62. 5 28
      Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs
  63. 1 25
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetInnerComponentSystem.cs
  64. 1 17
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs
  65. 5 11
      Unity/Assets/Scripts/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs
  66. 2 26
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs
  67. 1 17
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterNodeSystem.cs
  68. 1 1
      Unity/Assets/Scripts/Hotfix/Share/ConstValue.cs
  69. 1 9
      Unity/Assets/Scripts/Hotfix/Share/LockStep/LSInputComponentSystem.cs
  70. 1 1
      Unity/Assets/Scripts/Hotfix/Share/LockStep/LSUnitFactory.cs
  71. 1 1
      Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs
  72. 1 17
      Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIComponentSystem.cs
  73. 2 26
      Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIDispatcherComponentSystem.cs
  74. 9 19
      Unity/Assets/Scripts/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs
  75. 4 28
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/MessageDispatcherComponentSystem.cs
  76. 4 20
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  77. 2 18
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs
  78. 3 18
      Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs
  79. 4 6
      Unity/Assets/Scripts/Hotfix/Share/Module/Recast/NavmeshComponentSystem.cs
  80. 1 17
      Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs
  81. 5 11
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ClientSceneManagerComponentSystem.cs
  82. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs
  83. 5 11
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs
  84. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Unit/UnitComponentSystem.cs
  85. 3 3
      Unity/Assets/Scripts/Hotfix/Share/Module/Unit/UnitSystem.cs
  86. 22 28
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  87. 5 8
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs
  88. 8 11
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs
  89. 8 27
      Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/AnimatorComponentSystem.cs
  90. 3 6
      Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/GameObjectComponentSystem.cs
  91. 3 19
      Unity/Assets/Scripts/HotfixView/Client/LockStep/Camera/LSCameraComponentSystem.cs
  92. 8 27
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSAnimatorComponentSystem.cs
  93. 24 27
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSOperaComponentSystem.cs
  94. 13 16
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs
  95. 14 25
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewSystem.cs
  96. 12 15
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs
  97. 8 11
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs
  98. 46 49
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomComponentSystem.cs
  99. 61 65
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIEventComponentSystem.cs
  100. 2 18
      Unity/Assets/Scripts/Model/Share/Module/Console/ModeContex.cs

+ 40 - 0
Share/Share.SourceGenerator/Generator/ETSystemGenerator/AttributeTemplate.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+
+namespace ET.Generator
+{
+
+    public class AttributeTemplate
+    {
+        private Dictionary<string, string> templates = new Dictionary<string, string>();
+
+        public AttributeTemplate()
+        {
+            this.templates.Add("EntitySystem", $$"""
+        $attribute$
+                public class $argsTypesUnderLine$_$methodName$System: $methodName$System<$argsTypes$>
+                {   
+                    protected override void $methodName$($argsTypeVars$)
+                    {
+                        self.$methodName$($argsVars$);
+                    }
+                }
+        """);
+        }
+
+        public string Get(string attributeType)
+        {
+            if (!this.templates.TryGetValue(attributeType, out string template))
+            {
+                throw new Exception($"not config template: {attributeType}");
+            }
+
+            if (template == null)
+            {
+                throw new Exception($"not config template: {attributeType}");
+            }
+
+            return template;
+        }
+    }
+}

+ 93 - 57
Share/Share.SourceGenerator/Generator/ETSystemGenerator/ETSystemGenerator.cs

@@ -1,41 +1,47 @@
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using ET.Analyzer;
 using Microsoft.CodeAnalysis;
 using Microsoft.CodeAnalysis.CSharp.Syntax;
+
 namespace ET.Generator;
 
 [Generator(LanguageNames.CSharp)]
-public class ETSystemGenerator : ISourceGenerator
+public class ETSystemGenerator: ISourceGenerator
 {
+    private AttributeTemplate? templates;
+
     public void Initialize(GeneratorInitializationContext context)
     {
+        this.templates = new AttributeTemplate();
         context.RegisterForSyntaxNotifications(SyntaxContextReceiver.Create);
     }
 
     public void Execute(GeneratorExecutionContext context)
     {
-        if (context.SyntaxContextReceiver is not SyntaxContextReceiver receiver || receiver.MethodDeclarations.Count==0)
+        if (context.SyntaxContextReceiver is not SyntaxContextReceiver receiver || receiver.MethodDeclarations.Count == 0)
         {
             return;
         }
 
         foreach (var kv in receiver.MethodDeclarations)
         {
-            this.GenerateCSFiles(kv.Key,kv.Value,context);
+            this.GenerateCSFiles(kv.Key, kv.Value, context);
         }
     }
 
     /// <summary>
     /// 每个静态类生成一个cs文件
     /// </summary>
-    private void GenerateCSFiles(ClassDeclarationSyntax classDeclarationSyntax, HashSet<MethodDeclarationSyntax>methodDeclarationSyntaxes,GeneratorExecutionContext context)
+    private void GenerateCSFiles(ClassDeclarationSyntax classDeclarationSyntax, HashSet<MethodDeclarationSyntax> methodDeclarationSyntaxes,
+    GeneratorExecutionContext context)
     {
-        var className = classDeclarationSyntax.Identifier.Text;
-        var semanticModel = context.Compilation.GetSemanticModel(classDeclarationSyntax.SyntaxTree);
-        var classTypeSymbol = semanticModel.GetDeclaredSymbol(classDeclarationSyntax) as INamedTypeSymbol;
-        if (classTypeSymbol==null)
+        string className = classDeclarationSyntax.Identifier.Text;
+        SemanticModel semanticModel = context.Compilation.GetSemanticModel(classDeclarationSyntax.SyntaxTree);
+        INamedTypeSymbol? classTypeSymbol = semanticModel.GetDeclaredSymbol(classDeclarationSyntax) as INamedTypeSymbol;
+        if (classTypeSymbol == null)
         {
             return;
         }
@@ -47,9 +53,9 @@ public class ETSystemGenerator : ISourceGenerator
             context.ReportDiagnostic(diagnostic);
             return;
         }
-        
-        var namespaceSymbol = classTypeSymbol?.ContainingNamespace;
-        var namespaceName = namespaceSymbol?.Name;
+
+        INamespaceSymbol? namespaceSymbol = classTypeSymbol?.ContainingNamespace;
+        string? namespaceName = namespaceSymbol?.Name;
         while (namespaceSymbol?.ContainingNamespace != null)
         {
             namespaceSymbol = namespaceSymbol.ContainingNamespace;
@@ -57,110 +63,140 @@ public class ETSystemGenerator : ISourceGenerator
             {
                 break;
             }
+
             namespaceName = $"{namespaceSymbol.Name}.{namespaceName}";
         }
-        
-        var inClassSb = new StringBuilder();
 
-        this.GenerateSystemCodeByTemplate(inClassSb, classDeclarationSyntax, methodDeclarationSyntaxes, context,semanticModel);
-        string code = $$"""
-namespace {{namespaceName}}{
-    public static partial class {{className}}
-    {
-{{inClassSb}}
-    }
-}
-""";
-        context.AddSource($"{namespaceName}.{className}.g.cs",code);
+        if (namespaceName == null)
+        {
+            throw new Exception($"{className} namespace is null");
+        }
+
+        this.GenerateSystemCodeByTemplate(namespaceName, className, classDeclarationSyntax, methodDeclarationSyntaxes, context, semanticModel);
     }
 
     /// <summary>
     /// 根据模板生成System代码
     /// </summary>
-    private void GenerateSystemCodeByTemplate(StringBuilder inClassSb,ClassDeclarationSyntax classDeclarationSyntax, HashSet<MethodDeclarationSyntax>methodDeclarationSyntaxes,GeneratorExecutionContext context, SemanticModel semanticModel)
+    private void GenerateSystemCodeByTemplate(string namespaceName, string className, ClassDeclarationSyntax classDeclarationSyntax,
+    HashSet<MethodDeclarationSyntax> methodDeclarationSyntaxes, GeneratorExecutionContext context, SemanticModel semanticModel)
     {
-        foreach (var methodDeclarationSyntax in methodDeclarationSyntaxes)
+        if (this.templates == null)
+        {
+            throw new Exception("attribute template is null");
+        }
+        
+        foreach (MethodDeclarationSyntax? methodDeclarationSyntax in methodDeclarationSyntaxes)
         {
-            var methodSymbol = semanticModel.GetDeclaredSymbol(methodDeclarationSyntax) as IMethodSymbol;
-            if (methodSymbol==null)
+            IMethodSymbol? methodSymbol = semanticModel.GetDeclaredSymbol(methodDeclarationSyntax) as IMethodSymbol;
+            if (methodSymbol == null)
             {
                 continue;
             }
-            var componentParam = methodDeclarationSyntax.ParameterList.Parameters.FirstOrDefault();
-            if (componentParam==null)
+
+            ParameterSyntax? componentParam = methodDeclarationSyntax.ParameterList.Parameters.FirstOrDefault();
+            if (componentParam == null)
             {
                 continue;
             }
-            
-            var methodName = methodDeclarationSyntax.Identifier.Text;
-            var componentName = componentParam.Type?.ToString();
-            
-            var argsTypes = new StringBuilder();
+
+            string methodName = methodDeclarationSyntax.Identifier.Text;
+            string? componentName = componentParam.Type?.ToString();
+
+            StringBuilder argsTypes = new StringBuilder();
             for (int i = 0; i < methodSymbol.Parameters.Length; i++)
             {
                 argsTypes.Append(i == 0? $"{methodSymbol.Parameters[i].Type}" : $",{methodSymbol.Parameters[i].Type}");
             }
 
-            var argsTypeVars = new StringBuilder();
+            StringBuilder argsTypeVars = new StringBuilder();
             for (int i = 0; i < methodSymbol.Parameters.Length; i++)
             {
                 argsTypeVars.Append(i == 0? $"{methodSymbol.Parameters[i].Type} self" : $",{methodSymbol.Parameters[i].Type} args{i}");
             }
 
-            var argsVars = new StringBuilder();
-            if (methodSymbol.Parameters.Length>1)
+            StringBuilder argsVars = new StringBuilder();
+            if (methodSymbol.Parameters.Length > 1)
             {
                 for (int i = 1; i < methodSymbol.Parameters.Length; i++)
                 {
                     argsVars.Append(i == 1? $"args1" : $",args{i}");
                 }
             }
-            
-            inClassSb.AppendLine($$"""
-        public class {{componentName}}{{methodName}}System: {{methodName}}System<{{argsTypes}}>
-        {   
-            protected override void {{methodName}}({{argsTypeVars}})
+
+            foreach (AttributeListSyntax attributeListSyntax in methodDeclarationSyntax.AttributeLists)
             {
-                self.{{methodName}}({{argsVars}});
+                AttributeSyntax? attribute = attributeListSyntax.Attributes.FirstOrDefault();
+                if (attribute == null)
+                {
+                    continue;
+                }
+
+                string attributeType = attribute.Name.ToString();
+                string attributeString = $"[{attribute.ToString()}]";
+                    
+                string template = this.templates.Get(attributeType);
+                    
+                string code = $$"""
+namespace {{namespaceName}}
+{
+    public static partial class {{className}}
+    {
+        {{template}}
+    }
+}
+""";
+
+                string argsTypesString = argsTypes.ToString();
+                string argsTypesUnderLine = argsTypesString.Replace(",", "_").Replace(".", "_");
+                code = code.Replace("$attribute$", attributeString);
+                code = code.Replace("$attributeType$", attributeType);
+                code = code.Replace("$methodName$", methodName);
+                code = code.Replace("entityType", componentName);
+                code = code.Replace("$argsTypes$", argsTypesString);
+                code = code.Replace("$argsTypesUnderLine$", argsTypesUnderLine);
+                code = code.Replace("$argsVars$", argsVars.ToString());
+                code = code.Replace("$argsTypeVars$", argsTypeVars.ToString());
+                
+                string fileName = $"{namespaceName}.{className}.{methodName}.{argsTypesUnderLine}.g.cs";
+                
+                context.AddSource(fileName, code);
             }
         }
-""");
-        }
     }
-    
-    class SyntaxContextReceiver : ISyntaxContextReceiver
+
+    class SyntaxContextReceiver: ISyntaxContextReceiver
     {
         internal static ISyntaxContextReceiver Create()
         {
             return new SyntaxContextReceiver();
         }
 
-        public Dictionary<ClassDeclarationSyntax, HashSet<MethodDeclarationSyntax>> MethodDeclarations { get; } = new ();
-        
+        public Dictionary<ClassDeclarationSyntax, HashSet<MethodDeclarationSyntax>> MethodDeclarations { get; } = new();
 
         public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
         {
-            var node = context.Node;
+            SyntaxNode node = context.Node;
             if (node is not MethodDeclarationSyntax methodDeclarationSyntax)
             {
                 return;
             }
+
             if (methodDeclarationSyntax.AttributeLists.Count == 0)
             {
                 return;
             }
-            
-            var attr = methodDeclarationSyntax.AttributeLists.SelectMany(x => x.Attributes)
-                    .FirstOrDefault(x=>x.Name.ToString()=="EntitySystem");
+
+            AttributeSyntax? attr = methodDeclarationSyntax.AttributeLists.SelectMany(x => x.Attributes)
+                    .FirstOrDefault(x => x.Name.ToString() == "EntitySystem");
             if (attr == null)
             {
                 return;
             }
 
-            var parentClass = methodDeclarationSyntax.GetParentClassDeclaration();
-            if (parentClass==null)
+            ClassDeclarationSyntax? parentClass = methodDeclarationSyntax.GetParentClassDeclaration();
+            if (parentClass == null)
             {
-                
                 return;
             }
 
@@ -168,7 +204,7 @@ namespace {{namespaceName}}{
             {
                 MethodDeclarations[parentClass] = new HashSet<MethodDeclarationSyntax>();
             }
-            
+
             MethodDeclarations[parentClass].Add(methodDeclarationSyntax);
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/BaseAttribute.cs

@@ -2,7 +2,7 @@
 
 namespace ET
 {
-	[AttributeUsage(AttributeTargets.Class)]
+	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
 	public class BaseAttribute: Attribute
 	{
 	}

+ 0 - 2
Unity/Assets/Scripts/Core/Module/EventSystem/EntitySystemAttribute.cs

@@ -2,12 +2,10 @@
 
 namespace ET
 {
-	[AttributeUsage(AttributeTargets.Class)]
 	public class SystemAttribute: BaseAttribute
 	{
 	}
 	
-	[AttributeUsage(AttributeTargets.Class)]
 	public class EntitySystemAttribute: SystemAttribute
 	{
 	}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs

@@ -3,7 +3,7 @@ using Unity.Mathematics;
 namespace ET.Client
 {
     [FriendOf(typeof(XunLuoPathComponent))]
-    public static class XunLuoPathComponentSystem
+    public static partial class XunLuoPathComponentSystem
     {
         public static float3 GetCurrent(this XunLuoPathComponent self)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Login/EnterMapHelper.cs

@@ -3,7 +3,7 @@ using System;
 
 namespace ET.Client
 {
-    public static class EnterMapHelper
+    public static partial class EnterMapHelper
     {
         public static async ETTask EnterMapAsync(Scene clientScene)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Login/LoginHelper.cs

@@ -4,7 +4,7 @@ using System.Net.Sockets;
 
 namespace ET.Client
 {
-    public static class LoginHelper
+    public static partial class LoginHelper
     {
         public static async ETTask Login(Scene clientScene, string account, string password)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Move/MoveHelper.cs

@@ -4,7 +4,7 @@ using Unity.Mathematics;
 
 namespace ET.Client
 {
-    public static class MoveHelper
+    public static partial class MoveHelper
     {
         // 可以多次调用,多次调用的话会取消上一次的协程
         public static async ETTask<int> MoveToAsync(this Unit unit, float3 targetPos, ETCancellationToken cancellationToken = null)

+ 12 - 15
Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs

@@ -2,15 +2,21 @@ using System;
 
 namespace ET.Client
 {
-    [EntitySystem]
-    public class PingComponentAwakeSystem: AwakeSystem<PingComponent>
+    public static partial class PingComponentSystem
     {
-        protected override void Awake(PingComponent self)
+        [EntitySystem]
+        private static void Awake(this PingComponent self)
         {
-            PingAsync(self).Coroutine();
+            self.PingAsync().Coroutine();
         }
-
-        private static async ETTask PingAsync(PingComponent self)
+        
+        [EntitySystem]
+        private static void Destroy(this PingComponent self)
+        {
+            self.Ping = default;
+        }
+        
+        private static async ETTask PingAsync(this PingComponent self)
         {
             Session session = self.GetParent<Session>();
             long instanceId = self.InstanceId;
@@ -55,13 +61,4 @@ namespace ET.Client
             }
         }
     }
-
-    [EntitySystem]
-    public class PingComponentDestroySystem: DestroySystem<PingComponent>
-    {
-        protected override void Destroy(PingComponent self)
-        {
-            self.Ping = default;
-        }
-    }
 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/HttpClientHelper.cs

@@ -4,7 +4,7 @@ using System.Net.Http;
 
 namespace ET.Client
 {
-    public static class HttpClientHelper
+    public static partial class HttpClientHelper
     {
         public static async ETTask<string> Get(string link)
         {

+ 2 - 9
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterAddressComponentSystem.cs

@@ -6,16 +6,9 @@ using System.Net.Sockets;
 namespace ET.Client
 {
     [FriendOf(typeof(RouterAddressComponent))]
-    public static class RouterAddressComponentSystem
+    public static partial class RouterAddressComponentSystem
     {
-        public class RouterAddressComponentAwakeSystem: AwakeSystem<RouterAddressComponent, string, int>
-        {
-            protected override void Awake(RouterAddressComponent self, string address, int port)
-            {
-                self.Awake(address, port);
-            }
-        }
-
+        [EntitySystem]
         private static void Awake(this RouterAddressComponent self, string address, int port)
         {
             self.RouterManagerHost = address;

+ 5 - 5
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs

@@ -3,15 +3,15 @@ using System.Net;
 
 namespace ET.Client
 {
-    [EntitySystem]
-    public class RouterCheckComponentAwakeSystem: AwakeSystem<RouterCheckComponent>
+    public static partial class RouterCheckComponentSystem
     {
-        protected override void Awake(RouterCheckComponent self)
+        [EntitySystem]
+        private static void Awake(this RouterCheckComponent self)
         {
-            CheckAsync(self).Coroutine();
+            self.CheckAsync().Coroutine();
         }
 
-        private static async ETTask CheckAsync(RouterCheckComponent self)
+        private static async ETTask CheckAsync(this RouterCheckComponent self)
         {
             Session session = self.GetParent<Session>();
             long instanceId = self.InstanceId;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs

@@ -4,7 +4,7 @@ using System.Net.Sockets;
 
 namespace ET.Client
 {
-    public static class RouterHelper
+    public static partial class RouterHelper
     {
         // 注册router
         public static async ETTask<Session> CreateRouterSession(Scene clientScene, IPEndPoint address)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs

@@ -1,6 +1,6 @@
 namespace ET.Client
 {
-    public static class SceneChangeHelper
+    public static partial class SceneChangeHelper
     {
         // 场景切换协程
         public static async ETTask SceneChangeTo(Scene clientScene, string sceneName, long sceneInstanceId)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs

@@ -2,7 +2,7 @@ using System.Net.Sockets;
 
 namespace ET.Client
 {
-    public static class SceneFactory
+    public static partial class SceneFactory
     {
         public static async ETTask<Scene> CreateClientScene(int zone, SceneType sceneType, string name)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitFactory.cs

@@ -2,7 +2,7 @@
 
 namespace ET.Client
 {
-    public static class UnitFactory
+    public static partial class UnitFactory
     {
         public static Unit Create(Scene currentScene, UnitInfo unitInfo)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitHelper.cs

@@ -1,6 +1,6 @@
 namespace ET.Client
 {
-    public static class UnitHelper
+    public static partial class UnitHelper
     {
         public static Unit GetMyUnitFromClientScene(Scene clientScene)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs

@@ -3,7 +3,7 @@ using ET.Client;
 
 namespace ET
 {
-    public static class LSClientHelper
+    public static partial class LSClientHelper
     {
         public static void RunRollbackSystem(Entity entity)
         {

+ 6 - 15
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs

@@ -4,25 +4,16 @@ using System.IO;
 namespace ET.Client
 {
     [FriendOf(typeof (LSClientUpdater))]
-    public static class LSClientUpdaterSystem
+    public static partial class LSClientUpdaterSystem
     {
-        public class AwakeSystem: AwakeSystem<LSClientUpdater>
+        [EntitySystem]
+        private static void Awake(this LSClientUpdater self)
         {
-            protected override void Awake(LSClientUpdater self)
-            {
-                Room room = self.GetParent<Room>();
-                self.MyId = room.GetParent<Scene>().GetComponent<PlayerComponent>().MyId;
-            }
+            Room room = self.GetParent<Room>();
+            self.MyId = room.GetParent<Scene>().GetComponent<PlayerComponent>().MyId;
         }
         
-        public class UpdateSystem: UpdateSystem<LSClientUpdater>
-        {
-            protected override void Update(LSClientUpdater self)
-            {
-                self.Update();
-            }
-        }
-
+        [EntitySystem]
         private static void Update(this LSClientUpdater self)
         {
             Room room = self.GetParent<Room>();

+ 1 - 9
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs

@@ -3,17 +3,9 @@ using System;
 namespace ET.Client
 {
     [FriendOf(typeof(LSReplayUpdater))]
-    public static class LSReplayComponentSystem
+    public static partial class LSReplayComponentSystem
     {
         [EntitySystem]
-        public class UpdateSystem: UpdateSystem<LSReplayUpdater>
-        {
-            protected override void Update(LSReplayUpdater self)
-            {
-                self.Update();
-            }
-        }
-
         private static void Update(this LSReplayUpdater self)
         {
             Room room = self.GetParent<Room>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs

@@ -1,7 +1,7 @@
 namespace ET.Client
 {
 
-    public static class LSSceneChangeHelper
+    public static partial class LSSceneChangeHelper
     {
         // 场景切换协程
         public static async ETTask SceneChangeTo(Scene clientScene, string sceneName, long sceneInstanceId)

+ 2 - 18
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs

@@ -4,26 +4,9 @@ using System.Net.Sockets;
 namespace ET.Client
 {
     [FriendOf(typeof(NetClientComponent))]
-    public static class NetClientComponentSystem
+    public static partial class NetClientComponentSystem
     {
         [EntitySystem]
-        public class AwakeSystem: AwakeSystem<NetClientComponent, AddressFamily>
-        {
-            protected override void Awake(NetClientComponent self, AddressFamily addressFamily)
-            {
-                self.Awake(addressFamily);
-            }
-        }
-
-        [EntitySystem]
-        public class DestroySystem: DestroySystem<NetClientComponent>
-        {
-            protected override void Destroy(NetClientComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this NetClientComponent self, AddressFamily addressFamily)
         {
             self.ServiceId = NetServices.Instance.AddService(new KService(addressFamily, ServiceType.Outer));
@@ -31,6 +14,7 @@ namespace ET.Client
             NetServices.Instance.RegisterErrorCallback(self.ServiceId, self.OnError);
         }
         
+        [EntitySystem]
         private static void Destroy(this NetClientComponent self)
         {
             NetServices.Instance.RemoveService(self.ServiceId);

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/HttpHelper.cs

@@ -3,7 +3,7 @@ using System.Text;
 
 namespace ET.Server
 {
-    public static class HttpHelper
+    public static partial class HttpHelper
     {
         public static void Response(HttpListenerContext context, object response)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/MessageHelper.cs

@@ -5,7 +5,7 @@ using System.IO;
 
 namespace ET.Server
 {
-    public static class MessageHelper
+    public static partial class MessageHelper
     {
         public static void NoticeUnitAdd(Unit unit, Unit sendUnit)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/SceneFactory.cs

@@ -3,7 +3,7 @@ using System.Net.Sockets;
 
 namespace ET.Server
 {
-    public static class SceneFactory
+    public static partial class SceneFactory
     {
         public static async ETTask<Scene> CreateServerScene(Entity parent, long id, long instanceId, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null)
         {

+ 5 - 7
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Benchmark/BenchmarkClientComponentSystem.cs

@@ -4,16 +4,14 @@ using ET.Client;
 
 namespace ET.Server
 {
-    public static class BenchmarkClientComponentSystem
+    public static partial class BenchmarkClientComponentSystem
     {
-        public class AwakeSystem: AwakeSystem<BenchmarkClientComponent>
+        [EntitySystem]
+        private static void Awake(this BenchmarkClientComponent self)
         {
-            protected override void Awake(BenchmarkClientComponent self)
+            for (int i = 0; i < 50; ++i)
             {
-                for (int i = 0; i < 50; ++i)
-                {
-                    self.Start().Coroutine();
-                }
+                self.Start().Coroutine();
             }
         }
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/GateSessionKeyComponentSystem.cs

@@ -1,7 +1,7 @@
 namespace ET.Server
 {
     [FriendOf(typeof(GateSessionKeyComponent))]
-    public static class GateSessionKeyComponentSystem
+    public static partial class GateSessionKeyComponentSystem
     {
         public static void Add(this GateSessionKeyComponent self, long key, string account)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/PlayerComponentSystem.cs

@@ -3,7 +3,7 @@
 namespace ET.Server
 {
     [FriendOf(typeof(PlayerComponent))]
-    public static class PlayerComponentSystem
+    public static partial class PlayerComponentSystem
     {
         public static void Add(this PlayerComponent self, Player player)
         {

+ 3 - 6
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/PlayerSystem.cs

@@ -1,15 +1,12 @@
 namespace ET.Server
 {
     [FriendOf(typeof(Player))]
-    public static class PlayerSystem
+    public static partial class PlayerSystem
     {
         [EntitySystem]
-        public class PlayerAwakeSystem : AwakeSystem<Player, string>
+        private static void Awake(this Player self, string a)
         {
-            protected override void Awake(Player self, string a)
-            {
-                self.Account = a;
-            }
+            self.Account = a;
         }
     }
 }

+ 11 - 15
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/SessionPlayerComponentSystem.cs

@@ -1,16 +1,12 @@
-
-
-namespace ET.Server
+namespace ET.Server
 {
-	public static class SessionPlayerComponentSystem
-	{
-		public class SessionPlayerComponentDestroySystem: DestroySystem<SessionPlayerComponent>
-		{
-			protected override void Destroy(SessionPlayerComponent self)
-			{
-				// 发送断线消息
-				ActorLocationSenderComponent.Instance?.Get(LocationType.Unit)?.Send(self.Player.Id, new G2M_SessionDisconnect());
-			}
-		}
-	}
-}
+    public static partial class SessionPlayerComponentSystem
+    {
+        [EntitySystem]
+        private static void Destroy(this SessionPlayerComponent self)
+        {
+            // 发送断线消息
+            ActorLocationSenderComponent.Instance?.Get(LocationType.Unit)?.Send(self.Player.Id, new G2M_SessionDisconnect());
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Move/MoveHelper.cs

@@ -3,7 +3,7 @@ using Unity.Mathematics;
 
 namespace ET.Server
 {
-    public static class MoveHelper
+    public static partial class MoveHelper
     {
         // 可以多次调用,多次调用的话会取消上一次的协程
         public static async ETTask FindPathMoveToAsync(this Unit unit, float3 target)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Transfer/TransferHelper.cs

@@ -3,7 +3,7 @@ using MongoDB.Bson;
 
 namespace ET.Server
 {
-    public static class TransferHelper
+    public static partial class TransferHelper
     {
         public static async ETTask TransferAtFrameFinish(Unit unit, long sceneInstanceId, string sceneName)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Unit/UnitFactory.cs

@@ -3,7 +3,7 @@ using Unity.Mathematics;
 
 namespace ET.Server
 {
-    public static class UnitFactory
+    public static partial class UnitFactory
     {
         public static Unit Create(Scene scene, long id, UnitType unitType)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Unit/UnitHelper.cs

@@ -5,7 +5,7 @@ namespace ET.Server
 {
     [FriendOf(typeof(MoveComponent))]
     [FriendOf(typeof(NumericComponent))]
-    public static class UnitHelper
+    public static partial class UnitHelper
     {
         public static UnitInfo CreateUnitInfo(Unit unit)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Realm/RealmGateAddressHelper.cs

@@ -3,7 +3,7 @@
 
 namespace ET.Server
 {
-	public static class RealmGateAddressHelper
+	public static partial class RealmGateAddressHelper
 	{
 		public static StartSceneConfig GetGate(int zone, string account)
 		{

+ 5 - 8
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotCaseSystem.cs

@@ -3,20 +3,17 @@ using System.Collections.Generic;
 
 namespace ET.Server
 {
-    public static class RobotCaseSystem
+    public static partial class RobotCaseSystem
     {
         [EntitySystem]
-        public class RobotCaseDestroySystem: DestroySystem<RobotCase>
+        private static void Destroy(this RobotCase self)
         {
-            protected override void Destroy(RobotCase self)
+            foreach (long id in self.Scenes)
             {
-                foreach (long id in self.Scenes)
-                {
-                    ClientSceneManagerComponent.Instance.Remove(id);
-                }
+                ClientSceneManagerComponent.Instance.Remove(id);
             }
         }
-        
+
         // 创建机器人,生命周期是RobotCase
         public static async ETTask NewRobot(this RobotCase self, int count, List<Scene> scenes)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotManagerComponentSystem.cs

@@ -3,7 +3,7 @@ using System.Linq;
 
 namespace ET.Server
 {
-    public static class RobotManagerComponentSystem
+    public static partial class RobotManagerComponentSystem
     {
         public static async ETTask<Scene> NewRobot(this RobotManagerComponent self, int zone)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/Scene/RobotSceneFactory.cs

@@ -1,6 +1,6 @@
 namespace ET.Server
 {
-    public static class RobotSceneFactory
+    public static partial class RobotSceneFactory
     {
         public static async ETTask<Scene> Create(
             Entity parent,

+ 7 - 11
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Watcher/WatcherComponentSystem.cs

@@ -4,22 +4,18 @@ using System.Diagnostics;
 namespace ET.Server
 {
     [FriendOf(typeof(WatcherComponent))]
-    public static class WatcherComponentSystem
+    public static partial class WatcherComponentSystem
     {
-        public class WatcherComponentAwakeSystem: AwakeSystem<WatcherComponent>
+        [EntitySystem]
+        private static void Awake(this WatcherComponent self)
         {
-            protected override void Awake(WatcherComponent self)
-            {
-                WatcherComponent.Instance = self;
-            }
+            WatcherComponent.Instance = self;
         }
     
-        public class WatcherComponentDestroySystem: DestroySystem<WatcherComponent>
+        [EntitySystem]
+        private static void Destroy(this WatcherComponent self)
         {
-            protected override void Destroy(WatcherComponent self)
-            {
-                WatcherComponent.Instance = null;
-            }
+            WatcherComponent.Instance = null;
         }
         
         public static void Start(this WatcherComponent self, int createScenes = 0)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Watcher/WatcherHelper.cs

@@ -4,7 +4,7 @@ using System.Diagnostics;
 
 namespace ET.Server
 {
-    public static class WatcherHelper
+    public static partial class WatcherHelper
     {
         public static StartMachineConfig GetThisMachineConfig()
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomManagerComponentSystem.cs

@@ -3,7 +3,7 @@ using System;
 namespace ET.Server
 {
 
-    public static class RoomManagerComponentSystem
+    public static partial class RoomManagerComponentSystem
     {
         public static async ETTask<Room> CreateServerRoom(this RoomManagerComponent self, Match2Map_GetRoom request)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs

@@ -1,7 +1,7 @@
 namespace ET.Server
 {
 
-    public static class RoomMessageHelper
+    public static partial class RoomMessageHelper
     {
         public static void BroadCast(Room room, IActorMessage message)
         {

+ 4 - 7
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs

@@ -3,17 +3,14 @@ using System;
 namespace ET.Server
 {
     [FriendOf(typeof(RoomServerComponent))]
-    public static class RoomServerComponentSystem
+    public static partial class RoomServerComponentSystem
     {
         [EntitySystem]
-        public class RoomServerComponentAwakeSystem: AwakeSystem<RoomServerComponent, Match2Map_GetRoom>
+        private static void Awake(this RoomServerComponent self, Match2Map_GetRoom match2MapGetRoom)
         {
-            protected override void Awake(RoomServerComponent self, Match2Map_GetRoom match2MapGetRoom)
+            foreach (long id in match2MapGetRoom.PlayerIds)
             {
-                foreach (long id in match2MapGetRoom.PlayerIds)
-                {
-                    RoomPlayer roomPlayer = self.AddChildWithId<RoomPlayer>(id);
-                }
+                RoomPlayer roomPlayer = self.AddChildWithId<RoomPlayer>(id);
             }
         }
 

+ 1 - 10
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs

@@ -5,17 +5,8 @@ namespace ET.Server
 {
 
     [FriendOf(typeof(MatchComponent))]
-    public static class MatchComponentSystem
+    public static partial class MatchComponentSystem
     {
-        [EntitySystem]
-        public class AwakeSystem: AwakeSystem<MatchComponent>
-        {
-            protected override void Awake(MatchComponent self)
-            {
-                
-            }
-        }
-
         public static async ETTask Match(this MatchComponent self, long playerId)
         {
             if (self.waitMatchPlayers.Contains(playerId))

+ 1 - 9
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs

@@ -4,17 +4,9 @@ using System.Collections.Generic;
 namespace ET.Server
 {
     [FriendOf(typeof(LSServerUpdater))]
-    public static class LSServerUpdaterSystem
+    public static partial class LSServerUpdaterSystem
     {
         [EntitySystem]
-        public class UpdateSystem: UpdateSystem<LSServerUpdater>
-        {
-            protected override void Update(LSServerUpdater self)
-            {
-                self.Update();
-            }
-        }
-        
         private static void Update(this LSServerUpdater self)
         {
             Room room = self.GetParent<Room>();

+ 3 - 19
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIEntitySystem.cs

@@ -4,32 +4,16 @@ using Unity.Mathematics;
 namespace ET.Server
 {
     [FriendOf(typeof(AOIEntity))]
-    public static class AOIEntitySystem2
+    public static partial class AOIEntitySystem2
     {
         [EntitySystem]
-        public class AwakeSystem: AwakeSystem<AOIEntity, int, float3>
-        {
-            protected override void Awake(AOIEntity self, int distance, float3 pos)
-            {
-                self.Awake(distance, pos);
-            }
-        }
-
-        [EntitySystem]
-        public class DestroySystem: DestroySystem<AOIEntity>
-        {
-            protected override void Destroy(AOIEntity self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this AOIEntity self, int distance, float3 pos)
         {
             self.ViewDistance = distance;
             self.DomainScene().GetComponent<AOIManagerComponent>().Add(self, pos.x, pos.z);
         }
         
+        [EntitySystem]
         private static void Destroy(this AOIEntity self)
         {
             self.DomainScene().GetComponent<AOIManagerComponent>()?.Remove(self);
@@ -45,7 +29,7 @@ namespace ET.Server
     
     [FriendOf(typeof(AOIEntity))]
     [FriendOf(typeof(Cell))]
-    public static class AOIEntitySystem
+    public static partial class AOIEntitySystem
     {
         // 获取在自己视野中的对象
         public static Dictionary<long, AOIEntity> GetSeeUnits(this AOIEntity self)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIHelper.cs

@@ -3,7 +3,7 @@
 namespace ET.Server
 {
     [FriendOf(typeof(AOIEntity))]
-    public static class AOIHelper
+    public static partial class AOIHelper
     {
         public static long CreateCellId(int x, int y)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs

@@ -5,7 +5,7 @@ namespace ET.Server
     [FriendOf(typeof(AOIManagerComponent))]
     [FriendOf(typeof(AOIEntity))]
     [FriendOf(typeof(Cell))]
-    public static class AOIManagerComponentSystem
+    public static partial class AOIManagerComponentSystem
     {
         public static void Add(this AOIManagerComponent self, AOIEntity aoiEntity, float x, float y)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs

@@ -1,6 +1,6 @@
 namespace ET.Server
 {
-    public static class AOISeeCheckHelper
+    public static partial class AOISeeCheckHelper
     {
         public static bool IsCanSee(AOIEntity a, AOIEntity b)
         {

+ 1 - 9
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/CellSystem.cs

@@ -4,17 +4,9 @@ using System.Text;
 namespace ET.Server
 {
     [FriendOf(typeof(Cell))]
-    public static class CellSystem
+    public static partial class CellSystem
     {
         [EntitySystem]
-        public class CellDestroySystem: DestroySystem<Cell>
-        {
-            protected override void Destroy(Cell self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this Cell self)
         {
             self.AOIUnits.Clear();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorHandleHelper.cs

@@ -2,7 +2,7 @@
 
 namespace ET.Server
 {
-    public static class ActorHandleHelper
+    public static partial class ActorHandleHelper
     {
         public static void Reply(int fromProcess, IActorResponse response)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorHelper.cs

@@ -3,7 +3,7 @@ using System.IO;
 
 namespace ET.Server
 {
-    public static class ActorHelper
+    public static partial class ActorHelper
     {
         public static IActorResponse CreateResponse(IActorRequest iActorRequest, int error)
         {

+ 4 - 28
Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorMessageDispatcherComponentSystem.cs

@@ -7,47 +7,23 @@ namespace ET.Server
     /// Actor消息分发组件
     /// </summary>
     [FriendOf(typeof(ActorMessageDispatcherComponent))]
-    public static class ActorMessageDispatcherComponentHelper
+    public static partial class ActorMessageDispatcherComponentHelper
     {
         [EntitySystem]
-        public class ActorMessageDispatcherComponentAwakeSystem: AwakeSystem<ActorMessageDispatcherComponent>
-        {
-            protected override void Awake(ActorMessageDispatcherComponent self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class ActorMessageDispatcherComponentLoadSystem: LoadSystem<ActorMessageDispatcherComponent>
-        {
-            protected override void Load(ActorMessageDispatcherComponent self)
-            {
-                self.Load();
-            }
-        }
-
-        [EntitySystem]
-        public class ActorMessageDispatcherComponentDestroySystem: DestroySystem<ActorMessageDispatcherComponent>
-        {
-            protected override void Destroy(ActorMessageDispatcherComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this ActorMessageDispatcherComponent self)
         {
             ActorMessageDispatcherComponent.Instance = self;
             self.Load();
         }
         
+        [EntitySystem]
         private static void Destroy(this ActorMessageDispatcherComponent self)
         {
             self.ActorMessageHandlers.Clear();
             ActorMessageDispatcherComponent.Instance = null;
         }
-
+        
+        [EntitySystem]
         private static void Load(this ActorMessageDispatcherComponent self)
         {
             self.ActorMessageHandlers.Clear();

+ 2 - 18
Unity/Assets/Scripts/Hotfix/Server/Module/Actor/ActorMessageSenderComponentSystem.cs

@@ -4,7 +4,7 @@ using System.IO;
 namespace ET.Server
 {
     [FriendOf(typeof(ActorMessageSenderComponent))]
-    public static class ActorMessageSenderComponentSystem
+    public static partial class ActorMessageSenderComponentSystem
     {
         [Invoke(TimerInvokeType.ActorMessageSenderChecker)]
         public class ActorMessageSenderChecker: ATimer<ActorMessageSenderComponent>
@@ -23,23 +23,6 @@ namespace ET.Server
         }
     
         [EntitySystem]
-        public class ActorMessageSenderComponentAwakeSystem: AwakeSystem<ActorMessageSenderComponent>
-        {
-            protected override void Awake(ActorMessageSenderComponent self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class ActorMessageSenderComponentDestroySystem: DestroySystem<ActorMessageSenderComponent>
-        {
-            protected override void Destroy(ActorMessageSenderComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this ActorMessageSenderComponent self)
         {
             ActorMessageSenderComponent.Instance = self;
@@ -47,6 +30,7 @@ namespace ET.Server
             self.TimeoutCheckTimer = TimerComponent.Instance.NewRepeatedTimer(1000, TimerInvokeType.ActorMessageSenderChecker, self);
         }
         
+        [EntitySystem]
         private static void Destroy(this ActorMessageSenderComponent self)
         {
             ActorMessageSenderComponent.Instance = null;

+ 3 - 32
Unity/Assets/Scripts/Hotfix/Server/Module/Actor/MailBoxComponentSystem.cs

@@ -3,46 +3,17 @@ using System;
 namespace ET.Server
 {
     [FriendOf(typeof(MailBoxComponent))]
-    public static class MailBoxComponentSystem
+    public static partial class MailBoxComponentSystem
     {
-        public class MailBoxComponentAwakeSystem: AwakeSystem<MailBoxComponent>
-        {
-            protected override void Awake(MailBoxComponent self)
-            {
-                self.Awake();
-            }
-        }
-        
-        private static void Awake(this MailBoxComponent self)
-        {
-            self.MailboxType = MailboxType.MessageDispatcher;
-            self.ParentInstanceId = self.Parent.InstanceId;
-            ActorMessageDispatcherComponent.Instance.Add(self.Parent);
-        }
-
-        public class MailBoxComponentAwake1System: AwakeSystem<MailBoxComponent, MailboxType>
-        {
-            protected override void Awake(MailBoxComponent self, MailboxType mailboxType)
-            {
-                self.Awake(mailboxType);
-            }
-        }
-        
+        [EntitySystem]       
         private static void Awake(this MailBoxComponent self, MailboxType mailboxType)
         {
             self.MailboxType = mailboxType;
             self.ParentInstanceId = self.Parent.InstanceId;
             ActorMessageDispatcherComponent.Instance.Add(self.Parent);
         }
-
-        public class DestroySystem: DestroySystem<MailBoxComponent>
-        {
-            protected override void Destroy(MailBoxComponent self)
-            {
-                self.Destroy();
-            }
-        }
         
+        [EntitySystem]
         private static void Destroy(this MailBoxComponent self)
         {
             ActorMessageDispatcherComponent.Instance?.Remove(self.ParentInstanceId);

+ 4 - 35
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -6,7 +6,7 @@ namespace ET.Server
 {
     [FriendOf(typeof(ActorLocationSenderOneType))]
     [FriendOf(typeof(ActorLocationSender))]
-    public static class ActorLocationSenderComponentSystem
+    public static partial class ActorLocationSenderComponentSystem
     {
         [Invoke(TimerInvokeType.ActorLocationSenderChecker)]
         public class ActorLocationSenderChecker: ATimer<ActorLocationSenderOneType>
@@ -24,22 +24,7 @@ namespace ET.Server
             }
         }
     
-        public class AwakeSystem: AwakeSystem<ActorLocationSenderOneType, int>
-        {
-            protected override void Awake(ActorLocationSenderOneType self, int locationType)
-            {
-                self.Awake(locationType);
-            }
-        }
-
-        public class DestroySystem: DestroySystem<ActorLocationSenderOneType>
-        {
-            protected override void Destroy(ActorLocationSenderOneType self)
-            {
-                self.Destroy();
-            }
-        }
-        
+        [EntitySystem]
         private static void Awake(this ActorLocationSenderOneType self, int locationType)
         {
             self.LocationType = locationType;
@@ -48,6 +33,7 @@ namespace ET.Server
             self.CheckTimer = TimerComponent.Instance.NewRepeatedTimer(10 * 1000, TimerInvokeType.ActorLocationSenderChecker, self);
         }
         
+        [EntitySystem]
         private static void Destroy(this ActorLocationSenderOneType self)
         {
             TimerComponent.Instance?.Remove(ref self.CheckTimer);
@@ -293,26 +279,9 @@ namespace ET.Server
     }
 
     [FriendOf(typeof (ActorLocationSenderComponent))]
-    public static class ActorLocationSenderManagerComponentSystem
+    public static partial class ActorLocationSenderManagerComponentSystem
     {
         [EntitySystem]
-        public class AwakeSystem: AwakeSystem<ActorLocationSenderComponent>
-        {
-            protected override void Awake(ActorLocationSenderComponent self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class DestroySystem: DestroySystem<ActorLocationSenderComponent>
-        {
-            protected override void Destroy(ActorLocationSenderComponent self)
-            {
-                ActorLocationSenderComponent.Instance = null;
-            }
-        }
-        
         private static void Awake(this ActorLocationSenderComponent self)
         {
             ActorLocationSenderComponent.Instance = self;

+ 3 - 17
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs

@@ -3,24 +3,9 @@ using System;
 namespace ET.Server
 {
     [FriendOf(typeof(ActorLocationSender))]
-    public static class ActorLocationSenderSystem
+    public static partial class ActorLocationSenderSystem
     {
-        public class ActorLocationSenderAwakeSystem: AwakeSystem<ActorLocationSender>
-        {
-            protected override void Awake(ActorLocationSender self)
-            {
-                self.Awake();
-            }
-        }
-
-        public class ActorLocationSenderDestroySystem: DestroySystem<ActorLocationSender>
-        {
-            protected override void Destroy(ActorLocationSender self)
-            {
-                self.Destroy();
-            }
-        }
-        
+        [EntitySystem]
         private static void Awake(this ActorLocationSender self)
         {
             self.LastSendOrRecvTime = TimeHelper.ServerNow();
@@ -28,6 +13,7 @@ namespace ET.Server
             self.Error = 0;
         }
         
+        [EntitySystem]
         private static void Destroy(this ActorLocationSender self)
         {
             Log.Debug($"actor location remove: {self.Id}");

+ 6 - 35
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs

@@ -3,30 +3,16 @@
 namespace ET.Server
 {
     [FriendOf(typeof(LockInfo))]
-    public static class LockInfoSystem
+    public static partial class LockInfoSystem
     {
-        public class LockInfoAwakeSystem: AwakeSystem<LockInfo, long, CoroutineLock>
-        {
-            protected override void Awake(LockInfo self, long lockInstanceId, CoroutineLock coroutineLock)
-            {
-                self.Awake(lockInstanceId, coroutineLock);
-            }
-        }
-    
-        public class LockInfoDestroySystem: DestroySystem<LockInfo>
-        {
-            protected override void Destroy(LockInfo self)
-            {
-                self.Destroy();
-            }
-        }
-        
+        [EntitySystem]
         private static void Awake(this LockInfo self, long lockInstanceId, CoroutineLock coroutineLock)
         {
             self.CoroutineLock = coroutineLock;
             self.LockInstanceId = lockInstanceId;
         }
         
+        [EntitySystem]
         private static void Destroy(this LockInfo self)
         {
             self.CoroutineLock.Dispose();
@@ -38,17 +24,9 @@ namespace ET.Server
     
     [FriendOf(typeof(LocationOneType))]
     [FriendOf(typeof(LockInfo))]
-    public static class LocationOneTypeSystem
+    public static partial class LocationOneTypeSystem
     {
         [EntitySystem]
-        public class LocationOneTypeAwakeSystem: AwakeSystem<LocationOneType, int>
-        {
-            protected override void Awake(LocationOneType self, int locationType)
-            {
-                self.Awake(locationType);
-            }
-        }
-        
         private static void Awake(this LocationOneType self, int locationType)
         {
             self.LocationType = locationType;
@@ -139,16 +117,9 @@ namespace ET.Server
 
 
     [FriendOf(typeof (LocationManagerComoponent))]
-    public static class LocationComoponentSystem
+    public static partial class LocationComoponentSystem
     {
-        public class AwakeSystem: AwakeSystem<LocationManagerComoponent>
-        {
-            protected override void Awake(LocationManagerComoponent self)
-            {
-                self.Awake();
-            }
-        }
-        
+        [EntitySystem]
         private static void Awake(this LocationManagerComoponent self)
         {
             for (int i = 0; i < self.LocationOneTypes.Length; ++i)

+ 6 - 12
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs

@@ -2,26 +2,20 @@
 
 namespace ET.Server
 {
-    [EntitySystem]
-    public class LocationProxyComponentAwakeSystem: AwakeSystem<LocationProxyComponent>
+    public static partial class LocationProxyComponentSystem
     {
-        protected override void Awake(LocationProxyComponent self)
+        [EntitySystem]
+        private static void Awake(this LocationProxyComponent self)
         {
             LocationProxyComponent.Instance = self;
         }
-    }
     
-    [EntitySystem]
-    public class LocationProxyComponentDestroySystem: DestroySystem<LocationProxyComponent>
-    {
-        protected override void Destroy(LocationProxyComponent self)
+        [EntitySystem]
+        private static void Destroy(this LocationProxyComponent self)
         {
             LocationProxyComponent.Instance = null;
         }
-    }
-
-    public static class LocationProxyComponentSystem
-    {
+        
         private static long GetLocationSceneId(long key)
         {
             return StartSceneConfigCategory.Instance.LocationConfig.InstanceId;

+ 3 - 10
Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs

@@ -6,17 +6,10 @@ using MongoDB.Driver;
 namespace ET.Server
 {
 	[FriendOf(typeof(DBComponent))]
-    public static class DBComponentSystem
+    public static partial class DBComponentSystem
     {
-	    public class DBComponentAwakeSystem : AwakeSystem<DBComponent, string, string, int>
-	    {
-			protected override void Awake(DBComponent self, string dbConnection, string dbName, int zone)
-		    {
-			    self.Awake(dbConnection, dbName, zone);
-		    }
-	    }
-		
-		private static void Awake(this DBComponent self, string dbConnection, string dbName, int zone)
+	    [EntitySystem]
+	    private static void Awake(this DBComponent self, string dbConnection, string dbName, int zone)
 		{
 			self.mongoClient = new MongoClient(dbConnection);
 			self.database = self.mongoClient.GetDatabase(dbName);

+ 5 - 11
Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs

@@ -3,24 +3,18 @@
 namespace ET.Server
 {
     [FriendOf(typeof(DBManagerComponent))]
-    public static class DBManagerComponentSystem
+    public static partial class DBManagerComponentSystem
     {
         [EntitySystem]
-        public class DBManagerComponentAwakeSystem: AwakeSystem<DBManagerComponent>
+        private static void Awake(this DBManagerComponent self)
         {
-            protected override void Awake(DBManagerComponent self)
-            {
-                DBManagerComponent.Instance = self;
-            }
+            DBManagerComponent.Instance = self;
         }
 
         [EntitySystem]
-        public class DBManagerComponentDestroySystem: DestroySystem<DBManagerComponent>
+        private static void Destroy(this DBManagerComponent self)
         {
-            protected override void Destroy(DBManagerComponent self)
-            {
-                DBManagerComponent.Instance = null;
-            }
+            DBManagerComponent.Instance = null;
         }
         
         public static DBComponent GetZoneDB(this DBManagerComponent self, int zone)

+ 5 - 28
Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs

@@ -5,16 +5,9 @@ using System.Net;
 namespace ET.Server
 {
     [FriendOf(typeof(HttpComponent))]
-    public static class HttpComponentSystem
+    public static partial class HttpComponentSystem
     {
-        public class HttpComponentAwakeSystem : AwakeSystem<HttpComponent, string>
-        {
-            protected override void Awake(HttpComponent self, string address)
-            {
-                self.Awake(address);
-            }
-        }
-        
+        [EntitySystem]
         private static void Awake(this HttpComponent self, string address)
         {
             try
@@ -41,31 +34,15 @@ namespace ET.Server
                 throw new Exception($"请先在cmd中运行: netsh http add urlacl url=http://*:你的address中的端口/ user=Everyone, address: {address}", e);
             }
         }
-
-        [EntitySystem]
-        public class HttpComponentLoadSystem: LoadSystem<HttpComponent>
-        {
-            protected override void Load(HttpComponent self)
-            {
-                self.Load();
-            }
-        }
-
-        [EntitySystem]
-        public class HttpComponentDestroySystem: DestroySystem<HttpComponent>
-        {
-            protected override void Destroy(HttpComponent self)
-            {
-                self.Destroy();
-            }
-        }
         
+        [EntitySystem]
         private static void Destroy(this HttpComponent self)
         {
             self.Listener.Stop();
             self.Listener.Close();
         }
-
+        
+        [EntitySystem]
         private static void Load(this HttpComponent self)
         {
             self.dispatcher = new Dictionary<string, IHttpHandler>();

+ 1 - 25
Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetInnerComponentSystem.cs

@@ -4,17 +4,9 @@ using System.Net.Sockets;
 namespace ET.Server
 {
     [FriendOf(typeof(NetInnerComponent))]
-    public static class NetInnerComponentSystem
+    public static partial class NetInnerComponentSystem
     {
         [EntitySystem]
-        public class NetInnerComponentAwakeSystem: AwakeSystem<NetInnerComponent>
-        {
-            protected override void Awake(NetInnerComponent self)
-            {
-                self.Awake();
-            }
-        }
-        
         private static void Awake(this NetInnerComponent self)
         {
             NetInnerComponent.Instance = self;
@@ -38,14 +30,6 @@ namespace ET.Server
         }
 
         [EntitySystem]
-        public class NetInnerComponentAwake1System: AwakeSystem<NetInnerComponent, IPEndPoint>
-        {
-            protected override void Awake(NetInnerComponent self, IPEndPoint address)
-            {
-                self.Awake(address);
-            }
-        }
-        
         private static void Awake(this NetInnerComponent self, IPEndPoint address)
         {
             NetInnerComponent.Instance = self;
@@ -70,14 +54,6 @@ namespace ET.Server
         }
 
         [EntitySystem]
-        public class NetInnerComponentDestroySystem: DestroySystem<NetInnerComponent>
-        {
-            protected override void Destroy(NetInnerComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this NetInnerComponent self)
         {
             NetServices.Instance.RemoveService(self.ServiceId);

+ 1 - 17
Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs

@@ -3,17 +3,9 @@
 namespace ET.Server
 {
     [FriendOf(typeof(NetServerComponent))]
-    public static class NetServerComponentSystem
+    public static partial class NetServerComponentSystem
     {
         [EntitySystem]
-        public class AwakeSystem: AwakeSystem<NetServerComponent, IPEndPoint>
-        {
-            protected override void Awake(NetServerComponent self, IPEndPoint address)
-            {
-                self.Awake(address);
-            }
-        }
-        
         private static void Awake(this NetServerComponent self, IPEndPoint address)
         {
             self.ServiceId = NetServices.Instance.AddService(new KService(address, ServiceType.Outer));
@@ -23,14 +15,6 @@ namespace ET.Server
         }
 
         [EntitySystem]
-        public class NetKcpComponentDestroySystem: DestroySystem<NetServerComponent>
-        {
-            protected override void Destroy(NetServerComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this NetServerComponent self)
         {
             NetServices.Instance.RemoveService(self.ServiceId);

+ 5 - 11
Unity/Assets/Scripts/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs

@@ -4,24 +4,18 @@ using System.Collections.Generic;
 namespace ET.Server
 {
     [FriendOf(typeof(RobotCaseComponent))]
-    public static class RobotCaseComponentSystem
+    public static partial class RobotCaseComponentSystem
     {
         [EntitySystem]
-        public class RobotCaseComponentAwakeSystem: AwakeSystem<RobotCaseComponent>
+        private static void Awake(this RobotCaseComponent self)
         {
-            protected override void Awake(RobotCaseComponent self)
-            {
-                RobotCaseComponent.Instance = self;
-            }
+            RobotCaseComponent.Instance = self;
         }
 
         [EntitySystem]
-        public class RobotCaseComponentDestroySystem: DestroySystem<RobotCaseComponent>
+        private static void Destroy(this RobotCaseComponent self)
         {
-            protected override void Destroy(RobotCaseComponent self)
-            {
-                RobotCaseComponent.Instance = null;
-            }
+            RobotCaseComponent.Instance = null;
         }
         
         public static int GetN(this RobotCaseComponent self)

+ 2 - 26
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs

@@ -7,17 +7,9 @@ namespace ET.Server
 {
     [FriendOf(typeof (RouterComponent))]
     [FriendOf(typeof (RouterNode))]
-    public static class RouterComponentSystem
+    public static partial class RouterComponentSystem
     {
         [EntitySystem]
-        public class RouterComponentAwakeSystem: AwakeSystem<RouterComponent, IPEndPoint, string>
-        {
-            protected override void Awake(RouterComponent self, IPEndPoint outerAddress, string innerIP)
-            {
-                self.Awake(outerAddress, innerIP);
-            }
-        }
-        
         private static void Awake(this RouterComponent self, IPEndPoint outerAddress, string innerIP)
         {
             self.OuterSocket = new Socket(outerAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
@@ -40,16 +32,8 @@ namespace ET.Server
             NetworkHelper.SetSioUdpConnReset(self.OuterSocket);
             NetworkHelper.SetSioUdpConnReset(self.InnerSocket);
         }
-
-        [EntitySystem]
-        public class RouterComponentDestroySystem: DestroySystem<RouterComponent>
-        {
-            protected override void Destroy(RouterComponent self)
-            {
-                self.Destroy();
-            }
-        }
         
+        [EntitySystem]
         private static void Destroy(this RouterComponent self)
         {
             self.OuterSocket.Dispose();
@@ -59,14 +43,6 @@ namespace ET.Server
         }
 
         [EntitySystem]
-        public class RouterComponentUpdateSystem: UpdateSystem<RouterComponent>
-        {
-            protected override void Update(RouterComponent self)
-            {
-                self.Update();
-            }
-        }
-        
         private static void Update(this RouterComponent self)
         {
             long timeNow = TimeHelper.ClientNow();

+ 1 - 17
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterNodeSystem.cs

@@ -1,17 +1,9 @@
 namespace ET.Server
 {
     [FriendOf(typeof(RouterNode))]
-    public static class RouterNodeSystem
+    public static partial class RouterNodeSystem
     {
         [EntitySystem]
-        public class RouterNodeAwakeSystem: AwakeSystem<RouterNode>
-        {
-            protected override void Awake(RouterNode self)
-            {
-                self.Awake();
-            }
-        }
-        
         private static void Awake(this RouterNode self)
         {
             long timeNow = TimeHelper.ServerNow();
@@ -25,14 +17,6 @@
         }
 
         [EntitySystem]
-        public class RouterNodeDestroySystem: DestroySystem<RouterNode>
-        {
-            protected override void Destroy(RouterNode self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this RouterNode self)
         {
             self.OuterConn = 0;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/ConstValue.cs

@@ -1,6 +1,6 @@
 namespace ET
 {
-    public static class ConstValue
+    public static partial class ConstValue
     {
         public const string RouterHttpHost = "127.0.0.1";
         public const int RouterHttpPort = 30300;

+ 1 - 9
Unity/Assets/Scripts/Hotfix/Share/LockStep/LSInputComponentSystem.cs

@@ -4,17 +4,9 @@ using TrueSync;
 
 namespace ET
 {
-    public static class LSInputComponentSystem
+    public static partial class LSInputComponentSystem
     {
         [EntitySystem]
-        public class LSUpdateSystem: LSUpdateSystem<LSInputComponent>
-        {
-            protected override void LSUpdate(LSInputComponent self)
-            {
-                self.LSUpdate();
-            }
-        }
-
         public static void LSUpdate(this LSInputComponent self)
         {
             LSUnit unit = self.GetParent<LSUnit>();

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/LockStep/LSUnitFactory.cs

@@ -1,6 +1,6 @@
 namespace ET
 {
-    public static class LSUnitFactory
+    public static partial class LSUnitFactory
     {
         public static LSUnit Init(LSWorld lsWorld, LockStepUnitInfo unitInfo)
         {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs

@@ -5,7 +5,7 @@ using System.IO;
 namespace ET
 {
     [FriendOf(typeof(Room))]
-    public static class RoomSystem
+    public static partial class RoomSystem
     {
         public static Room Room(this Entity entity)
         {

+ 1 - 17
Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIComponentSystem.cs

@@ -4,7 +4,7 @@ namespace ET
 {
     [FriendOf(typeof(AIComponent))]
     [FriendOf(typeof(AIDispatcherComponent))]
-    public static class AIComponentSystem
+    public static partial class AIComponentSystem
     {
         [Invoke(TimerInvokeType.AITimer)]
         public class AITimer: ATimer<AIComponent>
@@ -23,14 +23,6 @@ namespace ET
         }
     
         [EntitySystem]
-        public class AIComponentAwakeSystem: AwakeSystem<AIComponent, int>
-        {
-            protected override void Awake(AIComponent self, int aiConfigId)
-            {
-                self.Awake(aiConfigId);
-            }
-        }
-        
         private static void Awake(this AIComponent self, int aiConfigId)
         {
             self.AIConfigId = aiConfigId;
@@ -38,14 +30,6 @@ namespace ET
         }
 
         [EntitySystem]
-        public class AIComponentDestroySystem: DestroySystem<AIComponent>
-        {
-            protected override void Destroy(AIComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this AIComponent self)
         {
             TimerComponent.Instance?.Remove(ref self.Timer);

+ 2 - 26
Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIDispatcherComponentSystem.cs

@@ -3,17 +3,9 @@ using System;
 namespace ET
 {
     [FriendOf(typeof(AIDispatcherComponent))]
-    public static class AIDispatcherComponentSystem
+    public static partial class AIDispatcherComponentSystem
     {
         [EntitySystem]
-        public class AIDispatcherComponentAwakeSystem: AwakeSystem<AIDispatcherComponent>
-        {
-            protected override void Awake(AIDispatcherComponent self)
-            {
-                self.Awake();
-            }
-        }
-        
         private static void Awake(this AIDispatcherComponent self)
         {
             AIDispatcherComponent.Instance = self;
@@ -21,29 +13,13 @@ namespace ET
         }
 
         [EntitySystem]
-        public class AIDispatcherComponentLoadSystem: LoadSystem<AIDispatcherComponent>
-        {
-            protected override void Load(AIDispatcherComponent self)
-            {
-                self.Load();
-            }
-        }
-
-        [EntitySystem]
-        public class AIDispatcherComponentDestroySystem: DestroySystem<AIDispatcherComponent>
-        {
-            protected override void Destroy(AIDispatcherComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this AIDispatcherComponent self)
         {
             self.AIHandlers.Clear();
             AIDispatcherComponent.Instance = null;
         }
         
+        [EntitySystem]
         private static void Load(this AIDispatcherComponent self)
         {
             self.AIHandlers.Clear();

+ 9 - 19
Unity/Assets/Scripts/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs

@@ -7,29 +7,19 @@ namespace ET
 {
     [FriendOf(typeof(ConsoleComponent))]
     [FriendOf(typeof(ModeContex))]
-    public static class ConsoleComponentSystem
+    public static partial class ConsoleComponentSystem
     {
         [EntitySystem]
-        public class ConsoleComponentAwakeSystem: AwakeSystem<ConsoleComponent>
+        private static void Awake(this ConsoleComponent self)
         {
-            protected override void Awake(ConsoleComponent self)
-            {
-                self.Load();
-            
-                self.Start().Coroutine();
-            }
+            self.Load();
+        
+            self.Start().Coroutine();
         }
 
-        [EntitySystem]
-        public class ConsoleComponentLoadSystem: LoadSystem<ConsoleComponent>
-        {
-            protected override void Load(ConsoleComponent self)
-            {
-                self.Load();
-            }
-        }
         
-        public static void Load(this ConsoleComponent self)
+        [EntitySystem]
+        private static void Load(this ConsoleComponent self)
         {
             self.Handlers.Clear();
 
@@ -55,8 +45,8 @@ namespace ET
                 self.Handlers.Add(consoleHandlerAttribute.Mode, iConsoleHandler);
             }
         }
-        
-        public static async ETTask Start(this ConsoleComponent self)
+
+        private static async ETTask Start(this ConsoleComponent self)
         {
             self.CancellationTokenSource = new CancellationTokenSource();
 

+ 4 - 28
Unity/Assets/Scripts/Hotfix/Share/Module/Message/MessageDispatcherComponentSystem.cs

@@ -7,47 +7,23 @@ namespace ET
     /// 消息分发组件
     /// </summary>
     [FriendOf(typeof(MessageDispatcherComponent))]
-    public static class MessageDispatcherComponentHelper
+    public static partial class MessageDispatcherComponentHelper
     {
         [EntitySystem]
-        public class MessageDispatcherComponentAwakeSystem: AwakeSystem<MessageDispatcherComponent>
-        {
-            protected override void Awake(MessageDispatcherComponent self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class MessageDispatcherComponentLoadSystem: LoadSystem<MessageDispatcherComponent>
-        {
-            protected override void Load(MessageDispatcherComponent self)
-            {
-                self.Load();
-            }
-        }
-
-        [EntitySystem]
-        public class MessageDispatcherComponentDestroySystem: DestroySystem<MessageDispatcherComponent>
-        {
-            protected override void Destroy(MessageDispatcherComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this MessageDispatcherComponent self)
         {
             MessageDispatcherComponent.Instance = self;
             self.Load();
         }
         
+        [EntitySystem]
         private static void Destroy(this MessageDispatcherComponent self)
         {
             MessageDispatcherComponent.Instance = null;
             self.Handlers.Clear();
         }
-
+        
+        [EntitySystem]
         private static void Load(this MessageDispatcherComponent self)
         {
             self.Handlers.Clear();

+ 4 - 20
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs

@@ -3,7 +3,7 @@
 namespace ET
 {
     [FriendOf(typeof(SessionAcceptTimeoutComponent))]
-    public static class SessionAcceptTimeoutComponentHelper
+    public static partial class SessionAcceptTimeoutComponentHelper
     {
         [Invoke(TimerInvokeType.SessionAcceptTimeout)]
         public class SessionAcceptTimeout: ATimer<SessionAcceptTimeoutComponent>
@@ -20,30 +20,14 @@ namespace ET
                 }
             }
         }
-    
-        [EntitySystem]
-        public class SessionAcceptTimeoutComponentAwakeSystem: AwakeSystem<SessionAcceptTimeoutComponent>
-        {
-            protected override void Awake(SessionAcceptTimeoutComponent self)
-            {
-                self.Awake();
-            }
-        }
-
+        
         [EntitySystem]
-        public class SessionAcceptTimeoutComponentDestroySystem: DestroySystem<SessionAcceptTimeoutComponent>
-        {
-            protected override void Destroy(SessionAcceptTimeoutComponent self)
-            {
-                self.Destroy();
-            }
-        }
-
         private static void Awake(this SessionAcceptTimeoutComponent self)
         {
             self.Timer = TimerComponent.Instance.NewOnceTimer(TimeHelper.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
         }
-
+        
+        [EntitySystem]
         private static void Destroy(this SessionAcceptTimeoutComponent self)
         {
             TimerComponent.Instance.Remove(ref self.Timer);

+ 2 - 18
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs

@@ -3,7 +3,7 @@ using System;
 namespace ET
 {
     [FriendOf(typeof(SessionIdleCheckerComponent))]
-    public static class SessionIdleCheckerComponentSystem
+    public static partial class SessionIdleCheckerComponentSystem
     {
         [Invoke(TimerInvokeType.SessionIdleChecker)]
         public class SessionIdleChecker: ATimer<SessionIdleCheckerComponent>
@@ -22,28 +22,12 @@ namespace ET
         }
     
         [EntitySystem]
-        public class SessionIdleCheckerComponentAwakeSystem: AwakeSystem<SessionIdleCheckerComponent>
-        {
-            protected override void Awake(SessionIdleCheckerComponent self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class SessionIdleCheckerComponentDestroySystem: DestroySystem<SessionIdleCheckerComponent>
-        {
-            protected override void Destroy(SessionIdleCheckerComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Awake(this SessionIdleCheckerComponent self)
         {
             self.RepeatedTimer = TimerComponent.Instance.NewRepeatedTimer(SessionIdleCheckerComponentSystem.CheckInteral, TimerInvokeType.SessionIdleChecker, self);
         }
         
+        [EntitySystem]
         private static void Destroy(this SessionIdleCheckerComponent self)
         {
             TimerComponent.Instance?.Remove(ref self.RepeatedTimer);

+ 3 - 18
Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs

@@ -5,7 +5,7 @@ using Unity.Mathematics;
 namespace ET
 {
     [FriendOf(typeof(MoveComponent))]
-    public static class MoveComponentSystem
+    public static partial class MoveComponentSystem
     {
         [Invoke(TimerInvokeType.MoveTimer)]
         public class MoveTimer: ATimer<MoveComponent>
@@ -23,29 +23,14 @@ namespace ET
             }
         }
     
-        [EntitySystem]
-        public class DestroySystem: DestroySystem<MoveComponent>
-        {
-            protected override void Destroy(MoveComponent self)
-            {
-                self.Destroy();
-            }
-        }
-
-        [EntitySystem]
-        public class AwakeSystem: AwakeSystem<MoveComponent>
-        {
-            protected override void Awake(MoveComponent self)
-            {
-                self.Awake();
-            }
-        }
         
+        [EntitySystem]
         private static void Destroy(this MoveComponent self)
         {
             self.MoveFinish(false);
         }
         
+        [EntitySystem]
         private static void Awake(this MoveComponent self)
         {
             self.StartTime = 0;

+ 4 - 6
Unity/Assets/Scripts/Hotfix/Share/Module/Recast/NavmeshComponentSystem.cs

@@ -3,14 +3,12 @@
 namespace ET
 {
     [FriendOf(typeof(NavmeshComponent))]
-    public static class NavmeshComponentSystem
+    public static partial class NavmeshComponentSystem
     {
-        public class AwakeSystem: AwakeSystem<NavmeshComponent>
+        [EntitySystem]
+        private static void Awake(this NavmeshComponent self)
         {
-            protected override void Awake(NavmeshComponent self)
-            {
-                NavmeshComponent.Instance = self;
-            }
+            NavmeshComponent.Instance = self;
         }
         
         public static long Get(this NavmeshComponent self, string name)

+ 1 - 17
Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs

@@ -5,17 +5,9 @@ using Unity.Mathematics;
 namespace ET
 {
     [FriendOf(typeof(PathfindingComponent))]
-    public static class PathfindingComponentSystem
+    public static partial class PathfindingComponentSystem
     {
         [EntitySystem]
-        public class AwakeSystem: AwakeSystem<PathfindingComponent, string>
-        {
-            protected override void Awake(PathfindingComponent self, string name)
-            {
-                self.Awake(name);
-            }
-        }
-        
         private static void Awake(this PathfindingComponent self, string name)
         {
             self.Name = name;
@@ -28,14 +20,6 @@ namespace ET
         }
 
         [EntitySystem]
-        public class DestroySystem: DestroySystem<PathfindingComponent>
-        {
-            protected override void Destroy(PathfindingComponent self)
-            {
-                self.Destroy();
-            }
-        }
-        
         private static void Destroy(this PathfindingComponent self)
         {
             self.Name = string.Empty;

+ 5 - 11
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ClientSceneManagerComponentSystem.cs

@@ -1,24 +1,18 @@
 namespace ET
 {
     [FriendOf(typeof(ClientSceneManagerComponent))]
-    public static class ClientSceneManagerComponentSystem
+    public static partial class ClientSceneManagerComponentSystem
     {
         [EntitySystem]
-        public class ClientSceneManagerComponentAwakeSystem: AwakeSystem<ClientSceneManagerComponent>
+        private static void Awake(this ClientSceneManagerComponent self)
         {
-            protected override void Awake(ClientSceneManagerComponent self)
-            {
-                ClientSceneManagerComponent.Instance = self;
-            }
+            ClientSceneManagerComponent.Instance = self;
         }
 
         [EntitySystem]
-        public class ClientSceneManagerComponentDestroySystem: DestroySystem<ClientSceneManagerComponent>
+        private static void Destroy(this ClientSceneManagerComponent self)
         {
-            protected override void Destroy(ClientSceneManagerComponent self)
-            {
-                ClientSceneManagerComponent.Instance = null;
-            }
+            ClientSceneManagerComponent.Instance = null;
         }
         
         public static Scene ClientScene(this Entity entity)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs

@@ -2,7 +2,7 @@
 
 namespace ET
 {
-    public static class CurrentScenesComponentSystem
+    public static partial class CurrentScenesComponentSystem
     {
         public static Scene  CurrentScene(this Scene clientScene)
         {

+ 5 - 11
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs

@@ -1,24 +1,18 @@
 namespace ET
 {
     [FriendOf(typeof(ServerSceneManagerComponent))]
-    public static class ServerSceneManagerComponentSystem
+    public static partial class ServerSceneManagerComponentSystem
     {
         [EntitySystem]
-        public class ServerSceneManagerComponentAwakeSystem: AwakeSystem<ServerSceneManagerComponent>
+        private static void Awake(this ServerSceneManagerComponent self)
         {
-            protected override void Awake(ServerSceneManagerComponent self)
-            {
-                ServerSceneManagerComponent.Instance = self;
-            }
+            ServerSceneManagerComponent.Instance = self;
         }
 
         [EntitySystem]
-        public class ServerSceneManagerComponentDestroySystem: DestroySystem<ServerSceneManagerComponent>
+        private static void Destroy(this ServerSceneManagerComponent self)
         {
-            protected override void Destroy(ServerSceneManagerComponent self)
-            {
-                ServerSceneManagerComponent.Instance = null;
-            }
+            ServerSceneManagerComponent.Instance = null;
         }
         
         public static Scene Get(this ServerSceneManagerComponent self, int id)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Unit/UnitComponentSystem.cs

@@ -1,6 +1,6 @@
 namespace ET
 {
-	public static class UnitComponentSystem
+	public static partial class UnitComponentSystem
 	{
 		public static void Add(this UnitComponent self, Unit unit)
 		{

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Share/Module/Unit/UnitSystem.cs

@@ -1,9 +1,9 @@
 namespace ET
 {
-    [EntitySystem]
-    public class UnitSystem: AwakeSystem<Unit, int>
+    public static partial class UnitSystem
     {
-        protected override void Awake(Unit self, int configId)
+        [EntitySystem]
+        private static void Awake(this Unit self, int configId)
         {
             self.ConfigId = configId;
         }

+ 22 - 28
Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs

@@ -4,45 +4,39 @@ using UnityEngine;
 namespace ET.Client
 {
     [FriendOf(typeof(OperaComponent))]
-    public static class OperaComponentSystem
+    public static partial class OperaComponentSystem
     {
         [EntitySystem]
-        public class OperaComponentAwakeSystem : AwakeSystem<OperaComponent>
+        private static void Awake(this OperaComponent self)
         {
-            protected override void Awake(OperaComponent self)
-            {
-                self.mapMask = LayerMask.GetMask("Map");
-            }
+            self.mapMask = LayerMask.GetMask("Map");
         }
 
         [EntitySystem]
-        public class OperaComponentUpdateSystem : UpdateSystem<OperaComponent>
+        private static void Update(this OperaComponent self)
         {
-            protected override void Update(OperaComponent self)
+            if (Input.GetMouseButtonDown(1))
             {
-                if (Input.GetMouseButtonDown(1))
+                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
+                RaycastHit hit;
+                if (Physics.Raycast(ray, out hit, 1000, self.mapMask))
                 {
-                    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
-                    RaycastHit hit;
-                    if (Physics.Raycast(ray, out hit, 1000, self.mapMask))
-                    {
-                        C2M_PathfindingResult c2MPathfindingResult = new C2M_PathfindingResult();
-                        c2MPathfindingResult.Position = hit.point;
-                        self.ClientScene().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
-                    }
+                    C2M_PathfindingResult c2MPathfindingResult = new C2M_PathfindingResult();
+                    c2MPathfindingResult.Position = hit.point;
+                    self.ClientScene().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
                 }
+            }
 
-                if (Input.GetKeyDown(KeyCode.R))
-                {
-                    Game.Load();
-                    Log.Debug("hot reload success!");
-                }
-            
-                if (Input.GetKeyDown(KeyCode.T))
-                {
-                    C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
-                    self.ClientScene().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
-                }
+            if (Input.GetKeyDown(KeyCode.R))
+            {
+                Game.Load();
+                Log.Debug("hot reload success!");
+            }
+        
+            if (Input.GetKeyDown(KeyCode.T))
+            {
+                C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
+                self.ClientScene().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
             }
         }
     }

+ 5 - 8
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs

@@ -4,18 +4,15 @@ using UnityEngine.UI;
 namespace ET.Client
 {
     [FriendOf(typeof(UILobbyComponent))]
-    public static class UILobbyComponentSystem
+    public static partial class UILobbyComponentSystem
     {
         [EntitySystem]
-        public class UILobbyComponentAwakeSystem: AwakeSystem<UILobbyComponent>
+        private static void Awake(this UILobbyComponent self)
         {
-            protected override void Awake(UILobbyComponent self)
-            {
-                ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
+            ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
 
-                self.enterMap = rc.Get<GameObject>("EnterMap");
-                self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap().Coroutine(); });
-            }
+            self.enterMap = rc.Get<GameObject>("EnterMap");
+            self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap().Coroutine(); });
         }
         
         public static async ETTask EnterMap(this UILobbyComponent self)

+ 8 - 11
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs

@@ -4,20 +4,17 @@ using UnityEngine.UI;
 namespace ET.Client
 {
 	[FriendOf(typeof(UILoginComponent))]
-	public static class UILoginComponentSystem
+	public static partial class UILoginComponentSystem
 	{
 		[EntitySystem]
-		public class UILoginComponentAwakeSystem : AwakeSystem<UILoginComponent>
+		private static void Awake(this UILoginComponent self)
 		{
-			protected override void Awake(UILoginComponent self)
-			{
-				ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
-				self.loginBtn = rc.Get<GameObject>("LoginBtn");
-				
-				self.loginBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnLogin(); });
-				self.account = rc.Get<GameObject>("Account");
-				self.password = rc.Get<GameObject>("Password");
-			}
+			ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
+			self.loginBtn = rc.Get<GameObject>("LoginBtn");
+			
+			self.loginBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnLogin(); });
+			self.account = rc.Get<GameObject>("Account");
+			self.password = rc.Get<GameObject>("Password");
 		}
 
 		

+ 8 - 27
Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/AnimatorComponentSystem.cs

@@ -4,37 +4,17 @@ using UnityEngine;
 namespace ET.Client
 {
 	[FriendOf(typeof(AnimatorComponent))]
-	public static class AnimatorComponentSystem
+	public static partial class AnimatorComponentSystem
 	{
 		[EntitySystem]
-		public class AwakeSystem : AwakeSystem<AnimatorComponent>
+		private static void Destroy(this AnimatorComponent self)
 		{
-			protected override void Awake(AnimatorComponent self)
-			{
-				self.Awake();
-			}
-		}
-
-		[EntitySystem]
-		public class UpdateSystem : UpdateSystem<AnimatorComponent>
-		{
-			protected override void Update(AnimatorComponent self)
-			{
-				self.Update();
-			}
+			self.animationClips = null;
+			self.Parameter = null;
+			self.Animator = null;
 		}
-	
+			
 		[EntitySystem]
-		public class DestroySystem : DestroySystem<AnimatorComponent>
-		{
-			protected override void Destroy(AnimatorComponent self)
-			{
-				self.animationClips = null;
-				self.Parameter = null;
-				self.Animator = null;
-			}
-		}
-
 		private static void Awake(this AnimatorComponent self)
 		{
 			Animator animator = self.GetParent<Unit>().GetComponent<GameObjectComponent>().GameObject.GetComponent<Animator>();
@@ -63,7 +43,8 @@ namespace ET.Client
 				self.Parameter.Add(animatorControllerParameter.name);
 			}
 		}
-
+		
+		[EntitySystem]
 		private static void Update(this AnimatorComponent self)
 		{
 			if (self.isStop)

+ 3 - 6
Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/GameObjectComponentSystem.cs

@@ -2,15 +2,12 @@
 
 namespace ET.Client
 {
-    public static class GameObjectComponentSystem
+    public static partial class GameObjectComponentSystem
     {
         [EntitySystem]
-        public class DestroySystem: DestroySystem<GameObjectComponent>
+        private static void Destroy(this GameObjectComponent self)
         {
-            protected override void Destroy(GameObjectComponent self)
-            {
-                UnityEngine.Object.Destroy(self.GameObject);
-            }
+            UnityEngine.Object.Destroy(self.GameObject);
         }
     }
 }

+ 3 - 19
Unity/Assets/Scripts/HotfixView/Client/LockStep/Camera/LSCameraComponentSystem.cs

@@ -3,32 +3,16 @@
 namespace ET.Client
 {
 	[FriendOf(typeof(LSCameraComponent))]
-	public static class LSCameraComponentSystem
+	public static partial class LSCameraComponentSystem
 	{
 		[EntitySystem]
-		public class AwakeSystem : AwakeSystem<LSCameraComponent>
-		{
-			protected override void Awake(LSCameraComponent self)
-			{
-				self.Awake();
-			}
-		}
-
-		[EntitySystem]
-		public class LateUpdateSystem : LateUpdateSystem<LSCameraComponent>
-		{
-			protected override void LateUpdate(LSCameraComponent self)
-			{
-				self.LateUpdate();
-			}
-		}
-
 		private static void Awake(this LSCameraComponent self)
 		{
 			self.Camera = Camera.main;
 			self.Camera.transform.rotation = Quaternion.Euler(new Vector3(20, 0, 0));
 		}
-
+		
+		[EntitySystem]
 		private static void LateUpdate(this LSCameraComponent self)
 		{
 			// 摄像机每帧更新位置

+ 8 - 27
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSAnimatorComponentSystem.cs

@@ -4,37 +4,17 @@ using UnityEngine;
 namespace ET.Client
 {
 	[FriendOf(typeof(LSAnimatorComponent))]
-	public static class LSAnimatorComponentSystem
+	public static partial class LSAnimatorComponentSystem
 	{
 		[EntitySystem]
-		public class AwakeSystem : AwakeSystem<LSAnimatorComponent>
+		private static void Destroy(this LSAnimatorComponent self)
 		{
-			protected override void Awake(LSAnimatorComponent self)
-			{
-				self.Awake();
-			}
-		}
-
-		[EntitySystem]
-		public class UpdateSystem : UpdateSystem<LSAnimatorComponent>
-		{
-			protected override void Update(LSAnimatorComponent self)
-			{
-				self.Update();
-			}
+			self.animationClips = null;
+			self.Parameter = null;
+			self.Animator = null;
 		}
-	
+		
 		[EntitySystem]
-		public class DestroySystem : DestroySystem<LSAnimatorComponent>
-		{
-			protected override void Destroy(LSAnimatorComponent self)
-			{
-				self.animationClips = null;
-				self.Parameter = null;
-				self.Animator = null;
-			}
-		}
-
 		private static void Awake(this LSAnimatorComponent self)
 		{
 			Animator animator = self.GetParent<LSUnitView>().GameObject.GetComponent<Animator>();
@@ -63,7 +43,8 @@ namespace ET.Client
 				self.Parameter.Add(animatorControllerParameter.name);
 			}
 		}
-
+		
+		[EntitySystem]
 		private static void Update(this LSAnimatorComponent self)
 		{
 			if (self.isStop)

+ 24 - 27
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSOperaComponentSystem.cs

@@ -3,38 +3,35 @@ using UnityEngine;
 
 namespace ET.Client
 {
-    [FriendOf(typeof(LSClientUpdater))]
-    public static class LSOperaComponentSystem
+    [FriendOf(typeof (LSClientUpdater))]
+    public static partial class LSOperaComponentSystem
     {
-        [FriendOf(typeof(LSClientUpdater))]
-        public class UpdateSystem: UpdateSystem<LSOperaComponent>
+        [EntitySystem]
+        private static void Update(this LSOperaComponent self)
         {
-            protected override void Update(LSOperaComponent self)
+            TSVector2 v = new();
+            if (Input.GetKey(KeyCode.W))
             {
-                TSVector2 v = new();
-                if (Input.GetKey(KeyCode.W))
-                {
-                    v.y += 1;
-                }
-                
-                if (Input.GetKey(KeyCode.A))
-                {
-                    v.x -= 1;
-                }
-                
-                if (Input.GetKey(KeyCode.S))
-                {
-                    v.y -= 1;
-                }
-                
-                if (Input.GetKey(KeyCode.D))
-                {
-                    v.x += 1;
-                }
+                v.y += 1;
+            }
 
-                LSClientUpdater lsClientUpdater = self.GetParent<Room>().GetComponent<LSClientUpdater>();
-                lsClientUpdater.Input.V = v.normalized;
+            if (Input.GetKey(KeyCode.A))
+            {
+                v.x -= 1;
+            }
+
+            if (Input.GetKey(KeyCode.S))
+            {
+                v.y -= 1;
             }
+
+            if (Input.GetKey(KeyCode.D))
+            {
+                v.x += 1;
+            }
+
+            LSClientUpdater lsClientUpdater = self.GetParent<Room>().GetComponent<LSClientUpdater>();
+            lsClientUpdater.Input.V = v.normalized;
         }
     }
 }

+ 13 - 16
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs

@@ -2,28 +2,25 @@
 
 namespace ET.Client
 {
-    public static class LSUnitViewComponentSystem
+    public static partial class LSUnitViewComponentSystem
     {
-        public class AwakeSystem: AwakeSystem<LSUnitViewComponent>
+        [EntitySystem]
+        private static void Awake(this LSUnitViewComponent self)
         {
-            protected override void Awake(LSUnitViewComponent self)
+            Room room = self.Room();
+            LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent<LSUnitComponent>();
+            foreach (long playerId in room.PlayerIds)
             {
-                Room room = self.Room();
-                LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent<LSUnitComponent>();
-                foreach (long playerId in room.PlayerIds)
-                {
-                    LSUnit lsUnit = lsUnitComponent.GetChild<LSUnit>(playerId);
-                    GameObject bundleGameObject = (GameObject)ResourcesComponent.Instance.GetAsset("Unit.unity3d", "Unit");
-                    GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
+                LSUnit lsUnit = lsUnitComponent.GetChild<LSUnit>(playerId);
+                GameObject bundleGameObject = (GameObject)ResourcesComponent.Instance.GetAsset("Unit.unity3d", "Unit");
+                GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
 
-                    GameObject unitGo = UnityEngine.Object.Instantiate(prefab, GlobalComponent.Instance.Unit, true);
-                    unitGo.transform.position = lsUnit.Position.ToVector();
+                GameObject unitGo = UnityEngine.Object.Instantiate(prefab, GlobalComponent.Instance.Unit, true);
+                unitGo.transform.position = lsUnit.Position.ToVector();
 
-                    LSUnitView lsUnitView = self.AddChildWithId<LSUnitView, GameObject>(lsUnit.Id, unitGo);
-                    lsUnitView.AddComponent<LSAnimatorComponent>();
-                }
+                LSUnitView lsUnitView = self.AddChildWithId<LSUnitView, GameObject>(lsUnit.Id, unitGo);
+                lsUnitView.AddComponent<LSAnimatorComponent>();
             }
         }
-
     }
 }

+ 14 - 25
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewSystem.cs

@@ -4,38 +4,27 @@ using UnityEngine;
 
 namespace ET.Client
 {
-    public static class LSUnitViewSystem
+    public static partial class LSUnitViewSystem
     {
-        public class AwakeSystem: AwakeSystem<LSUnitView, GameObject>
+        [EntitySystem]
+        private static void Awake(this LSUnitView self, GameObject go)
         {
-            protected override void Awake(LSUnitView self, GameObject go)
-            {
-                self.GameObject = go;
-                self.Transform = go.transform;
-                
-            }
+            self.GameObject = go;
+            self.Transform = go.transform;
+            
         }
         
-        public class RollbackSystem: RollbackSystem<LSUnitView>
+        [EntitySystem]
+        private static void Rollback(this LSUnitView self)
         {
-            protected override void Rollback(LSUnitView self)
-            {
-                //LSUnit unit = self.GetUnit();
-                //self.Transform.position = unit.Position.ToVector();
-                //self.Transform.rotation = unit.Rotation.ToQuaternion();
-                //self.t = 0;
-                //self.totalTime = 0;
-            }
+            //LSUnit unit = self.GetUnit();
+            //self.Transform.position = unit.Position.ToVector();
+            //self.Transform.rotation = unit.Rotation.ToQuaternion();
+            //self.t = 0;
+            //self.totalTime = 0;
         }
         
-        public class UpdateSystem: UpdateSystem<LSUnitView>
-        {
-            protected override void Update(LSUnitView self)
-            {
-                self.Update();
-            }
-        }
-
+        [EntitySystem]
         private static void Update(this LSUnitView self)
         {
             LSUnit unit = self.GetUnit();

+ 12 - 15
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs

@@ -5,25 +5,22 @@ using UnityEngine.UI;
 namespace ET.Client
 {
     [FriendOf(typeof(UILSLobbyComponent))]
-    public static class UILSLobbyComponentSystem
+    public static partial class UILSLobbyComponentSystem
     {
         [EntitySystem]
-        public class UILSLobbyComponentAwakeSystem: AwakeSystem<UILSLobbyComponent>
+        private static void Awake(this UILSLobbyComponent self)
         {
-            protected override void Awake(UILSLobbyComponent self)
-            {
-                ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
+            ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
 
-                self.enterMap = rc.Get<GameObject>("EnterMap");
-                self.enterMap.GetComponent<Button>().onClick.AddListener(() =>
-                {
-                    self.EnterMap().Coroutine();
-                });
-                
-                self.replay = rc.Get<GameObject>("Replay").GetComponent<Button>();
-                self.replayPath = rc.Get<GameObject>("ReplayPath").GetComponent<InputField>();
-                self.replay.onClick.AddListener(self.Replay);
-            }
+            self.enterMap = rc.Get<GameObject>("EnterMap");
+            self.enterMap.GetComponent<Button>().onClick.AddListener(() =>
+            {
+                self.EnterMap().Coroutine();
+            });
+            
+            self.replay = rc.Get<GameObject>("Replay").GetComponent<Button>();
+            self.replayPath = rc.Get<GameObject>("ReplayPath").GetComponent<InputField>();
+            self.replay.onClick.AddListener(self.Replay);
         }
 
         private static async ETTask EnterMap(this UILSLobbyComponent self)

+ 8 - 11
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs

@@ -4,20 +4,17 @@ using UnityEngine.UI;
 namespace ET.Client
 {
 	[FriendOf(typeof(UILoginComponent))]
-	public static class UILSLoginComponentSystem
+	public static partial class UILSLoginComponentSystem
 	{
 		[EntitySystem]
-		public class UILSLoginComponentAwakeSystem : AwakeSystem<UILSLoginComponent>
+		private static void Awake(this UILSLoginComponent self)
 		{
-			protected override void Awake(UILSLoginComponent self)
-			{
-				ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
-				self.loginBtn = rc.Get<GameObject>("LoginBtn");
-				
-				self.loginBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnLogin(); });
-				self.account = rc.Get<GameObject>("Account");
-				self.password = rc.Get<GameObject>("Password");
-			}
+			ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
+			self.loginBtn = rc.Get<GameObject>("LoginBtn");
+			
+			self.loginBtn.GetComponent<Button>().onClick.AddListener(()=> { self.OnLogin(); });
+			self.account = rc.Get<GameObject>("Account");
+			self.password = rc.Get<GameObject>("Password");
 		}
 
 		

+ 46 - 49
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomComponentSystem.cs

@@ -4,62 +4,59 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
-    public static class UILSRoomComponentSystem
+    [FriendOf(typeof (UILSRoomComponent))]
+    public static partial class UILSRoomComponentSystem
     {
-        public class AwakeSystem : AwakeSystem<UILSRoomComponent>
+        [EntitySystem]
+        private static void Awake(this UILSRoomComponent self)
         {
-            protected override void Awake(UILSRoomComponent self)
+            ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
+            GameObject replay = rc.Get<GameObject>("Replay");
+            GameObject play = rc.Get<GameObject>("Play");
+
+            self.frameText = rc.Get<GameObject>("progress").GetComponent<Text>();
+
+            Room room = self.Room();
+            if (room.IsReplay)
             {
-                ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
-                GameObject replay = rc.Get<GameObject>("Replay");
-                GameObject play = rc.Get<GameObject>("Play");
-                
-                self.frameText = rc.Get<GameObject>("progress").GetComponent<Text>();
-                
-                Room room = self.Room();
-                if (room.IsReplay)
-                {
-                    replay.SetActive(true);
-                    play.SetActive(false);
-                    self.totalFrame = rc.Get<GameObject>("framecount").GetComponent<Text>();
-                    self.jumpToField = rc.Get<GameObject>("jumpToCount").GetComponent<InputField>();
-                    self.jump = rc.Get<GameObject>("jump").GetComponent<Button>();
-                    self.jump.onClick.AddListener(self.JumpReplay);
-                    self.replaySpeed = rc.Get<GameObject>("speed").GetComponent<Button>();
-                    self.replaySpeed.onClick.AddListener(self.OnReplaySpeedClicked);
-                    
-                    self.totalFrame.text = self.Room().Replay.FrameInputs.Count.ToString();
-                }
-                else
-                {
-                    replay.SetActive(false);
-                    play.SetActive(true);
-                    self.predictFrameText = rc.Get<GameObject>("predict").GetComponent<Text>();
-                    self.saveReplay = rc.Get<GameObject>("SaveReplay").GetComponent<Button>();
-                    self.saveName = rc.Get<GameObject>("SaveName").GetComponent<InputField>();
-                    self.saveReplay.onClick.AddListener(self.OnSaveReplay);
-                }
+                replay.SetActive(true);
+                play.SetActive(false);
+                self.totalFrame = rc.Get<GameObject>("framecount").GetComponent<Text>();
+                self.jumpToField = rc.Get<GameObject>("jumpToCount").GetComponent<InputField>();
+                self.jump = rc.Get<GameObject>("jump").GetComponent<Button>();
+                self.jump.onClick.AddListener(self.JumpReplay);
+                self.replaySpeed = rc.Get<GameObject>("speed").GetComponent<Button>();
+                self.replaySpeed.onClick.AddListener(self.OnReplaySpeedClicked);
+
+                self.totalFrame.text = self.Room().Replay.FrameInputs.Count.ToString();
+            }
+            else
+            {
+                replay.SetActive(false);
+                play.SetActive(true);
+                self.predictFrameText = rc.Get<GameObject>("predict").GetComponent<Text>();
+                self.saveReplay = rc.Get<GameObject>("SaveReplay").GetComponent<Button>();
+                self.saveName = rc.Get<GameObject>("SaveName").GetComponent<InputField>();
+                self.saveReplay.onClick.AddListener(self.OnSaveReplay);
             }
         }
 
-        public class UpdateSystem: UpdateSystem<UILSRoomComponent>
+        [EntitySystem]
+        private static void Update(this UILSRoomComponent self)
         {
-            protected override void Update(UILSRoomComponent self)
+            Room room = self.Room();
+            if (self.frame != room.AuthorityFrame)
             {
-                Room room = self.Room();
-                if (self.frame != room.AuthorityFrame)
-                {
-                    self.frame = room.AuthorityFrame;
-                    self.frameText.text = room.AuthorityFrame.ToString();
-                }
+                self.frame = room.AuthorityFrame;
+                self.frameText.text = room.AuthorityFrame.ToString();
+            }
 
-                if (!room.IsReplay)
+            if (!room.IsReplay)
+            {
+                if (self.predictFrame != room.PredictionFrame)
                 {
-                    if (self.predictFrame != room.PredictionFrame)
-                    {
-                        self.predictFrame = room.PredictionFrame;
-                        self.predictFrameText.text = room.PredictionFrame.ToString();
-                    }
+                    self.predictFrame = room.PredictionFrame;
+                    self.predictFrameText.text = room.PredictionFrame.ToString();
                 }
             }
         }
@@ -67,16 +64,16 @@ namespace ET.Client
         private static void OnSaveReplay(this UILSRoomComponent self)
         {
             string name = self.saveName.text;
-            
+
             LSClientHelper.SaveReplay(self.Room(), name);
         }
-        
+
         private static void JumpReplay(this UILSRoomComponent self)
         {
             int toFrame = int.Parse(self.jumpToField.text);
             LSClientHelper.JumpReplay(self.Room(), toFrame);
         }
-        
+
         private static void OnReplaySpeedClicked(this UILSRoomComponent self)
         {
             LSReplayUpdater lsReplayUpdater = self.Room().GetComponent<LSReplayUpdater>();

+ 61 - 65
Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIEventComponentSystem.cs

@@ -4,72 +4,68 @@ using UnityEngine;
 
 namespace ET.Client
 {
-	/// <summary>
-	/// 管理所有UI GameObject 以及UI事件
-	/// </summary>
-	[FriendOf(typeof(UIEventComponent))]
-	public static class UIEventComponentSystem
-	{
-		[EntitySystem]
-		public class UIEventComponentAwakeSystem : AwakeSystem<UIEventComponent>
-		{
-			protected override void Awake(UIEventComponent self)
-			{
-				UIEventComponent.Instance = self;
-			
-				GameObject uiRoot = GameObject.Find("/Global/UI");
-				ReferenceCollector referenceCollector = uiRoot.GetComponent<ReferenceCollector>();
-			
-				self.UILayers.Add((int)UILayer.Hidden, referenceCollector.Get<GameObject>(UILayer.Hidden.ToString()).transform);
-				self.UILayers.Add((int)UILayer.Low, referenceCollector.Get<GameObject>(UILayer.Low.ToString()).transform);
-				self.UILayers.Add((int)UILayer.Mid, referenceCollector.Get<GameObject>(UILayer.Mid.ToString()).transform);
-				self.UILayers.Add((int)UILayer.High, referenceCollector.Get<GameObject>(UILayer.High.ToString()).transform);
+    /// <summary>
+    /// 管理所有UI GameObject 以及UI事件
+    /// </summary>
+    [FriendOf(typeof (UIEventComponent))]
+    public static partial class UIEventComponentSystem
+    {
+        [EntitySystem]
+        private static void Awake(this UIEventComponent self)
+        {
+            UIEventComponent.Instance = self;
 
-				var uiEvents = EventSystem.Instance.GetTypes(typeof (UIEventAttribute));
-				foreach (Type type in uiEvents)
-				{
-					object[] attrs = type.GetCustomAttributes(typeof(UIEventAttribute), false);
-					if (attrs.Length == 0)
-					{
-						continue;
-					}
+            GameObject uiRoot = GameObject.Find("/Global/UI");
+            ReferenceCollector referenceCollector = uiRoot.GetComponent<ReferenceCollector>();
 
-					UIEventAttribute uiEventAttribute = attrs[0] as UIEventAttribute;
-					AUIEvent aUIEvent = Activator.CreateInstance(type) as AUIEvent;
-					self.UIEvents.Add(uiEventAttribute.UIType, aUIEvent);
-				}
-			}
-		}
-		
-		public static async ETTask<UI> OnCreate(this UIEventComponent self, UIComponent uiComponent, string uiType, UILayer uiLayer)
-		{
-			try
-			{
-				UI ui = await self.UIEvents[uiType].OnCreate(uiComponent, uiLayer);
-				return ui;
-			}
-			catch (Exception e)
-			{
-				throw new Exception($"on create ui error: {uiType}", e);
-			}
-		}
+            self.UILayers.Add((int)UILayer.Hidden, referenceCollector.Get<GameObject>(UILayer.Hidden.ToString()).transform);
+            self.UILayers.Add((int)UILayer.Low, referenceCollector.Get<GameObject>(UILayer.Low.ToString()).transform);
+            self.UILayers.Add((int)UILayer.Mid, referenceCollector.Get<GameObject>(UILayer.Mid.ToString()).transform);
+            self.UILayers.Add((int)UILayer.High, referenceCollector.Get<GameObject>(UILayer.High.ToString()).transform);
 
-		public static Transform GetLayer(this UIEventComponent self, int layer)
-		{
-			return self.UILayers[layer];
-		}
-		
-		public static void OnRemove(this UIEventComponent self, UIComponent uiComponent, string uiType)
-		{
-			try
-			{
-				self.UIEvents[uiType].OnRemove(uiComponent);
-			}
-			catch (Exception e)
-			{
-				throw new Exception($"on remove ui error: {uiType}", e);
-			}
-			
-		}
-	}
+            var uiEvents = EventSystem.Instance.GetTypes(typeof (UIEventAttribute));
+            foreach (Type type in uiEvents)
+            {
+                object[] attrs = type.GetCustomAttributes(typeof (UIEventAttribute), false);
+                if (attrs.Length == 0)
+                {
+                    continue;
+                }
+
+                UIEventAttribute uiEventAttribute = attrs[0] as UIEventAttribute;
+                AUIEvent aUIEvent = Activator.CreateInstance(type) as AUIEvent;
+                self.UIEvents.Add(uiEventAttribute.UIType, aUIEvent);
+            }
+        }
+
+        public static async ETTask<UI> OnCreate(this UIEventComponent self, UIComponent uiComponent, string uiType, UILayer uiLayer)
+        {
+            try
+            {
+                UI ui = await self.UIEvents[uiType].OnCreate(uiComponent, uiLayer);
+                return ui;
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"on create ui error: {uiType}", e);
+            }
+        }
+
+        public static Transform GetLayer(this UIEventComponent self, int layer)
+        {
+            return self.UILayers[layer];
+        }
+
+        public static void OnRemove(this UIEventComponent self, UIComponent uiComponent, string uiType)
+        {
+            try
+            {
+                self.UIEvents[uiType].OnRemove(uiComponent);
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"on remove ui error: {uiType}", e);
+            }
+        }
+    }
 }

+ 2 - 18
Unity/Assets/Scripts/Model/Share/Module/Console/ModeContex.cs

@@ -1,31 +1,15 @@
 namespace ET
 {
     [FriendOf(typeof(ModeContex))]
-    public static class ModeContexSystem
+    public static partial class ModeContexSystem
     {
         [EntitySystem]
-        public class ModeContexAwakeSystem: AwakeSystem<ModeContex>
-        {
-            protected override void Awake(ModeContex self)
-            {
-                self.Awake();
-            }
-        }
-
-        [EntitySystem]
-        public class ModeContexDestroySystem: DestroySystem<ModeContex>
-        {
-            protected override void Destroy(ModeContex self)
-            {
-                self.Destroy();
-            }
-        }
-
         private static void Awake(this ModeContex self)
         {
             self.Mode = "";
         }
         
+        [EntitySystem]
         private static void Destroy(this ModeContex self)
         {
             self.Mode = "";

Неке датотеке нису приказане због велике количине промена