Procházet zdrojové kódy

合并了@susices(sj)的EntitySystemOf分析器,ET8改动太大,只能手动合并过来了

tanghai před 2 roky
rodič
revize
9df7eda211
78 změnil soubory, kde provedl 773 přidání a 44 odebrání
  1. 1 1
      Share/Analyzer/Analyzer/EntityClassDeclarationAnalyzer.cs
  2. 258 0
      Share/Analyzer/Analyzer/EntitySystemAnalyzer.cs
  3. 136 0
      Share/Analyzer/CodeFixer/EntitySystemCodeFixProvider.cs
  4. 14 8
      Share/Analyzer/Config/AnalyzeAssembly.cs
  5. 43 0
      Share/Analyzer/Config/Definition.cs
  6. 4 0
      Share/Analyzer/Config/DiagnosticIds.cs
  7. 36 0
      Share/Analyzer/Config/DiagnosticRules.cs
  8. 73 1
      Share/Analyzer/Extension/AnalyzerHelper.cs
  9. 1 1
      Share/Analyzer/Share.Analyzer.csproj
  10. 26 0
      Unity/Assets/Scripts/Core/Analyzer/EntitySystemOf.cs
  11. 11 0
      Unity/Assets/Scripts/Core/Analyzer/EntitySystemOf.cs.meta
  12. 1 0
      Unity/Assets/Scripts/Core/Fiber/MailBoxComponent.cs
  13. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs
  14. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs
  15. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs
  16. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs
  17. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs
  18. 1 0
      Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs
  19. 14 6
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs
  20. 1 0
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs
  21. 1 0
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs
  22. 1 0
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs
  23. 1 0
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs
  24. 11 4
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs
  25. 7 0
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs
  26. 1 0
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs
  27. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs
  28. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/PlayerSystem.cs
  29. 7 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs
  30. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs
  31. 1 0
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs
  32. 12 5
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs
  33. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIEntitySystem.cs
  34. 13 5
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/CellSystem.cs
  35. 2 0
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  36. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs
  37. 3 2
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs
  38. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs
  39. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs
  40. 2 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs
  41. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs
  42. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs
  43. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterNodeSystem.cs
  44. 9 1
      Unity/Assets/Scripts/Hotfix/Share/LockStep/LSInputComponentSystem.cs
  45. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIComponentSystem.cs
  46. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs
  47. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  48. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs
  49. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs
  50. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs
  51. 1 0
      Unity/Assets/Scripts/Hotfix/Share/Module/Unit/UnitSystem.cs
  52. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  53. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelper.cs
  54. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs
  55. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs
  56. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/AnimatorComponentSystem.cs
  57. 7 0
      Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/GameObjectComponentSystem.cs
  58. 1 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/Camera/LSCameraComponentSystem.cs
  59. 1 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSAnimatorComponentSystem.cs
  60. 9 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSOperaComponentSystem.cs
  61. 7 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs
  62. 3 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewSystem.cs
  63. 1 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs
  64. 1 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs
  65. 1 0
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomComponentSystem.cs
  66. 1 0
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIComponentSystem.cs
  67. 3 2
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs
  68. 1 0
      Unity/Assets/Scripts/Loader/GlobalComponent.cs
  69. 1 1
      Unity/Assets/Scripts/Model/Server/Demo/Watcher/WatcherComponent.cs
  70. 1 1
      Unity/Assets/Scripts/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs
  71. 1 1
      Unity/Assets/Scripts/Model/Server/Module/DB/DBComponent.cs
  72. 1 0
      Unity/Assets/Scripts/Model/Share/Module/Console/ModeContex.cs
  73. 1 0
      Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs
  74. 1 0
      Unity/Assets/Scripts/Model/Share/Module/ObjectWait/ObjectWait.cs
  75. 2 0
      Unity/Assets/Scripts/ModelView/Client/Module/Resource/ResourcesComponent.cs
  76. 9 2
      Unity/Assets/Scripts/ModelView/Client/Module/Resource/ResourcesLoaderComponent.cs
  77. 1 0
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UI.cs
  78. 1 0
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs

+ 1 - 1
Share/Analyzer/Analyzer/EntityClassDeclarationAnalyzer.cs

@@ -19,7 +19,7 @@ namespace ET.Analyzer
 
              context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
              context.EnableConcurrentExecution();
-             //context.RegisterSymbolAction(this.Analyzer, SymbolKind.NamedType);
+             context.RegisterSymbolAction(this.Analyzer, SymbolKind.NamedType);
          }
 
          private void Analyzer(SymbolAnalysisContext context)

+ 258 - 0
Share/Analyzer/Analyzer/EntitySystemAnalyzer.cs

