using Microsoft.CodeAnalysis; namespace ET.Analyzer { public static class ETTaskInSyncMethodAnalyzerRule { private const string Title = "ETTask方法调用在非异步方法体内使用错误"; private const string MessageFormat = "方法: {0} 在非异步方法体内使用时需要添加.Coroutine()后缀"; private const string Description = "ETTask方法调用在非异步方法体内使用错误."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.ETTaskInSyncMethodAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Hotfix, DiagnosticSeverity.Error, true, Description); } public static class ETTaskInAsyncMethodAnalyzerRule { private const string Title = "ETTask方法调用在异步方法体内使用错误"; private const string MessageFormat = "方法: {0} 在异步方法体内使用时需要添加await前缀 或 .Coroutine()后缀"; private const string Description = "ETTask方法调用在异步方法体内使用错误."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.ETTaskInAsyncMethodAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Hotfix, DiagnosticSeverity.Error, true, Description); } public static class UniqueIdRangeAnaluzerRule { private const string Title = "唯一Id字段数值区间约束"; private const string MessageFormat = "类: {0} Id字段: {1}的值: {2} 不在约束的区间内, 请修改"; private const string Description = "唯一Id字段数值区间约束."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.UniqueIdRangeAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Model, DiagnosticSeverity.Error, true, Description); } public static class UniqueIdDuplicateAnalyzerRule { private const string Title = "唯一Id字段禁止重复"; private const string MessageFormat = "类: {0} Id字段: {1}的值: {2} 与其他Id字段值重复, 请修改"; private const string Description = "唯一Id字段禁止重复."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.UniqueIdDuplicateAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Model, DiagnosticSeverity.Error, true, Description); } public static class AddChildTypeAnalyzerRule { private const string Title = "AddChild方法类型约束错误"; private const string MessageFormat = "Type: {0} 不允许作为实体: {1} 的AddChild函数参数类型! 若要允许该类型作为参数,请使用ChildOfAttribute对child实体类标记父级类型"; private const string Description = "AddChild方法类型约束错误."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.AddChildTypeAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Hotfix, DiagnosticSeverity.Error, true, Description); } public static class DisableAccessEntityChildAnalyzerRule { private const string Title = "禁止在Entity类中直接调用Child和Component"; private const string MessageFormat = "禁止在Entity类中直接调用Child和Component"; private const string Description = "禁止在Entity类中直接调用Child和Component."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.DisableUseChildComponentInEntityAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Hotfix, DiagnosticSeverity.Error, true, Description); } public static class EntityComponentAnalyzerRule { private const string Title = "实体类添加或获取组件类型错误"; private const string MessageFormat = "组件类型: {0} 不允许作为实体: {1} 的组件类型! 若要允许该类型作为参数,请使用ComponentOfAttribute对组件类标记父级实体类型"; private const string Description = "实体类添加或获取组件类型错误."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.EntityComponentAnalyzerRuleId, Title, MessageFormat, DiagnosticCategories.Hotfix, DiagnosticSeverity.Error, true, Description); } public static class StaticFieldDeclarationAnalyzerRule { private const string Title = "Static字段声明需要标记标签"; private const string MessageFormat = "Static字段声明 {0} 需要标记标签"; private const string Description = "Static字段声明需要标记标签."; public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticIds.StaticFieldDeclarationAnalyzerRule, Title, MessageFormat, DiagnosticCategories.All, DiagnosticSeverity.Error, true, Description); } }