@@ -0,0 +1,258 @@
+using System;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Text;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Diagnostics;
+
+namespace ET.Analyzer;
+
+[DiagnosticAnalyzer(LanguageNames.CSharp)]
+public class EntitySystemAnalyzer: DiagnosticAnalyzer
+{
+    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(EntitySystemAnalyzerRule.Rule,EntitySystemMethodNeedSystemOfAttrAnalyzerRule.Rule);
+
+    public override void Initialize(AnalysisContext context)
+    {
+        if (!AnalyzerGlobalSetting.EnableAnalyzer)
+        {
+            return;
+        }
+
+        context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
+        context.EnableConcurrentExecution();
+        context.RegisterSymbolAction(this.Analyzer, SymbolKind.NamedType);
+        context.RegisterSymbolAction(this.AnalyzeIsSystemMethodValid,SymbolKind.NamedType);
+    }
+
+    private static ImmutableArray<ETSystemData> SupportedETSystemDatas => ImmutableArray.Create(
+        new ETSystemData(Definition.EntitySystemOfAttribute, Definition.EntitySystemAttribute, Definition.EntityType,Definition.EntitySystemAttributeMetaName,
+            new SystemMethodData(Definition.IAwakeInterface, Definition.AwakeMethod),
+            new SystemMethodData(Definition.IUpdateInterface, Definition.UpdateMethod),
+            new SystemMethodData(Definition.IDestroyInterface, Definition.DestroyMethod),
+            new SystemMethodData(Definition.IAddComponentInterface, Definition.AddComponentMethod),
+            new SystemMethodData(Definition.IDeserializeInterface, Definition.DeserializeMethod),
+            new SystemMethodData(Definition.IGetComponentInterface, Definition.GetComponentMethod),
+            new SystemMethodData(Definition.ILoadInterface, Definition.LoadMethod),
+            new SystemMethodData(Definition.ILateUpdateInterface, Definition.LateUpdateMethod),
+            new SystemMethodData(Definition.ISerializeInterface, Definition.SerializeMethod),
+            new SystemMethodData(Definition.ILSRollbackInterface,Definition.LSRollbackMethod)),
+        new ETSystemData(Definition.LSEntitySystemOfAttribute,Definition.LSEntitySystemAttribute,Definition.LSEntityType,Definition.LSEntitySystemAttributeMetaName,
+            new SystemMethodData(Definition.IAwakeInterface, Definition.AwakeMethod),
+            new SystemMethodData(Definition.ILSUpdateInterface, Definition.LSUpdateMethod),
+            new SystemMethodData(Definition.IDestroyInterface, Definition.DestroyMethod),
+            new SystemMethodData(Definition.IAddComponentInterface, Definition.AddComponentMethod),
+            new SystemMethodData(Definition.IDeserializeInterface, Definition.DeserializeMethod),
+            new SystemMethodData(Definition.IGetComponentInterface, Definition.GetComponentMethod),
+            new SystemMethodData(Definition.ILoadInterface, Definition.LoadMethod),
+            new SystemMethodData(Definition.ISerializeInterface, Definition.SerializeMethod),
+            new SystemMethodData(Definition.ILSRollbackInterface,Definition.LSRollbackMethod)
+        )
+    );
+
+    public class ETSystemData
+    {
+        public string EntityTypeName;
+        public string SystemOfAttribute;
+        public string SystemAttributeShowName;
+        public string SystemAttributeMetaName;
+        public SystemMethodData[] SystemMethods;
+
+        public ETSystemData(string systemOfAttribute, string systemAttributeShowName, string entityTypeName, string systemAttributeMetaName, params SystemMethodData[] systemMethods)
+        {
+            this.SystemOfAttribute = systemOfAttribute;
+            this.SystemAttributeShowName = systemAttributeShowName;
+            this.EntityTypeName = entityTypeName;
+            this.SystemAttributeMetaName = systemAttributeMetaName;
+            this.SystemMethods = systemMethods;
+        }
+    }
+
+    public struct SystemMethodData
+    {
+        public string InterfaceName;
+        public string MethodName;
+
+        public SystemMethodData(string interfaceName, string methodName)
+        {
+            this.InterfaceName = interfaceName;
+            this.MethodName = methodName;
+        }
+    }
+
+    private void Analyzer(SymbolAnalysisContext context)
+    {
+        if (!(context.Symbol is INamedTypeSymbol namedTypeSymbol))
+        {
+            return;
+        }
+
+        ImmutableDictionary<string, string?>.Builder? builder = null;
+        foreach (ETSystemData? supportedEtSystemData in SupportedETSystemDatas)
+        {
+            if (supportedEtSystemData != null)
+            {
+                this.AnalyzeETSystem(context, supportedEtSystemData, ref builder);
+            }
+        }
+
+        this.ReportNeedGenerateSystem(context, namedTypeSymbol, ref builder);
+    }
+
+    private void AnalyzeETSystem(SymbolAnalysisContext context, ETSystemData etSystemData, ref ImmutableDictionary<string, string?>.Builder? builder)
+    {
+        if (!(context.Symbol is INamedTypeSymbol namedTypeSymbol))
+        {
+            return;
+        }
+
+        // 筛选出含有SystemOf标签的类
+        AttributeData? attr = namedTypeSymbol.GetFirstAttribute(etSystemData.SystemOfAttribute);
+        if (attr == null)
+        {
+            return;
+        }
+
+        
+
+        // 获取所属的实体类symbol
+        if (attr.ConstructorArguments[0].Value is not INamedTypeSymbol entityTypeSymbol)
+        {
+            return;
+        }
+
+        // 排除非Entity子类
+        if (entityTypeSymbol.BaseType?.ToString() != etSystemData.EntityTypeName)
+        {
+            return;
+        }
+
+        foreach (INamedTypeSymbol? interfacetypeSymbol in entityTypeSymbol.AllInterfaces)
+        {
+            foreach (SystemMethodData systemMethodData in etSystemData.SystemMethods)
+            {
+                if (interfacetypeSymbol.IsInterface(systemMethodData.InterfaceName))
+                {
+                    if (interfacetypeSymbol.IsGenericType)
+                    {
+                        var typeArgs = ImmutableArray.Create<ITypeSymbol>(entityTypeSymbol).AddRange(interfacetypeSymbol.TypeArguments);
+                        if (!namedTypeSymbol.HasMethodWithParams(systemMethodData.MethodName, typeArgs.ToArray()))
+                        {
+                            StringBuilder str = new();
+                            str.Append(entityTypeSymbol);
+                            str.Append("/");
+                            str.Append(etSystemData.SystemAttributeShowName);
+                            foreach (ITypeSymbol? typeArgument in interfacetypeSymbol.TypeArguments)
+                            {
+                                str.Append("/");
+                                str.Append(typeArgument);
+                            }
+
+                            AddProperty(ref builder, $"{systemMethodData.MethodName}`{interfacetypeSymbol.TypeArguments.Length}", str.ToString());
+                        }
+                    }
+                    else
+                    {
+                        if (!namedTypeSymbol.HasMethodWithParams(systemMethodData.MethodName, entityTypeSymbol))
+                        {
+                            AddProperty(ref builder, systemMethodData.MethodName, $"{entityTypeSymbol}/{etSystemData.SystemAttributeShowName}");
+                        }
+                    }
+
+                    break;
+                }
+            }
+        }
+    }
+
+    
+
+    private void AddProperty(ref ImmutableDictionary<string, string?>.Builder? builder, string methodMetaName, string methodArgs)
+    {
+        if (builder == null)
+        {
+            builder = ImmutableDictionary.CreateBuilder<string, string?>();
+        }
+
+        if (builder.TryGetValue(Definition.EntitySystemInterfaceSequence, out string? seqValue))
+        {
+            builder[Definition.EntitySystemInterfaceSequence] = $"{seqValue}/{methodMetaName}";
+        }
+        else
+        {
+            builder.Add(Definition.EntitySystemInterfaceSequence, methodMetaName);
+        }
+
+        builder.Add(methodMetaName, methodArgs);
+    }
+
+    private void ReportNeedGenerateSystem(SymbolAnalysisContext context, INamedTypeSymbol namedTypeSymbol, ref ImmutableDictionary<string, string?>.Builder? builder)
+    {
+        if (builder == null)
+        {
+            return;
+        }
+
+        foreach (SyntaxReference? reference in namedTypeSymbol.DeclaringSyntaxReferences)
+        {
+            if (reference.GetSyntax() is ClassDeclarationSyntax classDeclarationSyntax)
+            {
+                Diagnostic diagnostic = Diagnostic.Create(EntitySystemAnalyzerRule.Rule, classDeclarationSyntax.Identifier.GetLocation(),
+                    builder.ToImmutable(), namedTypeSymbol.Name);
+                context.ReportDiagnostic(diagnostic);
+            }
+        }
+    }
+    
+    private void AnalyzeIsSystemMethodValid(SymbolAnalysisContext context)
+    {
+        if (!(context.Symbol is INamedTypeSymbol namedTypeSymbol))
+        {
+            return;
+        }
+        
+        foreach (ISymbol? symbol in namedTypeSymbol.GetMembers())
+        {
+            if (symbol is not IMethodSymbol methodSymbol)
+            {
+                continue;
+            }
+
+            foreach (var etSystemData in SupportedETSystemDatas)
+            {
+                if (!methodSymbol.HasAttribute(etSystemData.SystemAttributeMetaName))
+                {
+                    continue;
+                }
+
+                if (methodSymbol.Parameters.Length==0)
+                {
+                    continue;
+                }
+                
+                AttributeData? attr = namedTypeSymbol.GetFirstAttribute(etSystemData.SystemOfAttribute);
+                if (attr == null || attr.ConstructorArguments[0].Value is not INamedTypeSymbol entityTypeSymbol 
+                    || entityTypeSymbol.ToString()!=methodSymbol.Parameters[0].Type.ToString())
+                {
+                    ReportNeedSystemOfAttr(context,methodSymbol,etSystemData);
+                }
+            }
+        }
+    }
+    
+    private void ReportNeedSystemOfAttr(SymbolAnalysisContext context, IMethodSymbol methodSymbol,ETSystemData etSystemData)
+    {
+        
+        foreach (SyntaxReference? reference in methodSymbol.DeclaringSyntaxReferences)
+        {
+            if (reference.GetSyntax() is MethodDeclarationSyntax methodDeclarationSyntax)
+            {
+                Diagnostic diagnostic = Diagnostic.Create(EntitySystemMethodNeedSystemOfAttrAnalyzerRule.Rule, methodDeclarationSyntax.Identifier.GetLocation()
+                    ,methodSymbol.Name, etSystemData.SystemAttributeShowName,etSystemData.SystemOfAttribute);
+                context.ReportDiagnostic(diagnostic);
+            }
+        }
+    }
+
+}

+ 136 - 0
Share/Analyzer/CodeFixer/EntitySystemCodeFixProvider.cs

@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Immutable;
+using System.Composition;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CodeActions;
+using Microsoft.CodeAnalysis.CodeFixes;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.Editing;
+using Microsoft.CodeAnalysis.Formatting;
+using Microsoft.CodeAnalysis.Options;
+using Microsoft.CodeAnalysis.Simplification;
+
+namespace ET.Analyzer;
+
+[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(EntitySystemCodeFixProvider)), Shared]
+public class EntitySystemCodeFixProvider:CodeFixProvider
+{
+    public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DiagnosticIds.EntitySystemAnalyzerRuleId);
+    public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
+    public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
+    {
+        SyntaxNode? root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
+            
+        Diagnostic diagnostic = context.Diagnostics.First();
+
+        Microsoft.CodeAnalysis.Text.TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;
+        
+        ClassDeclarationSyntax? classDeclaration = root?.FindToken(diagnosticSpan.Start).Parent?.AncestorsAndSelf().OfType<ClassDeclarationSyntax>().First();
+        
+        CodeAction codeAction = CodeAction.Create(
+            "Generate Entity System",
+            cancelToken => GenerateEntitySystemAsync(context.Document,classDeclaration,diagnostic,cancelToken), 
+            equivalenceKey: nameof(EntitySystemCodeFixProvider));
+        context.RegisterCodeFix(codeAction,diagnostic);
+    }
+
+    private static async Task<Document> GenerateEntitySystemAsync(Document document, ClassDeclarationSyntax? classDeclaration,Diagnostic diagnostic,
+    CancellationToken cancellationToken)
+    {
+        await Task.CompletedTask;
+        SyntaxNode? root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
+        ImmutableDictionary<string, string?> properties = diagnostic.Properties;
+
+        
+        if (classDeclaration==null || root==null)
+        {
+            return document;
+        }
+
+        var newMembers = new SyntaxList<MemberDeclarationSyntax>();
+        string? seuqenceStr = properties[Definition.EntitySystemInterfaceSequence];
+        if (seuqenceStr==null)
+        {
+            return document;
+        }
+
+        string[] sequenceArr = seuqenceStr.Split('/');
+        for (int i = 0; i < sequenceArr.Length; i++)
+        {
+            string methodName = sequenceArr[i];
+            string? methodArgs = properties[methodName];
+            if (methodArgs==null)
+            {
+                continue;
+            }
+            var methodSyntax = CreateEntitySystemMethodSyntax(methodName, methodArgs);
+            if (methodSyntax!=null)
+            {
+                newMembers = newMembers.Add(methodSyntax);
+            }
+            else
+            {
+                throw new Exception("methodSyntax==null");
+            }
+        }
+
+        if (newMembers.Count==0)
+        {
+            throw new Exception("newMembers.Count==0");
+        }
+        
+        var newClassDeclaration = classDeclaration.WithMembers(classDeclaration.Members.AddRange(newMembers)).WithAdditionalAnnotations(Formatter.Annotation);
+        document = document.WithSyntaxRoot(root.ReplaceNode(classDeclaration, newClassDeclaration));
+        document = await CleanupDocumentAsync(document, cancellationToken);
+        return document;
+    }
+
+    private static MethodDeclarationSyntax? CreateEntitySystemMethodSyntax(string methodName,string methodArgs)
+    {
+        string[] methodNameArr =  methodName.Split('`');
+        string[] methodArgsArr = methodArgs.Split('/');
+        string systemAttr = methodArgsArr[1];
+        string args = String.Empty;
+        if (methodArgsArr.Length>2)
+        {
+            for (int i = 2; i < methodArgsArr.Length; i++)
+            {
+                args += $", {methodArgsArr[i]} args{i}";
+            }
+        }
+        string code = $$"""
+        [{{systemAttr}}]
+        private static void {{methodNameArr[0]}}(this {{methodArgsArr[0]}} self{{args}})
+        {
+            
+        }
+""";
+        return SyntaxFactory.ParseMemberDeclaration(code) as MethodDeclarationSyntax;
+    }
+    
+    internal static async Task<Document> CleanupDocumentAsync(
+    Document document, CancellationToken cancellationToken)
+    {
+        if (document.SupportsSyntaxTree)
+        {
+            document = await ImportAdder.AddImportsAsync(
+                document, Simplifier.AddImportsAnnotation, cancellationToken: cancellationToken).ConfigureAwait(false);
+
+            document = await Simplifier.ReduceAsync(document, Simplifier.Annotation, cancellationToken: cancellationToken).ConfigureAwait(false);
+
+            // format any node with explicit formatter annotation
+            document = await Formatter.FormatAsync(document, Formatter.Annotation, cancellationToken: cancellationToken).ConfigureAwait(false);
+
+            // format any elastic whitespace
+            document = await Formatter.FormatAsync(document, SyntaxAnnotation.ElasticAnnotation, cancellationToken: cancellationToken).ConfigureAwait(false);
+        }
+
+        return document;
+    }
+    
+}

+ 14 - 8
Share/Analyzer/Config/AnalyzeAssembly.cs

@@ -1,4 +1,6 @@
-namespace ET.Analyzer
+using System.IO;
+
+namespace ET.Analyzer
 {
     public static class AnalyzeAssembly
     {
@@ -13,29 +15,33 @@
         private const string UnityHotfixView = "Unity.HotfixView";
 
         public const string UnityCodes = "Unity.Codes";
+        public const string UnityAllModel = "Unity.AllModel";
+        public const string UnityAllHotfix = "Unity.AllHotfix";
 
         public static readonly string[] AllHotfix =
         {
-            DotNetHotfix, UnityHotfix, UnityHotfixView, 
+            DotNetHotfix, UnityHotfix, UnityHotfixView,
+            UnityAllHotfix,
         };
 
         public static readonly string[] AllModel =
         {
             DotNetModel, UnityModel, 
-            UnityModelView
+            UnityModelView,UnityAllModel
         };
 
         public static readonly string[] AllModelHotfix =
         {
             DotNetModel, DotNetHotfix, 
             UnityModel, UnityHotfix, UnityModelView, UnityHotfixView, 
+            UnityAllModel, UnityAllHotfix,
         };
         
         public static readonly string[] All =
         {
             DotNetCore, DotNetModel, DotNetHotfix, 
             UnityCore, UnityModel, UnityHotfix, UnityModelView, UnityHotfixView, 
-            UnityCodes,
+            UnityCodes,UnityAllModel, UnityAllHotfix,
         };
 
         public static readonly string[] ServerModelHotfix =
@@ -46,10 +52,10 @@
 
     public static class UnityCodesPath
     {
-        private const string UnityModel = @"Unity\Assets\Scripts\Model\";
-        private const string UnityModelView = @"Unity\Assets\Scripts\ModelView\";
-        private const string UnityHotfix = @"Unity\Assets\Scripts\Hotfix\";
-        private const string UnityHotfixView = @"Unity\Assets\Scripts\HotfixView\";
+        private static readonly string UnityModel = @"Unity\Assets\Scripts\Model\".Replace('\\',Path.DirectorySeparatorChar);
+        private static readonly string UnityModelView = @"Unity\Assets\Scripts\ModelView\".Replace('\\',Path.DirectorySeparatorChar);
+        private static readonly string UnityHotfix = @"Unity\Assets\Scripts\Hotfix\".Replace('\\',Path.DirectorySeparatorChar);
+        private static readonly string UnityHotfixView = @"Unity\Assets\Scripts\HotfixView\".Replace('\\',Path.DirectorySeparatorChar);
 
         public static readonly string[] AllModelHotfix =
         {

+ 43 - 0
Share/Analyzer/Config/Definition.cs

@@ -41,6 +41,49 @@
         public const string ETClientNameSpace = "ET.Client";
 
         public const string ClientDirInServer = @"Unity\Assets\Scripts\Codes\Hotfix\Client\";
+
+        public const string EntitySystemAttribute = "EntitySystem";
+        public const string EntitySystemAttributeMetaName = "ET.EntitySystemAttribute";
+
+        public const string EntitySystemOfAttribute = "ET.EntitySystemOfAttribute";
+        public const string EntitySystemInterfaceSequence = "EntitySystemInterfaceSequence";
+
+        public const string IAwakeInterface = "ET.IAwake";
+        public const string AwakeMethod = "Awake";
+
+        public const string IUpdateInterface = "ET.IUpdate";
+        public const string UpdateMethod = "Update";
+
+        public const string IDestroyInterface = "ET.IDestroy";
+        public const string DestroyMethod = "Destroy";
+
+        public const string IAddComponentInterface = "ET.IAddComponent";
+        public const string AddComponentMethod = "AddComponent";
+
+        public const string IDeserializeInterface = "ET.IDeserialize";
+        public const string DeserializeMethod = "Deserialize";
+
+        public const string IGetComponentInterface = "ET.IGetComponent";
+        public const string GetComponentMethod = "ET.GetComponent";
+
+        public const string ILoadInterface = "ET.ILoad";
+        public const string LoadMethod = "Load";
+
+        public const string ILateUpdateInterface = "ET.ILateUpdate";
+        public const string LateUpdateMethod = "LateUpdate";
+
+        public const string ISerializeInterface = "ET.ISerialize";
+        public const string SerializeMethod = "SerializeMethod";
+
+        public const string LSEntitySystemAttribute = "LSEntitySystem";
+        public const string LSEntitySystemAttributeMetaName = "ET.LSEntitySystemAttribute";
+        public const string LSEntitySystemOfAttribute = "ET.LSEntitySystemOfAttribute";
+
+        public const string ILSRollbackInterface = "ET.ILSRollback";
+        public const string LSRollbackMethod = "LSRollback";
+
+        public const string ILSUpdateInterface = "ET.ILSUpdate";
+        public const string LSUpdateMethod = "LSUpdate";
     }
 }
 

+ 4 - 0
Share/Analyzer/Config/DiagnosticIds.cs

@@ -48,5 +48,9 @@
 
         public const string LSEntityFloatMemberAnalyzerRuleId = "ET0023";
 
+        public const string EntitySystemAnalyzerRuleId = "ET0024";
+
+        public const string EntitySystemMethodNeedSystemOfAttrAnalyzerRuleId = "ET0025";
+
     }
 }

+ 36 - 0
Share/Analyzer/Config/DiagnosticRules.cs

@@ -323,4 +323,40 @@ namespace ET.Analyzer
                     true,
                     Description);
     }
+
+    public static class EntitySystemAnalyzerRule
+    {
+        private const string Title = "Entity类存在未生成的生命周期函数";
+
+        private const string MessageFormat = "Entity类: {0} 存在未生成的生命周期函数111";
+
+        private const string Description = "Entity类存在未生成的生命周期函数.";
+
+        public static readonly DiagnosticDescriptor Rule =
+                new DiagnosticDescriptor(DiagnosticIds.EntitySystemAnalyzerRuleId,
+                    Title,
+                    MessageFormat,
+                    DiagnosticCategories.Model,
+                    DiagnosticSeverity.Error,
+                    true,
+                    Description);
+    }
+
+    public static class EntitySystemMethodNeedSystemOfAttrAnalyzerRule
+    {
+        private const string Title = "EntitySystem标签只能添加在含有EntitySystemOf标签的静态类中";
+
+        private const string MessageFormat = "方法:{0}的{1}标签只能添加在含有{2}标签的静态类中";
+
+        private const string Description = "EntitySystem标签只能添加在含有EntitySystemOf标签的静态类中.";
+
+        public static readonly DiagnosticDescriptor Rule =
+                new DiagnosticDescriptor(DiagnosticIds.EntitySystemMethodNeedSystemOfAttrAnalyzerRuleId,
+                    Title,
+                    MessageFormat,
+                    DiagnosticCategories.Model,
+                    DiagnosticSeverity.Error,
+                    true,
+                    Description);
+    }
 }

+ 73 - 1
Share/Analyzer/Extension/AnalyzerHelper.cs

@@ -141,7 +141,7 @@ namespace ET.Analyzer
         {
             foreach (INamedTypeSymbol? iInterface in namedTypeSymbol.AllInterfaces)
             {
-                if (iInterface.ToString() == InterfaceName)
+                if (iInterface.IsInterface(InterfaceName))
                 {
                     return true;
                 }
@@ -150,6 +150,15 @@ namespace ET.Analyzer
             return false;
         }
 
+        /// <summary>
+        /// 某个接口symbol 是否是指定的接口
+        /// </summary>
+
+        public static bool IsInterface(this INamedTypeSymbol namedTypeSymbol, string InterfaceName)
+        {
+            return $"{namedTypeSymbol.GetNameSpace()}.{namedTypeSymbol.Name}" == InterfaceName;
+        }
+
         /// <summary>
         ///     判断指定的程序集是否需要分析
         /// </summary>
@@ -413,5 +422,68 @@ namespace ET.Analyzer
             }
             return false;
         }
+
+        /// <summary>
+        /// 类型symbol是否有指定名字 指定参数的方法
+        /// </summary>
+        public static bool HasMethodWithParams(this INamedTypeSymbol namedTypeSymbol, string methodName, params ITypeSymbol[] typeSymbols)
+        {
+            foreach (var member in namedTypeSymbol.GetMembers())
+            {
+                if (member is not IMethodSymbol methodSymbol)
+                {
+                    continue;
+                }
+
+                if (methodSymbol.Name!=methodName)
+                {
+                    continue;
+                }
+                
+                if (typeSymbols.Length!=methodSymbol.Parameters.Length)
+                {
+                    continue;
+                }
+                
+                if (typeSymbols.Length==0)
+                {
+                    return true;
+                }
+
+                bool isEqual = true;
+                
+                for (int i = 0; i < typeSymbols.Length; i++)
+                {
+                    if (typeSymbols[i].ToString()!=methodSymbol.Parameters[i].Type.ToString())
+                    {
+                        isEqual = false;
+                        break;
+                    }
+                }
+
+                if (isEqual)
+                {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+
+        /// <summary>
+        /// 方法symbol 是否有指定的attribute
+        /// </summary>
+        public static bool HasAttribute(this IMethodSymbol methodSymbol, string AttributeName)
+        {
+            foreach (AttributeData? attributeData in methodSymbol.GetAttributes())
+            {
+                if (attributeData?.AttributeClass?.ToString()==AttributeName)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
     }
 }

+ 1 - 1
Share/Analyzer/Share.Analyzer.csproj

@@ -4,7 +4,7 @@
         <TargetFramework>netstandard2.0</TargetFramework>
         <IncludeBuildOutput>false</IncludeBuildOutput>
         <Nullable>enable</Nullable>
-        <LangVersion>10</LangVersion>
+        <LangVersion>11</LangVersion>
     </PropertyGroup>
 
     <PropertyGroup>

+ 26 - 0
Unity/Assets/Scripts/Core/Analyzer/EntitySystemOf.cs

@@ -0,0 +1,26 @@
+using System;
+
+namespace ET
+{
+    [AttributeUsage(AttributeTargets.Class)]
+    public class EntitySystemOfAttribute: BaseAttribute
+    {
+        public Type type;
+
+        public EntitySystemOfAttribute(Type type)
+        {
+            this.type = type;
+        }
+    }
+    
+    [AttributeUsage(AttributeTargets.Class)]
+    public class LSEntitySystemOfAttribute: BaseAttribute
+    {
+        public Type type;
+
+        public LSEntitySystemOfAttribute(Type type)
+        {
+            this.type = type;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Core/Analyzer/EntitySystemOf.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 50901d1f8551c05499583f1a5d362d06
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/MailBoxComponent.cs

@@ -1,5 +1,6 @@
 namespace ET
 {
+    [EntitySystemOf(typeof(MailBoxComponent))]
     [FriendOf(typeof(MailBoxComponent))]
     public static partial class MailBoxComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs

@@ -4,6 +4,7 @@ using System.IO;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(ActorInnerComponent))]
     [FriendOf(typeof(ActorInnerComponent))]
     public static partial class ActorInnerComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs

@@ -2,6 +2,7 @@ using System;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(CoroutineLock))]
     public static partial class CoroutineLockSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(CoroutineLockComponent))]
     public static partial class CoroutineLockComponentSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(CoroutineLockQueue))]
     public static partial class CoroutineLockQueueSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs

@@ -2,6 +2,7 @@
 
 namespace ET
 {
+    [EntitySystemOf(typeof(CoroutineLockQueueType))]
     [FriendOf(typeof(CoroutineLockQueueType))]
     public static partial class CoroutineLockQueueTypeSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs

@@ -53,6 +53,7 @@ namespace ET
         public object Args;
     }
 
+    [EntitySystemOf(typeof(TimerComponent))]
     public static partial class TimerComponentSystem
     {
         [EntitySystem]

+ 14 - 6
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs

@@ -1,8 +1,15 @@
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(ClientSenderCompnent))]
     [FriendOf(typeof(ClientSenderCompnent))]
-    public static partial class NetClientProxyCompnentSystem
+    public static partial class ClientSenderCompnentSystem
     {
+        [EntitySystem]
+        private static void Awake(this ClientSenderCompnent self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Destroy(this ClientSenderCompnent self)
         {
@@ -11,23 +18,23 @@
                 FiberManager.Instance.Remove(self.fiberId);
             }
         }
-        
+
         public static async ETTask<long> LoginAsync(this ClientSenderCompnent self, string account, string password)
         {
             self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, "");
             self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId);
-            
-            NetClient2Main_Login response =await self.Fiber().ActorInnerComponent.Call(self.netClientActorId, new Main2NetClient_Login() {Account = account, Password = password}) as NetClient2Main_Login;
+
+            NetClient2Main_Login response = await self.Fiber().ActorInnerComponent.Call(self.netClientActorId, new Main2NetClient_Login() { Account = account, Password = password }) as NetClient2Main_Login;
             return response.PlayerId;
         }
-        
+
         public static void Send(this ClientSenderCompnent self, IMessage message)
         {
             A2NetClient_Message a2NetClientMessage = A2NetClient_Message.Create();
             a2NetClientMessage.MessageObject = message;
             self.Fiber().ActorInnerComponent.Send(self.netClientActorId, a2NetClientMessage);
         }
-        
+
         public static async ETTask<IResponse> Call(this ClientSenderCompnent self, IRequest request, bool needException = true)
         {
             A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create();
@@ -35,5 +42,6 @@
             A2NetClient_Response response = await self.Fiber().ActorInnerComponent.Call(self.netClientActorId, a2NetClientRequest, needException: needException) as A2NetClient_Response;
             return response.MessageObject;
         }
+
     }
 }

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs

@@ -2,6 +2,7 @@ using System;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(PingComponent))]
     public static partial class PingComponentSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs

@@ -5,6 +5,7 @@ using System.Net.Sockets;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(RouterAddressComponent))]
     [FriendOf(typeof(RouterAddressComponent))]
     public static partial class RouterAddressComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs

@@ -3,6 +3,7 @@ using System.Net;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(RouterCheckComponent))]
     public static partial class RouterCheckComponentSystem
     {
         [EntitySystem]

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

@@ -3,6 +3,7 @@ using System.IO;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(LSClientUpdater))]
     [FriendOf(typeof (LSClientUpdater))]
     public static partial class LSClientUpdaterSystem
     {

+ 11 - 4
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs

@@ -2,9 +2,16 @@ using System;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(LSReplayUpdater))]
     [FriendOf(typeof(LSReplayUpdater))]
     public static partial class LSReplayUpdaterSystem
     {
+        [EntitySystem]
+        private static void Awake(this LSReplayUpdater self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Update(this LSReplayUpdater self)
         {
@@ -19,7 +26,7 @@ namespace ET.Client
                 {
                     break;
                 }
-                
+
                 if (timeNow < room.FixedTimeCounter.FrameTime(room.AuthorityFrame + 1))
                 {
                     break;
@@ -28,10 +35,10 @@ namespace ET.Client
                 ++room.AuthorityFrame;
 
                 OneFrameInputs oneFrameInputs = room.Replay.FrameInputs[room.AuthorityFrame];
-            
+
                 room.Update(oneFrameInputs);
                 room.SpeedMultiply = ++i;
-                
+
                 long timeNow2 = fiber.TimeInfo.ServerNow();
                 if (timeNow2 - timeNow > 5)
                 {
@@ -52,7 +59,7 @@ namespace ET.Client
             {
                 lsReplayUpdater.ReplaySpeed *= 2;
             }
-            
+
             int updateInterval = LSConstValue.UpdateInterval / lsReplayUpdater.ReplaySpeed;
             room.FixedTimeCounter.ChangeInterval(updateInterval, room.AuthorityFrame);
         }

+ 7 - 0
Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs

@@ -1,7 +1,14 @@
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(ClientSessionErrorComponent))]
     public static partial class ClientSessionErrorComponentSystem
     {
+        [EntitySystem]
+        private static void Awake(this ClientSessionErrorComponent self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Destroy(this ClientSessionErrorComponent self)
         {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs

@@ -4,6 +4,7 @@ using MongoDB.Bson;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(NetClientComponent))]
     [FriendOf(typeof(NetClientComponent))]
     public static partial class NetClientComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs

@@ -4,6 +4,7 @@ using ET.Client;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(BenchmarkClientComponent))]
     public static partial class BenchmarkClientComponentSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/PlayerSystem.cs

@@ -1,5 +1,6 @@
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(Player))]
     [FriendOf(typeof(Player))]
     public static partial class PlayerSystem
     {

+ 7 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs

@@ -1,5 +1,6 @@
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(SessionPlayerComponent))]
     public static partial class SessionPlayerComponentSystem
     {
         [EntitySystem]
@@ -13,5 +14,11 @@
             // 发送断线消息
             root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Send(self.Player.Id, new G2M_SessionDisconnect());
         }
+        
+        [EntitySystem]
+        private static void Awake(this SessionPlayerComponent self)
+        {
+
+        }
     }
 }

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs

@@ -3,6 +3,7 @@ using System.Diagnostics;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(WatcherComponent))]
     [FriendOf(typeof(WatcherComponent))]
     public static partial class WatcherComponentSystem
     {

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

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(RoomServerComponent))]
     [FriendOf(typeof(RoomServerComponent))]
     public static partial class RoomServerComponentSystem
     {

+ 12 - 5
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs

@@ -3,16 +3,23 @@ using System.Collections.Generic;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(LSServerUpdater))]
     [FriendOf(typeof(LSServerUpdater))]
     public static partial class LSServerUpdaterSystem
     {
+        [EntitySystem]
+        private static void Awake(this LSServerUpdater self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Update(this LSServerUpdater self)
         {
             Room room = self.GetParent<Room>();
             long timeNow = room.Fiber().TimeInfo.ServerFrameTime();
-            
-            
+
+
             int frame = room.AuthorityFrame + 1;
             if (timeNow < room.FixedTimeCounter.FrameTime(frame))
             {
@@ -26,7 +33,7 @@ namespace ET.Server
             oneFrameInputs.CopyTo(sendInput);
 
             RoomMessageHelper.BroadCast(room, sendInput);
-            
+
             room.Update(oneFrameInputs);
         }
 
@@ -36,7 +43,7 @@ namespace ET.Server
             FrameBuffer frameBuffer = room.FrameBuffer;
             OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(frame);
             frameBuffer.MoveForward(frame);
-            
+
             if (oneFrameInputs.Inputs.Count == LSConstValue.MatchCount)
             {
                 return oneFrameInputs;
@@ -45,7 +52,7 @@ namespace ET.Server
             OneFrameInputs preFrameInputs = null;
             if (frameBuffer.CheckFrame(frame - 1))
             {
-                preFrameInputs = frameBuffer.FrameInputs(frame - 1);    
+                preFrameInputs = frameBuffer.FrameInputs(frame - 1);
             }
 
             // 有人输入的消息没过来,给他使用上一帧的操作

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

@@ -3,6 +3,7 @@ using Unity.Mathematics;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(AOIEntity))]
     [FriendOf(typeof(AOIEntity))]
     public static partial class AOIEntitySystem2
     {

+ 13 - 5
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/CellSystem.cs

@@ -3,9 +3,16 @@ using System.Text;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(Cell))]
     [FriendOf(typeof(Cell))]
     public static partial class CellSystem
     {
+        [EntitySystem]
+        private static void Awake(this ET.Server.Cell self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Destroy(this Cell self)
         {
@@ -15,21 +22,21 @@ namespace ET.Server
 
             self.SubsLeaveEntities.Clear();
         }
-        
+
         public static void Add(this Cell self, AOIEntity aoiEntity)
         {
             self.AOIUnits.Add(aoiEntity.Id, aoiEntity);
         }
-        
+
         public static void Remove(this Cell self, AOIEntity aoiEntity)
         {
             self.AOIUnits.Remove(aoiEntity.Id);
         }
-        
+
         public static string CellIdToString(this long cellId)
         {
-            int y = (int) (cellId & 0xffffffff);
-            int x = (int) ((ulong) cellId >> 32);
+            int y = (int)(cellId & 0xffffffff);
+            int x = (int)((ulong)cellId >> 32);
             return $"{x}:{y}";
         }
 
@@ -44,5 +51,6 @@ namespace ET.Server
 
             return sb.ToString();
         }
+
     }
 }

+ 2 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -4,6 +4,7 @@ using MongoDB.Bson;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(ActorLocationSenderOneType))]
     [FriendOf(typeof(ActorLocationSenderOneType))]
     [FriendOf(typeof(ActorLocationSender))]
     public static partial class ActorLocationSenderComponentSystem
@@ -288,6 +289,7 @@ namespace ET.Server
         }
     }
 
+    [EntitySystemOf(typeof(ActorLocationSenderComponent))]
     [FriendOf(typeof (ActorLocationSenderComponent))]
     public static partial class ActorLocationSenderManagerComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs

@@ -2,6 +2,7 @@ using System;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(ActorLocationSender))]
     [FriendOf(typeof(ActorLocationSender))]
     public static partial class ActorLocationSenderSystem
     {

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs

@@ -2,6 +2,7 @@
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(LockInfo))]
     [FriendOf(typeof(LockInfo))]
     public static partial class LockInfoSystem
     {
@@ -21,7 +22,7 @@ namespace ET.Server
     }
     
 
-    
+    [EntitySystemOf(typeof(LocationOneType))]
     [FriendOf(typeof(LocationOneType))]
     [FriendOf(typeof(LockInfo))]
     public static partial class LocationOneTypeSystem
@@ -115,7 +116,7 @@ namespace ET.Server
         }
     }
 
-
+    [EntitySystemOf(typeof(LocationManagerComoponent))]
     [FriendOf(typeof (LocationManagerComoponent))]
     public static partial class LocationComoponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs

@@ -5,6 +5,7 @@ using MongoDB.Driver;
 
 namespace ET.Server
 {
+	[EntitySystemOf(typeof(DBComponent))]
 	[FriendOf(typeof(DBComponent))]
     public static partial class DBComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs

@@ -4,6 +4,7 @@ using System.Net;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(HttpComponent))]
     [FriendOf(typeof(HttpComponent))]
     public static partial class HttpComponentSystem
     {

+ 2 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs

@@ -3,10 +3,11 @@ using System.Net;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(ActorOuterComponent))]
     [FriendOf(typeof(ActorOuterComponent))]
     public static partial class ActorOuterComponentSystem
     {
-[EntitySystem]
+        [EntitySystem]
         private static void Awake(this ActorOuterComponent self, IPEndPoint address)
         {
             switch (self.InnerProtocol)

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

@@ -3,6 +3,7 @@ using MongoDB.Bson;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(NetServerComponent))]
     [FriendOf(typeof(NetServerComponent))]
     public static partial class NetServerComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs

@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
 
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(RouterComponent))]
     [FriendOf(typeof (RouterComponent))]
     [FriendOf(typeof (RouterNode))]
     public static partial class RouterComponentSystem

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

@@ -1,5 +1,6 @@
 namespace ET.Server
 {
+    [EntitySystemOf(typeof(RouterNode))]
     [FriendOf(typeof(RouterNode))]
     public static partial class RouterNodeSystem
     {

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

@@ -4,10 +4,18 @@ using TrueSync;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(LSInputComponent))]
+    [LSEntitySystemOf(typeof(LSInputComponent))]
     public static partial class LSInputComponentSystem
     {
+        [EntitySystem]
+        private static void Awake(this LSInputComponent self)
+        {
+
+        }
+        
         [LSEntitySystem]
-        public static void LSUpdate(this LSInputComponent self)
+        private static void LSUpdate(this LSInputComponent self)
         {
             LSUnit unit = self.GetParent<LSUnit>();
 

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

@@ -2,6 +2,7 @@ using System;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(AIComponent))]
     [FriendOf(typeof(AIComponent))]
     [FriendOf(typeof(AIDispatcherComponent))]
     public static partial class AIComponentSystem

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(ConsoleComponent))]
     [FriendOf(typeof(ConsoleComponent))]
     [FriendOf(typeof(ModeContex))]
     public static partial class ConsoleComponentSystem

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs

@@ -2,6 +2,7 @@
 
 namespace ET
 {
+    [EntitySystemOf(typeof(SessionAcceptTimeoutComponent))]
     [FriendOf(typeof(SessionAcceptTimeoutComponent))]
     public static partial class SessionAcceptTimeoutComponentHelper
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs

@@ -2,6 +2,7 @@ using System;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(SessionIdleCheckerComponent))]
     [FriendOf(typeof(SessionIdleCheckerComponent))]
     public static partial class SessionIdleCheckerComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs

@@ -4,6 +4,7 @@ using Unity.Mathematics;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(MoveComponent))]
     [FriendOf(typeof(MoveComponent))]
     public static partial class MoveComponentSystem
     {

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

@@ -4,6 +4,7 @@ using Unity.Mathematics;
 
 namespace ET
 {
+    [EntitySystemOf(typeof(PathfindingComponent))]
     [FriendOf(typeof(PathfindingComponent))]
     public static partial class PathfindingComponentSystem
     {

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

@@ -1,5 +1,6 @@
 namespace ET
 {
+    [EntitySystemOf(typeof(Unit))]
     public static partial class UnitSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(OperaComponent))]
     [FriendOf(typeof(OperaComponent))]
     public static partial class OperaComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelper.cs

@@ -8,6 +8,7 @@
             return await scene.GetComponent<UIComponent>().Create(uiType, uiLayer);
         }
         
+        [EnableAccessEntiyChild]
         public static async ETTask Remove(Entity scene, string uiType)
         {
             scene.GetComponent<UIComponent>().Remove(uiType);

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(UILobbyComponent))]
     [FriendOf(typeof(UILobbyComponent))]
     public static partial class UILobbyComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
+	[EntitySystemOf(typeof(UILoginComponent))]
 	[FriendOf(typeof(UILoginComponent))]
 	public static partial class UILoginComponentSystem
 	{

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/AnimatorComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+	[EntitySystemOf(typeof(AnimatorComponent))]
 	[FriendOf(typeof(AnimatorComponent))]
 	public static partial class AnimatorComponentSystem
 	{

+ 7 - 0
Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/GameObjectComponentSystem.cs

@@ -2,6 +2,7 @@
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(GameObjectComponent))]
     public static partial class GameObjectComponentSystem
     {
         [EntitySystem]
@@ -9,5 +10,11 @@ namespace ET.Client
         {
             UnityEngine.Object.Destroy(self.GameObject);
         }
+        
+        [EntitySystem]
+        private static void Awake(this GameObjectComponent self)
+        {
+
+        }
     }
 }

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/Camera/LSCameraComponentSystem.cs

@@ -2,6 +2,7 @@
 
 namespace ET.Client
 {
+	[EntitySystemOf(typeof(LSCameraComponent))]
 	[FriendOf(typeof(LSCameraComponent))]
 	public static partial class LSCameraComponentSystem
 	{

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSAnimatorComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+	[EntitySystemOf(typeof(LSAnimatorComponent))]
 	[FriendOf(typeof(LSAnimatorComponent))]
 	public static partial class LSAnimatorComponentSystem
 	{

+ 9 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSOperaComponentSystem.cs

@@ -3,9 +3,16 @@ using UnityEngine;
 
 namespace ET.Client
 {
-    [FriendOf(typeof (LSClientUpdater))]
+    [EntitySystemOf(typeof(LSOperaComponent))]
+    [FriendOf(typeof(LSClientUpdater))]
     public static partial class LSOperaComponentSystem
     {
+        [EntitySystem]
+        private static void Awake(this ET.LSOperaComponent self)
+        {
+
+        }
+        
         [EntitySystem]
         private static void Update(this LSOperaComponent self)
         {
@@ -33,5 +40,6 @@ namespace ET.Client
             LSClientUpdater lsClientUpdater = self.GetParent<Room>().GetComponent<LSClientUpdater>();
             lsClientUpdater.Input.V = v.normalized;
         }
+
     }
 }

+ 7 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs

@@ -2,6 +2,7 @@
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(LSUnitViewComponent))]
     public static partial class LSUnitViewComponentSystem
     {
         [EntitySystem]
@@ -25,5 +26,11 @@ namespace ET.Client
                 lsUnitView.AddComponent<LSAnimatorComponent>();
             }
         }
+        
+        [EntitySystem]
+        private static void Destroy(this LSUnitViewComponent self)
+        {
+
+        }
     }
 }

+ 3 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewSystem.cs

@@ -4,7 +4,9 @@ using UnityEngine;
 
 namespace ET.Client
 {
-    [FriendOfAttribute(typeof(ET.LSUnitView))]
+    [EntitySystemOf(typeof(LSUnitView))]
+    [LSEntitySystemOf(typeof(LSUnitView))]
+    [FriendOf(typeof(LSUnitView))]
     public static partial class LSUnitViewSystem
     {
         [EntitySystem]

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs

@@ -4,6 +4,7 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(UILSLobbyComponent))]
     [FriendOf(typeof(UILSLobbyComponent))]
     public static partial class UILSLobbyComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs

@@ -3,6 +3,7 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(UILSLoginComponent))]
     [FriendOf(typeof(UILoginComponent))]
     [FriendOfAttribute(typeof(ET.Client.UILSLoginComponent))]
     public static partial class UILSLoginComponentSystem

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomComponentSystem.cs

@@ -4,6 +4,7 @@ using UnityEngine.UI;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(UILSRoomComponent))]
     [FriendOf(typeof (UILSRoomComponent))]
     public static partial class UILSRoomComponentSystem
     {

+ 1 - 0
Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIComponentSystem.cs

@@ -5,6 +5,7 @@ namespace ET.Client
 	/// <summary>
 	/// 管理Scene上的UI
 	/// </summary>
+	[EntitySystemOf(typeof(UIComponent))]
 	[FriendOf(typeof(UIComponent))]
 	public static partial class UIComponentSystem
 	{

+ 3 - 2
Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs

@@ -3,7 +3,8 @@ using UnityEngine;
 
 namespace ET.Client
 {
-
+    [EntitySystemOf(typeof(UIGlobalComponent))]
+    [FriendOf(typeof(UIGlobalComponent))]
     public static partial class UIGlobalComponentSystem
     {
         [EntitySystem]
@@ -17,7 +18,7 @@ namespace ET.Client
             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 async ETTask<UI> OnCreate(this UIGlobalComponent self, UIComponent uiComponent, string uiType, UILayer uiLayer)
         {
             try

+ 1 - 0
Unity/Assets/Scripts/Loader/GlobalComponent.cs

@@ -15,6 +15,7 @@ namespace ET
         }
     }
     
+    [ComponentOf(typeof(Scene))]
     public class GlobalComponent: Entity, IAwake
     {
         public Transform Global;

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Demo/Watcher/WatcherComponent.cs

@@ -4,7 +4,7 @@ using System.Diagnostics;
 namespace ET.Server
 {
     [ComponentOf(typeof(Scene))]
-    public class WatcherComponent: Entity, IAwake, IDestroy
+    public class WatcherComponent: Entity, IAwake
     {
         public readonly Dictionary<int, System.Diagnostics.Process> Processes = new Dictionary<int, System.Diagnostics.Process>();
     }

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs

@@ -15,7 +15,7 @@ namespace ET.Server
     
     
     [ComponentOf(typeof(Scene))]
-    public class ActorLocationSenderComponent: Entity, IAwake, IDestroy
+    public class ActorLocationSenderComponent: Entity, IAwake
     {
         public const long TIMEOUT_TIME = 60 * 1000;
 

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/DB/DBComponent.cs

@@ -6,7 +6,7 @@ namespace ET.Server
     /// 用来缓存数据
     /// </summary>
     [ChildOf(typeof(DBManagerComponent))]
-    public class DBComponent: Entity, IAwake<string, string, int>, IDestroy
+    public class DBComponent: Entity, IAwake<string, string, int>
     {
         public const int TaskCount = 32;
 

+ 1 - 0
Unity/Assets/Scripts/Model/Share/Module/Console/ModeContex.cs

@@ -1,5 +1,6 @@
 namespace ET
 {
+    [EntitySystemOf(typeof(ModeContex))]
     [FriendOf(typeof(ModeContex))]
     public static partial class ModeContexSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs

@@ -17,6 +17,7 @@ namespace ET
         }
     }
     
+    [EntitySystemOf(typeof(Session))]
     [FriendOf(typeof(Session))]
     public static partial class SessionSystem
     {

+ 1 - 0
Unity/Assets/Scripts/Model/Share/Module/ObjectWait/ObjectWait.cs

@@ -21,6 +21,7 @@ namespace ET
         }
     }
 
+    [EntitySystemOf(typeof(ObjectWait))]
     [FriendOf(typeof(ObjectWait))]
     public static partial class ObjectWaitSystem
     {

+ 2 - 0
Unity/Assets/Scripts/ModelView/Client/Module/Resource/ResourcesComponent.cs

@@ -7,6 +7,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(ABInfo))]
     [FriendOf(typeof (ABInfo))]
     public static partial class ABInfoSystem
     {
@@ -103,6 +104,7 @@ namespace ET.Client
         }
     }
 
+    [EntitySystemOf(typeof(ResourcesComponent))]
     [FriendOf(typeof (ABInfo))]
     [FriendOf(typeof (ResourcesComponent))]
     public static partial class ResourcesComponentSystem

+ 9 - 2
Unity/Assets/Scripts/ModelView/Client/Module/Resource/ResourcesLoaderComponent.cs

@@ -2,7 +2,8 @@ using System.Collections.Generic;
 
 namespace ET.Client
 {
-    [FriendOf(typeof (ResourcesLoaderComponent))]
+    [EntitySystemOf(typeof(ResourcesLoaderComponent))]
+    [FriendOf(typeof(ResourcesLoaderComponent))]
     public static partial class ResourcesLoaderComponentSystem
     {
         [EntitySystem]
@@ -12,7 +13,7 @@ namespace ET.Client
             {
                 Fiber fiber = self.Fiber();
                 using ListComponent<string> list = ListComponent<string>.Create();
-                
+
                 TimerComponent timerComponent = fiber.TimerComponent;
                 list.AddRange(self.LoadedResource);
                 self.LoadedResource = null;
@@ -62,6 +63,12 @@ namespace ET.Client
             self.LoadedResource.Add(ab);
             await self.Root().GetComponent<ResourcesComponent>().LoadBundleAsync(ab);
         }
+        
+        [EntitySystem]
+        private static void Awake(this ResourcesLoaderComponent self)
+        {
+
+        }
     }
 
     [ComponentOf]

+ 1 - 0
Unity/Assets/Scripts/ModelView/Client/Module/UI/UI.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+    [EntitySystemOf(typeof(UI))]
     [FriendOf(typeof(UI))]
     public static partial class UISystem
     {

+ 1 - 0
Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs

@@ -3,6 +3,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+    [ComponentOf(typeof(Scene))]
     public class UIGlobalComponent: Entity, IAwake
     {
         public Dictionary<int, Transform> UILayers = new Dictionary<int, Transform>();