Compare commits

..

101 Commits

Author SHA1 Message Date
gewuyou
cf486cbeff
Merge pull request #128 from GeWuYou/feat/get-node-generator
feat(godot): 添加 GetNode 源代码生成器功能
2026-03-22 15:34:00 +08:00
gewuyou
8d656b90a7
Merge pull request #129 from GeWuYou/deepsource-autofix-b7cf8394
refactor: simplify single-statement getter
2026-03-22 15:30:07 +08:00
GeWuYou
fc386fb4bc refactor(generator): 调整项目文件夹结构
- 移除 logging 文件夹引用
- 将 diagnostics 文件夹重命名为 Diagnostics
- 更新项目文件中的文件夹路径配置
2026-03-22 15:28:39 +08:00
deepsource-autofix[bot]
bbf1dc8d0c
refactor: simplify single-statement getter
This PR refactors properties that contain only a single return statement by converting them to expression-bodied members, reducing boilerplate and improving readability.

- Getters and setters with a single statement in their bodies can be simplified: The `IsDone` property originally used a full getter block to evaluate whether all coroutine handles are inactive. We replaced it with an expression-bodied property (`public bool IsDone => _handles.All(handle => !_scheduler.IsCoroutineAlive(handle));`) and relocated the explanatory comment above it, streamlining the code.

> This Autofix was generated by AI. Please review the change before merging.
2026-03-22 07:24:25 +00:00
GeWuYou
b95c65a30e refactor(generator): 优化GetNodeGenerator代码结构
- 使用语法树遍历替代字符串匹配来检测注入方法调用
- 添加IsGeneratedInjectionInvocation辅助方法提高代码可读性
- 将字段分组逻辑从列表查找改为字典映射提升性能
- 优化GroupByContainingType方法的时间复杂度
2026-03-22 15:23:51 +08:00
GeWuYou
9ab09cf47b feat(godot): 添加 GetNode 源代码生成器功能
- 实现了 [GetNode] 属性用于标记 Godot 节点字段
- 创建了 GetNodeGenerator 源代码生成器自动注入节点获取逻辑
- 添加了节点路径推导和多种查找模式支持
- 集成了生成器到 Godot 脚手架模板中
- 添加了完整的诊断规则和错误提示
- 创建了单元测试验证生成器功能
- 更新了解决方案配置以包含新的测试项目
- 在 README 中添加了详细的使用文档和示例代码
2026-03-22 15:16:24 +08:00
gewuyou
63b1d71a0e
Merge pull request #127 from GeWuYou/feat/async-log-appender-error-handler
feat(logging): 添加异步日志输出器的错误处理回调功能
2026-03-21 22:09:06 +08:00
GeWuYou
cdc49c319a feat(logging): 添加异步日志输出器功能
- 使用 Channel 实现异步日志处理机制
- 解耦调用线程与慢速日志目标
- 添加全局 Channels 命名空间引用
- 完善日志组件的异步处理能力
2026-03-21 22:04:09 +08:00
GeWuYou
d94d8deb29 fix(logging): 修复异步日志追加器中的操作取消异常处理
- 添加对 OperationCanceledException 的特殊处理,避免将其报告为后台处理错误
- 在 ReportProcessingError 方法中检查并过滤掉操作取消异常
- 添加单元测试验证当内部追加器抛出 OperationCanceledException 时不报告错误
- 创建 CancellationAppender 测试辅助类来模拟取消异常场景
- 确保取消相关的异常不会触发错误处理逻辑
2026-03-21 21:59:51 +08:00
GeWuYou
49609d3821 feat(logging): 添加异步日志输出器的错误处理回调功能
- 在 AsyncLogAppender 构造函数中添加 processingErrorHandler 参数用于处理后台异常
- 实现 ReportProcessingError 方法安全上报后台处理异常而不影响处理循环
- 更新文档注释说明异常处理机制和错误回调用途
- 修改测试用例验证异常处理回调功能的正确性
- 确保错误观察者异常不会终止日志处理线程
- 移除直接写入控制台错误输出的逻辑改为统一回调处理
2026-03-21 21:54:24 +08:00
gewuyou
003fe42ad8
Merge pull request #126 from GeWuYou/refactor/generators-downgrade-to-netstandard20
refactor(generators): 将源代码生成器项目目标框架降级至 netstandard2.0
2026-03-21 21:40:43 +08:00
GeWuYou
a42ec0c282 fix(generator): 修复优先级生成器中的部分关键字检查逻辑
- 将语法节点的部分关键字检查从 Any 操作改为 All 操作
- 修正了对非部分类的诊断报告条件判断
- 确保只有当所有修饰符都不是部分关键字时才报告错误
2026-03-21 21:31:52 +08:00
GeWuYou
884249649d chore(build): 配置项目构建属性以支持源代码生成器
- 为 GFramework.Godot 项目添加 GodotProjectDir 属性默认值
- 在 GFramework 元包中添加 NoPackageAnalysis 属性配置
- 为不同 .NET 版本添加占位符文件到包输出中
- 确保源代码生成器在标准 SDK 构建中正常运行
2026-03-21 21:30:29 +08:00
GeWuYou
d582dffe40 refactor(generators): 将源代码生成器项目目标框架降级至 netstandard2.0
- 将 GFramework.Godot.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators.Abstractions 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 将 GFramework.SourceGenerators.Common 项目的目标框架从 netstandard2.1 更改为 netstandard2.0
- 从 GFramework.SourceGenerators 项目中移除对 GFramework.Core.Abstractions 的引用
- 从 GFramework.SourceGenerators.Abstractions 项目中移除对 GFramework.Core.Abstractions 的引用
- 更新 PriorityGenerator 中的语法检查逻辑,使用 Any 替代 All 进行 partial 关键字检查
- 更新 PriorityAttribute 文档注释中的 cref 格式为 c 标签
2026-03-21 21:20:32 +08:00
GeWuYou
63a6c2e6f0 refactor(abstractions): 移除重复的Key属性声明
- 从LockInfo结构体移除StructLayout特性
- 从ISceneBehavior接口移除重复的Key属性声明
- 从IUiPageBehavior接口移除重复的Key属性声明
- 简化LockInfo类定义减少不必要的using引用
2026-03-21 21:13:53 +08:00
GeWuYou
f3d45169cd refactor(pause): 将暂停状态变化事件改为标准事件模式
- 将 OnPauseStateChanged 事件从 Action<PauseGroup, bool> 类型改为 EventHandler<PauseStateChangedEventArgs>
- 添加 PauseStateChangedEventArgs 类来封装事件数据
- 更新所有事件处理方法的签名以匹配新的事件参数
- 修改文档中相关的事件处理代码示例
- 在 PauseStackManager 中添加 RaisePauseStateChanged 方法统一处理事件触发
- 更新测试代码以适应新的事件处理方式
2026-03-21 21:13:53 +08:00
GeWuYou
86645d34cb fix(generator): 修复诊断消息中的多余句号
- 移除了 Priority 特性描述中的多余句号
- 移除了 IPrioritized 接口实现跳过警告中的多余句号
- 移除了 partial 类要求错误中的多余句号
- 移除了 Priority 特性值验证错误中的多余句号
- 移除了嵌套类限制错误中的多余句号
- 移除了服务获取建议信息中的多余句号
2026-03-21 20:51:03 +08:00
GeWuYou
ab04f0ace7 docs(diagnostic): 更新诊断消息描述文本
- 为 Priority 特性错误消息添加句号结尾
- 为接口实现警告消息添加句号结尾
- 为 partial 类要求错误消息添加句号结尾
- 为整数值验证错误消息添加句号结尾
- 为嵌套类限制错误消息添加句号结尾
- 为服务获取建议消息添加句号结尾
- 在测试项目配置中添加警告级别设置
2026-03-21 20:51:03 +08:00
gewuyou
51492b1dcd fix(docs): remove dead ADR references 2026-03-21 15:56:18 +08:00
gewuyou
4caa3c0d71
Merge pull request #122 from GeWuYou/feat/localization-compact-number-formatter
Feat/localization compact number formatter
2026-03-21 15:07:02 +08:00
GeWuYou
fca3808657 fix(localization): 修复紧凑数字格式化器处理未知选项的行为
- 修改 CompactNumberLocalizationFormatter 中 TryApplyOption 方法的返回逻辑
- 当键名未知时现在返回 true 而不是 false,允许忽略未知选项
- 更新 NumericDisplayFormatter 使用 ResolveRule 方法来确定格式化规则
- 添加对不同数值显示风格的支持和验证
- 在集成测试中添加未知选项的测试用例以验证正确行为
- 改进 NumericSuffixFormatRule 的文档注释以更清楚地描述功能
2026-03-21 15:01:47 +08:00
GeWuYou
5996ecf5f3 docs(core): 添加内置数值显示工具文档
- 新增内置数值显示工具使用说明
- 提供 FormatCompact 和 ToCompactString 示例代码
- 展示 NumericFormatOptions 配置选项用法
- 介绍本地化文本中的数值格式化功能
- 更新相关链接列表移除多余逗号
2026-03-21 14:43:55 +08:00
GeWuYou
53edd13f8f feat(localization): 添加本地化格式化器和数值显示功能
- 在LocalizationManager中注册内置格式化器包括条件、复数和紧凑数值格式化器
- 实现CompactNumberLocalizationFormatter支持{value:compact}格式化语法
- 添加数值显示扩展方法ToDisplayString和ToCompactString
- 实现NumericDisplayFormatter和NumericSuffixFormatRule数值格式化核心逻辑
- 添加数值格式化选项配置包括小数位数、四舍五入策略等参数
- 为紧凑数值格式化功能添加完整的单元测试覆盖各种数值类型和边界情况
2026-03-21 14:43:42 +08:00
gewuyou
0442fec2d1
Merge pull request #121 from GeWuYou/docs/refactor-guidelines-comprehensive
Docs/refactor guidelines comprehensive
2026-03-21 13:47:39 +08:00
GeWuYou
2001eddbff refactor(scripts): 重构AI环境生成脚本以优化工具选择逻辑
- 移除shell脚本中的冗余命令执行逻辑
- 添加select_tool函数统一处理工具偏好和回退逻辑
- 使用新函数重构搜索、JSON处理、脚本编写等工具选择
- 更新时间戳以反映代码变更后的重新生成
- 简化构建工具配置的回退策略
2026-03-21 12:49:51 +08:00
GeWuYou
3130a3bab2 feat(docs): 添加开发环境能力清单及相关工具脚本
- 在贡献指南中添加开发环境能力清单链接和说明
- 创建详细的开发环境能力清单文档,记录项目所需的运行时和工具
- 添加 .ai/environment/tools.ai.yaml 文件,为 AI 提供精简的环境能力信息
- 添加 .ai/environment/tools.raw.yaml 文件,存储完整的环境检测数据
- 创建 collect-dev-environment.sh 脚本,用于收集和输出环境信息
- 创建 generate-ai-environment.py 脚本,从原始数据生成 AI 友好的环境清单
- 在 .gitignore 中添加 .venv/ 工具目录忽略规则
2026-03-21 12:37:56 +08:00
GeWuYou
ba4ee24ce7 docs(guidelines): 更新 AGENTS.md 和 CLAUDE.md 文档内容
- 重写 AGENTS.md 为 AI 代理和贡献者提供完整的编码行为准则
- 新增详细的注释规则,包括 XML 文档、内联注释和架构级注释要求
- 完善代码风格指南,涵盖命名约定、格式化和 C# 最佳实践
- 扩展测试要求,明确覆盖率、组织结构和执行期望
- 添加安全规则和文档规范,确保代码质量和安全性
- 重构 CLAUDE.md 为 AI 代理提供项目理解指导
- 更新模块依赖图和架构模式说明,澄清各层职责
- 补充源码生成器、测试框架和文档结构的详细说明
- 优化项目概述和设计意图描述,提升 AI 理解准确性
2026-03-21 11:36:39 +08:00
gewuyou
dfae4ba207
Merge pull request #120 from GeWuYou/feat/docs-add-repository-guide
docs(guide): 添加仓库开发指南文档
2026-03-20 08:36:02 +08:00
GeWuYou
ccb51791a3 docs(guide): 更新提交和拉取请求指南中的拼写错误
- 修复了 "Conventional Commit" 到 "Conventional Commits" 的拼写
- 确保文档中使用的术语与业界标准保持一致
2026-03-20 08:24:17 +08:00
GeWuYou
55234c4d70 docs(guide): 添加仓库开发指南文档
- 创建了项目结构和模块组织说明
- 添加了构建测试和开发命令指南
- 定义了代码风格和命名约定规范
- 提供了测试指南和最佳实践
- 包含了提交和拉取请求准则
- 记录了解决方案文件和目录布局说明
2026-03-20 08:18:00 +08:00
dependabot[bot]
108bcbf27e Bump Meziantou.Analyzer from 3.0.19 to 3.0.25
---
updated-dependencies:
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.25
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-20 08:12:51 +08:00
dependabot[bot]
51393c30ee Bump Microsoft.Extensions.DependencyInjection from 10.0.4 to 10.0.5
---
updated-dependencies:
- dependency-name: Microsoft.Extensions.DependencyInjection
  dependency-version: 10.0.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-20 08:12:35 +08:00
dependabot[bot]
589f9f7d63 Bump the nuget group with 1 update
Bumps Scriban from 6.2.0 to 6.6.0

---
updated-dependencies:
- dependency-name: Scriban
  dependency-version: 6.6.0
  dependency-type: direct:production
  dependency-group: nuget
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-20 08:12:18 +08:00
gewuyou
ba8369c8b3
Merge pull request #115 from GeWuYou/feat/localization-system
feat(core): 添加本地化系统支持多语言功能
2026-03-19 13:21:22 +08:00
GeWuYou
9ca28a44d8 refactor(localization): 优化回退表检查逻辑
- 将 Fallback.ContainsKey 检查替换为更安全的模式匹配语法
- 避免了潜在的空引用异常风险
- 提高了代码的可读性和健壮性
- 保持了原有的功能逻辑不变
2026-03-19 13:15:39 +08:00
GeWuYou
0c5c9dceae test(localization): 添加本地化集成测试的临时文件管理和测试数据创建
- 添加 System.IO 命名空间引用以支持文件操作
- 实现 CreateTestLocalizationFiles 方法创建测试用的多语言文件
- 使用 GUID 生成唯一的临时目录路径避免冲突
- 添加 TearDown 方法清理测试过程中创建的临时文件
- 在 Setup 方法中调用文件创建方法初始化测试环境
- 将目标框架配置改为可配置的条件变量方式
2026-03-19 12:52:11 +08:00
GeWuYou
d7e7d3cc7f feat(events): 为优先级事件系统添加线程安全支持
- 添加同步锁对象以保护处理器集合的并发访问
- 在注册和注销操作中加入线程安全锁机制
- 实现快照创建方法以避免迭代期间的并发修改
- 重构触发器逻辑以使用线程安全的快照创建
- 在计数器方法中添加同步保护
- 确保所有集合操作都在安全锁内执行
2026-03-19 12:51:59 +08:00
GeWuYou
b5c67850ce docs(localization): 更新本地化字符串类的XML文档注释
- 为构造函数添加更详细的参数描述和异常说明
- 为WithVariable方法添加完整的XML文档注释
- 为WithVariables方法添加完整的XML文档注释
- 为Format方法添加详细的返回值和备注信息
- 为GetRaw方法添加完整的XML文档注释
- 为Exists方法添加完整的XML文档注释
- 为私有FormatString方法添加参数和返回值说明
- 为私有FormatMatch方法添加详细的处理逻辑描述
- 为私有TryFormatValue方法添加格式化器相关参数说明
- 为私有FormatValue方法添加默认格式化逻辑说明
- 为私有GetOptionalGroupValue方法添加功能说明
- 为私有GetFormatter方法添加获取格式化器的详细描述
2026-03-19 09:20:43 +08:00
GeWuYou
1f680d2822 refactor(localization): 重构本地化字符串格式化逻辑
- 将 FormatVariablePattern 从 readonly 字段改为 const 常量
- 提取复杂的正则替换逻辑到独立的 FormatMatch 方法中
- 新增 GetOptionalGroupValue 辅助方法处理可选组值提取
- 分离格式化值和尝试格式化的逻辑到独立方法
- 简化条件判断并提高代码可读性
- 优化错误处理流程,保持原有功能不变
2026-03-19 09:19:34 +08:00
GeWuYou
075d397a4c refactor(localization): 更新集成测试中的命名空间引用
- 添加对 GFramework.Core.Abstractions.Localization 的引用
- 确保测试文件能够访问本地化相关的抽象接口
- 为后续的本地化功能扩展做好准备
- 保持代码结构的一致性与可维护性
2026-03-18 23:25:55 +08:00
GeWuYou
5fb96761a3 docs(localization): 更新本地化文档并完善功能实现
- 添加了配置项暂不支持的说明信息
- 扩展了语言变化监听的使用方式,增加命名方法订阅示例
- 完善了覆盖机制的文档说明
- 优化了异常处理逻辑,精确捕获本地化相关异常
- 实现了正则表达式的预编译以提升性能
- 添加了必要的命名空间引用
2026-03-18 23:25:09 +08:00
GeWuYou
e49713a842 feat(core): 添加本地化系统支持多语言功能
- 实现 ILocalizationManager 接口及 LocalizationManager 管理器
- 添加 ILocalizationTable 和 ILocalizationString 接口及其实现
- 创建 LocalizationConfig 配置类用于管理本地化行为
- 实现 ConditionalFormatter 和 PluralFormatter 内置格式化器
- 添加本地化文档包括 API 参考和使用指南
- 集成本地化系统到核心框架架构中
2026-03-18 22:58:07 +08:00
gewuyou
aee13c3c1d
Merge pull request #114 from GeWuYou/docs/add-claude-md-guide
docs(guide): 添加 CLAUDE.md 文件提供项目开发指导
2026-03-18 10:00:28 +08:00
GeWuYou
05c4f06717 docs(guide): 添加 CLAUDE.md 文件提供项目开发指导
- 新增项目概述说明,介绍 GFramework 框架的核心特性
- 添加构建和测试命令指南,包括 dotnet 构建和测试脚本
- 提供模块依赖关系图,说明各模块之间的依赖结构
- 详细描述架构模式,包括四层结构和关键设计模式
- 添加代码约定说明,涵盖命名空间、隐式引用等规范
- 补充测试框架信息,说明测试结构和基类使用方式
- 介绍源码生成器功能,列出四个主要生成器的作用
- 提供文档站点信息,说明 VitePress 文档的本地预览方法
2026-03-18 09:44:06 +08:00
gewuyou
2accbf4bdf
Merge pull request #113 from GeWuYou/refactor/router-base-ci-concurrency
refactor(game): 重构路由系统并优化CI测试流程
2026-03-17 16:45:05 +08:00
GeWuYou
60068aff4f refactor(ci): 重构工作流配置以分离代码质量和构建测试任务
- 将原有的 test job 重命名为 code-quality,专注于代码质量与安全检查
- 添加构建和测试独立的 build-and-test job,实现并行执行
- 更新 MegaLinter 配置,优化缓存和报告上传流程
- 重新组织 CI 工作流结构,提升执行效率和可维护性
- 调整作业名称和描述,明确职责分工
2026-03-17 16:34:09 +08:00
GeWuYou
9c69c4ec00 refactor(ci): 优化CI工作流中的测试执行策略
- 将多个独立的测试步骤合并为单个并发执行步骤
- 移除重复的测试配置以简化工作流定义
- 保留后台测试等待机制确保执行完整性
- 统一测试项目名称提高可读性
2026-03-17 16:20:55 +08:00
GeWuYou
65b949b62f perf(scene): 优化路由守卫异步方法性能
- 将 ISceneRouteGuard 中的 Task 返回类型改为 ValueTask
- 将 IUiRouteGuard 中的 Task 返回类型改为 ValueTask
- 移除注释中的多余缩进空格
- 提升异步操作的性能表现
2026-03-17 16:10:24 +08:00
GeWuYou
4afa856fdc refactor(game): 重构路由系统并优化CI测试流程
- 将SceneRouterBase和UiRouterBase继承自新的RouterBase基类
- 移除原有的守卫管理相关代码,统一使用基类实现
- 更新路由栈操作使用基类提供的Stack属性
- 重写Current、Contains等方法以使用基类实现
- 在CI工作流中启用并发测试执行以提升性能
- 添加等待步骤确保并发测试完成
- 更新项目文件排除测试项目的编译
- 在解决方案文件中添加GFramework.Game.Tests项目引用
- 新增RouterBase基类提供通用路由管理功能
2026-03-17 15:01:55 +08:00
gewuyou
27858df94e
Merge pull request #112 from GeWuYou/refactor/architecture-modular-safety
refactor(architecture): 重构架构类为模块化设计提升代码安全性
2026-03-17 12:56:34 +08:00
GeWuYou
1c2e68fc5a style(docs): 统一文档中IoC容器术语格式并优化架构生命周期代码
- 将文档中的"IOC"统一更正为"IoC"格式
- 重构ArchitectureLifecycle类构造函数使用主构造函数语法
- 移除私有字段前缀下划线,直接使用参数名称
- 修复配置访问权限问题,移除字段访问前缀下划线
- 调整组件注册方法泛型约束,提升类型安全
- 优化日志记录器访问方式,移除字段访问前缀下划线
- 重构销毁逻辑,分离组件清理和服务模块销毁流程
- 提取清理组件逻辑到独立方法,提升代码可读性
- 更新阶段转换和钩子通知中的对象引用方式
2026-03-17 12:50:43 +08:00
GeWuYou
3d8e19b5e2 refactor(architecture): 重构架构类为模块化设计提升代码安全性
- 将单一 Architecture 类拆分为 ArchitectureLifecycle、ArchitectureComponentRegistry 和 ArchitectureModules
- 消除 3 处 null! 强制断言,在构造函数中初始化管理器提高代码安全性
- 添加 PhaseChanged 事件支持架构阶段监听
- 所有公共 API 保持不变确保向后兼容
- 实现单一职责原则使代码更易维护和测试
- 组件注册、生命周期管理和模块管理职责分离到专门的管理器中
2026-03-17 11:08:48 +08:00
gewuyou
ef05713bf2
Merge pull request #111 from GeWuYou/refactor/architecture-to-architectures-namespace
Refactor/architecture to architectures namespace
2026-03-14 17:01:31 +08:00
GeWuYou
e022a10bd5 refactor(architecture): 将架构相关文件从 Architecture 目录移动到 Architectures 目录
- 重命名目录名称从 Architecture 到 Architectures
- 更新所有相关文件的命名空间声明
- 保持代码功能不变,仅调整目录结构和命名空间一致性
2026-03-14 16:54:07 +08:00
GeWuYou
c82a15f8bc refactor(abstractions): 将Architecture命名空间重命名为Architectures
- 更新所有引用GFramework.Core.Abstractions.Architecture的文件
- 将ArchitectureModuleRegistry.cs从Architecture目录移动到Architectures目录
- 将IArchitecture.cs从Architecture目录移动到Architectures目录
- 将IArchitectureConfiguration.cs从Architecture目录移动到Architectures目录
- 将IArchitectureContext.cs从Architecture目录移动到Architectures目录
- 将IArchitectureContextProvider.cs从Architecture目录移动到Architectures目录
- 将IArchitectureLifecycleHook.cs从Architecture目录移动到Architectures目录
- 将IArchitectureModule.cs从Architecture目录移动到Architectures目录
- 将IArchitecturePhaseListener.cs从Architecture目录移动到Architectures目录
- 将IArchitectureServices.cs从Architecture目录移动到Architectures目录
- 将IServiceModule.cs从Architecture目录移动到Architectures目录
- 将IServiceModuleManager.cs从Architecture目录移动到Architectures目录
- 在ArchitectureModuleRegistry中将私有字段_factories重命名为Factories并添加StringComparer.Ordinal参数
2026-03-14 16:52:28 +08:00
gewuyou
2d89efa4b7
Merge pull request #110 from GeWuYou/docs/remove-migration-guide
Docs/remove migration guide
2026-03-13 22:44:29 +08:00
GeWuYou
597d4dfeda docs(menu): 移除迁移指南菜单项
- 从中文导航菜单中删除迁移指南链接
- 更新配置文件中的菜单结构
2026-03-13 22:44:01 +08:00
GeWuYou
f3deb299ac docs: 移除版本迁移指南文档
- 删除了整个迁移指南文档文件 docs/zh-CN/migration-guide.md
- 移除了详细的从 0.x 到 1.x 版本迁移说明
- 删除了架构变更、API 变更和配置变更相关内容
- 清理了常见问题解答和回滚方案部分
- 移除了测试迁移和代码迁移工具介绍
2026-03-13 22:43:28 +08:00
gewuyou
fc2f9ebf1a
Merge pull request #109 from GeWuYou/chore/resharper-namespace-suppression
chore(abstractions): 添加 ReSharper 禁用检查命名空间注释
2026-03-13 22:36:58 +08:00
GeWuYou
0640a06e44 chore(abstractions): 添加 ReSharper 禁用检查命名空间注释
- 在 GFramework.Core.Abstractions 中添加 // ReSharper disable CheckNamespace 注释
- 在 GFramework.Game.Abstractions 中添加 // ReSharper disable CheckNamespace 注释
- 解决代码分析工具对命名空间检查的警告问题
2026-03-13 22:29:29 +08:00
gewuyou
94f75bfa03
Merge pull request #108 from GeWuYou/chore/cleanup-refactor-scripts
chore(build): 删除文件夹映射配置和命名空间更新脚本
2026-03-13 10:03:24 +08:00
GeWuYou
10640f1c73 refactor(scripts): 将 C# 命名验证脚本从 Python 重写为 Bash
- 将验证逻辑从 Python 代码转换为 Bash 脚本实现
- 使用 grep 和正则表达式替换 Python 的字符串匹配功能
- 实现 PascalCase 验证的正则表达式模式
- 添加目录路径和命名空间段的验证逻辑
- 保持原有的排除规则和错误报告格式
- 移除对 Python3 的依赖,仅使用系统内置命令
2026-03-13 09:53:50 +08:00
GeWuYou
cb0d0682b0 refactor(core): 统一C#命名规范并添加校验脚本
- 将所有IoC相关命名空间从"IoC"重命名为"Ioc"
- 将所有CQRS相关命名空间从"CQRS"重命名为"Cqrs"
- 更新所有受影响的using语句以匹配新的命名空间
- 在CI工作流中添加C#命名规范校验步骤
- 修正了测试文件中的命名空间引用
2026-03-13 09:41:43 +08:00
GeWuYou
8b5efc69ec chore(build): 删除文件夹映射配置和命名空间更新脚本
- 移除 folder-mappings.json 配置文件
- 删除 update-namespaces.sh 自动化脚本
- 清理项目中的文件夹重命名映射关系
- 移除自动生成命名空间更新的功能
- 完成代码库结构规范化清理工作
2026-03-12 21:35:50 +08:00
dependabot[bot]
54103c21a4 chore(deps): bump trufflesecurity/trufflehog from 3.93.7 to 3.93.8
Bumps [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog) from 3.93.7 to 3.93.8.
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](https://github.com/trufflesecurity/trufflehog/compare/v3.93.7...v3.93.8)

---
updated-dependencies:
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.93.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:33:15 +08:00
dependabot[bot]
7aa009ab06 Bump coverlet.collector from 6.0.2 to 6.0.4
---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-version: 6.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:33:04 +08:00
dependabot[bot]
90bfa7200a Bump Meziantou.Analyzer from 2.0.264 to 2.0.302
---
updated-dependencies:
- dependency-name: Meziantou.Analyzer
  dependency-version: 2.0.302
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:32:51 +08:00
dependabot[bot]
e4cc0c7943 Bump Meziantou.Polyfill from 1.0.71 to 1.0.104
---
updated-dependencies:
- dependency-name: Meziantou.Polyfill
  dependency-version: 1.0.104
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:32:41 +08:00
dependabot[bot]
0b7d5c8f0c Bump Microsoft.Extensions.DependencyInjection from 10.0.3 to 10.0.4
---
updated-dependencies:
- dependency-name: Microsoft.Extensions.DependencyInjection
  dependency-version: 10.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:32:28 +08:00
dependabot[bot]
920a2c519e Bump NUnit from 4.5.0 to 4.5.1
---
updated-dependencies:
- dependency-name: NUnit
  dependency-version: 4.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: NUnit
  dependency-version: 4.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: NUnit
  dependency-version: 4.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 21:32:16 +08:00
gewuyou
f48a8db094
Merge pull request #99 from GeWuYou/docs/coroutine-system-refactor
Docs/coroutine system refactor
2026-03-12 12:58:51 +08:00
GeWuYou
4362989056 docs(coroutine): 更新协程相关文档
- 添加了 AsCoroutineInstruction()、ToCoroutineEnumerator() 和 StartTaskAsCoroutine()
  的使用场景说明
- 优化了等待异步方法的文档描述,明确不同 API 的适用场景
- 详细说明了 CancelWith 方法的节点有效性判断机制和停止条件
- 补充了 Godot 协程中 Task 转协程的具体使用建议
2026-03-12 12:49:29 +08:00
GeWuYou
1c30149ebd docs(coroutine): 更新协程系统文档内容
- 重新描述协程系统功能,强调基于 IEnumerator<IYieldInstruction> 的调度能力
- 更新核心概念介绍,明确协程系统的组成部分和架构设计
- 修改 CoroutineScheduler 使用示例,添加统计信息启用说明
- 完善 CoroutineHandle 的控制方法说明,包括暂停、恢复和终止操作
- 优化协程状态控制示例代码,展示标签和分组管理功能
- 重构等待指令说明,按时间帧、条件等待、Task桥接等方式分类
- 更新事件等待相关示例,改进超时处理和多事件等待功能
- 完善协程组合功能说明,包括子协程等待和多句柄等待
- 优化扩展方法介绍,按组合扩展、协程生成扩展、Task扩展等分类
- 更新命令、查询和Mediator扩展使用说明
- 修订异常处理机制说明,明确调度器异常处理方式
- 更新常见问题解答,澄清协程执行时机和线程模型概念
- 精简相关文档链接,移除冗余的系统集成说明
2026-03-12 12:41:53 +08:00
GeWuYou
4156839bd9 docs(godot): 更新协程系统文档内容
- 重构协程系统架构说明,明确核心组件和入口点
- 更新协程启动方式和基本用法示例代码
- 添加 Segment 分段调度机制详细说明
- 补充节点生命周期绑定和延迟调用功能介绍
- 完善常用等待指令和协程控制方法文档
- 优化事件总线集成和上下文感知集成说明
2026-03-12 12:41:22 +08:00
gewuyou
d038b67e29
Merge pull request #98 from GeWuYou/refactor/storage-async-safety
refactor(storage): 重构文件存储实现以支持异步安全锁和原子写入
2026-03-11 23:08:09 +08:00
GeWuYou
820cdcf0fa refactor(storage): 统一文件存储模块的依赖注入
- 在 FileStorage 中添加 System.IO 和 System.Text 引用
- 在 GodotFileStorage 中整合所有必要的命名空间引用
- 统一并发和序列化接口的依赖注入方式
- 添加 Godot 特定的 FileAccess 类型别名
- 优化 Godot 扩展功能的引用结构
2026-03-11 22:34:30 +08:00
GeWuYou
b01867b231 fix(storage): 修复文件存储组件的资源管理和死锁问题
- 添加了内部锁管理器所有权标识,防止外部传入的锁管理器被错误释放
- 在构造函数中正确初始化锁管理器的所有权状态
- 在Dispose方法中只释放内部创建的锁管理器,避免重复释放异常
- 为所有同步包装方法添加了ConfigureAwait(false)以避免死锁
- 更新了读取、写入、删除和检查存在的同步方法实现
- 为所有异步操作添加了适当的配置避免上下文切换问题
- 改进了Godot文件存储类的相同资源管理逻辑
- 为所有阻塞式同步方法添加了详细的XML注释警告说明
2026-03-11 22:26:01 +08:00
GeWuYou
494c341c08 refactor(storage): 重构文件存储实现以支持异步安全锁和原子写入
- 替换同步锁机制为异步键锁管理器,提升并发性能
- 实现原子写入功能,通过临时文件防止写入过程中的数据损坏
- 添加资源释放接口(IDisposable)和对象销毁检查
- 集成异步IO操作,包括缓冲区大小配置选项
- 更新Godot文件存储适配器以匹配新的异步安全机制
- 优化文件读取操作,支持异步文本读取避免阻塞
- 移除旧的并发字典锁实现,统一使用新的锁管理器
2026-03-11 21:57:04 +08:00
gewuyou
9c2e63f0e1
Merge pull request #96 from GeWuYou/feat/concurrency-add-async-key-lock-manager
feat(concurrency): 添加工业级异步键锁管理器
2026-03-11 19:41:07 +08:00
GeWuYou
378d7afb23 fix(concurrency): 修复异步锁管理器中的超时单位错误和资源泄漏问题
- 修正 _lockTimeoutTicks 为 _lockTimeoutMs,统一使用毫秒作为时间单位
- 在 AcquireLockAsync 方法中添加异常处理,防止锁等待失败时的资源泄漏
- 为同步 AcquireLock 方法添加 ConfigureAwait(false) 避免死锁风险
- 更新锁统计信息中的 WaitingCount 字段为近似值说明
- 修正清理逻辑中使用正确的超时单位进行比较
2026-03-11 19:17:03 +08:00
gewuyou
00a687168f
Merge pull request #97 from GeWuYou/refactor/scoped-array-optimization
refactor(core): 优化ScopedArray结构体实现
2026-03-11 12:53:44 +08:00
GeWuYou
b6c13088cd refactor(GFramework.Core): 移除ScopedArray的IDisposable接口实现
- 从ScopedArray结构体中移除IDisposable接口
- 保留数组池管理和自动释放功能
- 简化类型定义以提高性能表现
2026-03-11 12:44:32 +08:00
GeWuYou
ea79df232b refactor(GFramework.Core): 优化ScopedArray实现并添加资源清理功能
- 为ScopedArray<T>实现IDisposable接口以支持资源清理
- 修改Array属性访问方式,通过GetArray方法确保对象未被释放
- 更新Length属性实现,依赖Array属性而非直接访问私有字段
- 调整AsSpan方法实现,统一通过Array属性获取数组实例
- 重写索引器实现,使用Array属性替代直接字段访问
- 新增GetArray私有方法,用于检查对象状态并返回内部数组
- 添加ObjectDisposedException异常处理,防止访问已释放对象
2026-03-11 12:34:08 +08:00
GeWuYou
ffda10be86 refactor(core): 优化ScopedArray结构体实现
- 将ScopedArray从readonly struct改为ref struct以提高性能
- 添加_array字段存储数组引用并移除公共Array属性
- 在Dispose方法中添加空值检查避免重复释放
- 添加Span属性和索引器支持直接访问数组元素
- 使用#pragma warning禁用CA1819警告并优化代码风格
2026-03-11 08:58:33 +08:00
GeWuYou
b37873a67c feat(concurrency): 添加工业级异步键锁管理器
- 实现了基于键的细粒度异步锁机制
- 提供自动清理未使用锁的功能,避免内存泄漏
- 集成了统计信息收集功能,便于监控和调试
- 支持同步和异步两种锁获取方式
- 实现了锁句柄的自动释放机制
- 添加了完整的单元测试覆盖各种并发场景
2026-03-10 23:11:35 +08:00
gewuyou
11c7bc1457
Merge pull request #93 from GeWuYou/feat/result-add-try-map-bind-methods
feat(Result): 扩展Result结构体功能并优化实现
2026-03-10 21:16:41 +08:00
GeWuYou
c6024bf94a feat(GFramework.Core.Functional.Result): 增强Result类的安全性和健壮性
- 在构造函数中添加强制不变式检查,确保失败状态必须携带非空异常
- 为Try方法添加空值验证,防止传入空委托导致异常
- 为Map方法添加空值验证,增强方法调用的安全性
- 为Bind方法添加空值验证,提升代码健壮性
- 重构Map和Bind方法结构,使其更清晰易读
2026-03-10 21:09:58 +08:00
gewuyou
248a29b4df
Merge pull request #92 from GeWuYou/deepsource-autofix-834b3193
refactor: use ternary operator for conditional assignments
2026-03-10 20:25:35 +08:00
gewuyou
1f0eb55288
Merge pull request #94 from GeWuYou/refactor/pool-simplify-warning-messages
refactor(pool): 简化对象池释放警告消息
2026-03-10 20:24:58 +08:00
deepsource-autofix[bot]
caeb1ab80f
refactor: use ternary operator for conditional assignments
This PR refactors code that used multi-line if/else statements to use the ternary operator for more concise and readable assignments.

- if statement can be rewritten using the ternary operator: The original code assigned values based on Storage.ExistsAsync(key) with separate if and else blocks, leading to verbose multi-line statements. We have replaced these with single-line ternary expressions in both the generic GetAsync<T> method and the UnifiedSettingsFile loader, reducing code duplication and improving clarity.

> This Autofix was generated by AI. Please review the change before merging.
2026-03-10 11:21:39 +00:00
GeWuYou
4750910675 feat(Result): 扩展Result结构体功能并优化实现
- 添加StructLayout特性优化内存布局
- 将Failure方法中的Exception替换为InvalidOperationException
- 重构Equals方法提高比较逻辑的可读性
- 简化GetHashCode方法的哈希计算逻辑
- 更新ToString方法移除空值检查
- 新增Try方法用于安全执行可能抛出异常的操作
- 添加Map方法支持将Result成功状态映射到其他类型
- 实现Bind方法用于链式调用Result操作
2026-03-10 19:20:52 +08:00
GeWuYou
43b88e7573 refactor(pool): 简化对象池释放警告消息
- 移除冗余的 'Attempting to release object for key' 文本
- 删除重复的 'or incorrect key' 描述
- 简化警告消息以提高可读性
- 保持核心警告信息不变
2026-03-10 19:13:39 +08:00
gewuyou
8e4e794661
Merge pull request #91 from GeWuYou/refactor/namespace-pascalcase
Refactor/namespace pascalcase
2026-03-10 19:07:33 +08:00
GeWuYou
52f95c7e5f refactor(tests): 将Architecture目录重命名为Architectures
- 重命名GFramework.Core.Tests/Architecture目录为GFramework.Core.Tests/Architectures
- 更新所有相关文件中的命名空间引用
- 修复GameContextTests中TestArchitecture类的基类引用
- 修复TestArchitectureBase类的基类引用
- 修复ArchitectureTestsBase泛型约束中的类型引用
- 更新其他测试文件中的命名空间导入路径
2026-03-10 19:01:50 +08:00
GeWuYou
8ea462de28 test(architecture): 更新架构上下文测试以验证未注册组件抛出异常
- 修改 GetSystem 方法测试用例,验证未注册系统时抛出 InvalidOperationException
- 修改 GetModel 方法测试用例,验证未注册模型时抛出 InvalidOperationException
- 修改 GetUtility 方法测试用例,验证未注册工具时抛出 InvalidOperationException
- 更新异步架构测试中的系统销毁验证逻辑
- 移除对已销毁系统的空值检查断言,改为验证异步测试系统的销毁状态
2026-03-10 10:16:04 +08:00
GeWuYou
95de78efae refactor(architecture): 优化架构上下文中的服务缓存和空值处理
- 将服务缓存从 Dictionary 替换为 ConcurrentDictionary 以提高线程安全性
- 移除所有 GetService 相关方法的可空返回类型,统一改为非空返回
- 修改 GetOrCache 方法实现,使用 GetOrAdd 方法简化缓存逻辑
- 更新命令和事件总线调用方式,移除空值检查操作符
- 调整接口契约,明确服务不存在时抛出异常而非返回 null
- 优化依赖注入容器的服务获取流程,增强错误处理机制
2026-03-10 09:08:13 +08:00
GeWuYou
aeed1f903c refactor(GFramework.Ecs.Arch): 移除未使用的抽象依赖
- 从 ArchEcsModule.cs 中移除未使用的 GFramework.Ecs.Arch.Abstractions 引用
- 清理项目中不必要的命名空间引用以优化代码结构
2026-03-10 08:48:35 +08:00
GeWuYou
027a214479 refactor(core): 将System命名空间重命名为Systems
- 更新所有GFramework.Core.Abstractions.System引用为GFramework.Core.Abstractions.Systems
- 重命名GFramework.Core/System目录为GFramework.Core/Systems
- 重命名GFramework.Core.Tests/System目录为GFramework.Core.Tests/Systems
- 更新所有相关using语句和命名空间声明
- 修复测试文件中的命名空间引用
- 添加全局using引用GFramework.Core.Systems
2026-03-10 08:42:53 +08:00
GeWuYou
fb14d7122c docs(style): 更新文档中的命名空间导入格式
- 将所有小写的命名空间导入更正为首字母大写格式
- 统一 GFramework 框架的命名空间引用规范
- 修复 core、ecs、godot 等模块的命名空间导入错误
- 标准化文档示例代码中的 using 语句格式
- 确保所有文档中的命名空间引用保持一致性
- 更新 global using 语句以匹配正确的命名空间格式
2026-03-10 07:18:49 +08:00
gewuyou
53b04c12f0
Merge pull request #90 from GeWuYou/docs/ecs-documentation-improvements-
docs(ecs): 更新文档中的类型参数表示和相关链接
2026-03-08 21:54:44 +08:00
GeWuYou
f5d1985a59 docs(ecs): 更新文档中的类型参数表示和相关链接
- 将文档中的 `ArchSystemAdapter<T>` 替换为 `ArchSystemAdapter&lt;T&gt;` 以正确显示尖括号
- 移除重复的许可证信息和分隔线
- 删除过时的文档链接,保持导航结构简洁
2026-03-08 21:37:37 +08:00
740 changed files with 15387 additions and 6486 deletions

View File

@ -0,0 +1,62 @@
schema_version: 1
generated_at_utc: "2026-03-21T04:47:58Z"
generated_from: ".ai/environment/tools.raw.yaml"
generator: "scripts/generate-ai-environment.py"
platform:
family: "wsl-linux"
os: "Linux"
distro: "Ubuntu 24.04.4 LTS"
shell: "bash"
capabilities:
dotnet: true
python: true
node: true
bun: true
docker: true
fast_search: true
json_cli: true
tool_selection:
search:
preferred: "rg"
fallback: "grep"
use_for: "Repository text search."
json:
preferred: "jq"
fallback: "python3"
use_for: "Inspecting or transforming JSON command output."
shell:
preferred: "bash"
fallback: "sh"
use_for: "Repository shell scripts and command execution."
scripting:
preferred: "python3"
fallback: "bash"
use_for: "Non-trivial local automation and helper scripts."
docs_package_manager:
preferred: "bun"
fallback: "npm"
use_for: "Installing and previewing the docs site."
build_and_test:
preferred: "dotnet"
fallback: "unavailable"
use_for: "Build, test, restore, and solution validation."
python:
available: true
helper_packages:
requests: true
rich: true
openai: false
tiktoken: false
pydantic: false
pytest: false
preferences:
prefer_project_listed_tools: true
prefer_python_for_non_trivial_automation: true
avoid_unlisted_system_tools: true
rules:
- "Use rg instead of grep for repository search when rg is available."
- "Use jq for JSON inspection; fall back to python3 if jq is unavailable."
- "Prefer python3 over complex bash for non-trivial scripting when python3 is available."
- "Use bun for docs preview workflows when bun is available; otherwise fall back to npm."
- "Use dotnet for repository build and test workflows."
- "Do not assume unrelated system tools are part of the supported project environment."

View File

@ -0,0 +1,89 @@
schema_version: 1
generated_at_utc: "2026-03-21T04:47:28Z"
generator: "scripts/collect-dev-environment.sh"
platform:
os: "Linux"
distro: "Ubuntu 24.04.4 LTS"
version: "24.04"
kernel: "5.15.167.4-microsoft-standard-WSL2"
wsl: true
wsl_version: "2.4.13"
shell: "bash"
required_runtimes:
dotnet:
installed: true
version: "10.0.104"
path: "/usr/bin/dotnet"
purpose: "Builds and tests the GFramework solution."
python3:
installed: true
version: "Python 3.12.3"
path: "/usr/bin/python3"
purpose: "Runs local automation and environment collection scripts."
node:
installed: true
version: "v20.20.1"
path: "/usr/bin/node"
purpose: "Provides the JavaScript runtime used by docs tooling."
bun:
installed: true
version: "1.3.10"
path: "/root/.bun/bin/bun"
purpose: "Installs and previews the VitePress documentation site."
required_tools:
git:
installed: true
version: "git version 2.43.0"
path: "/usr/bin/git"
purpose: "Source control and patch review."
bash:
installed: true
version: "GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)"
path: "/usr/bin/bash"
purpose: "Executes repository scripts and shell automation."
rg:
installed: true
version: "ripgrep 15.1.0 (rev af60c2de9d)"
path: "/root/.bun/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/path/rg"
purpose: "Fast text search across the repository."
jq:
installed: true
version: "jq-1.7"
path: "/usr/bin/jq"
purpose: "Inspecting and transforming JSON outputs."
project_tools:
docker:
installed: true
version: "Docker version 29.2.1, build a5c7197"
path: "/usr/bin/docker"
purpose: "Runs MegaLinter and other containerized validation tools."
python_packages:
requests:
installed: true
version: "2.31.0"
purpose: "Simple HTTP calls in local helper scripts."
rich:
installed: true
version: "13.7.1"
purpose: "Readable CLI output for local Python helpers."
openai:
installed: false
version: "not-installed"
purpose: "Optional scripted access to OpenAI APIs."
tiktoken:
installed: false
version: "not-installed"
purpose: "Optional token counting for prompt and context inspection."
pydantic:
installed: false
version: "not-installed"
purpose: "Optional typed config and schema validation for helper scripts."
pytest:
installed: false
version: "not-installed"
purpose: "Optional lightweight testing for Python helper scripts."

View File

@ -13,8 +13,9 @@ permissions:
security-events: write
jobs:
test:
name: Build and Test
# 代码质量检查 job并行执行不阻塞构建
code-quality:
name: Code Quality & Security
runs-on: ubuntu-latest
steps:
@ -23,6 +24,11 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
# 校验C#命名空间与源码目录是否符合命名规范
- name: Validate C# naming
run: bash scripts/validate-csharp-naming.sh
# 缓存MegaLinter
- name: Cache MegaLinter
uses: actions/cache@v5
@ -31,8 +37,7 @@ jobs:
key: ${{ runner.os }}-megalinter-v9
restore-keys: |
${{ runner.os }}-megalinter-
# MegaLinter扫描步骤
# 执行代码质量检查和安全扫描生成SARIF格式报告
- name: MegaLinter
@ -41,11 +46,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FAIL_ON_ERROR: ${{ github.ref == 'refs/heads/main' }}
# 上传SARIF格式的安全和代码质量问题报告到GitHub安全中心
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: megalinter-reports/sarif
# 缓存TruffleHog
- name: Cache TruffleHog
uses: actions/cache@v5
@ -57,7 +64,7 @@ jobs:
# 使用 TruffleHog 工具扫描代码库中的敏感信息泄露如API密钥、密码等
# 该步骤会比较基础分支和当前提交之间的差异,检测新增内容中是否包含敏感数据
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@v3.93.7
uses: trufflesecurity/trufflehog@v3.93.8
with:
# 扫描路径,. 表示扫描整个仓库
path: .
@ -65,6 +72,18 @@ jobs:
base: ${{ github.event.before }}
# 当前提交哈希,作为扫描的目标版本
head: ${{ github.sha }}
# 构建和测试 job并行执行
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
# 检出源代码
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
# 安装和配置.NET SDK版本
- name: Setup .NET 8
@ -110,29 +129,35 @@ jobs:
run: dotnet build -c Release --no-restore
# 运行单元测试输出TRX格式结果到TestResults目录
- name: Test - Core
# 在同一个 step 中并发执行所有测试以加快速度
- name: Test All Projects
run: |
dotnet test GFramework.Core.Tests \
-c Release \
--no-build \
--logger "trx;LogFileName=core-$RANDOM.trx" \
--results-directory TestResults
- name: Test - SourceGenerators
run: |
--results-directory TestResults &
dotnet test GFramework.Game.Tests \
-c Release \
--no-build \
--logger "trx;LogFileName=game-$RANDOM.trx" \
--results-directory TestResults &
dotnet test GFramework.SourceGenerators.Tests \
-c Release \
--no-build \
--logger "trx;LogFileName=sg-$RANDOM.trx" \
--results-directory TestResults
- name: Test - GFramework.Ecs.Arch.Tests
run: |
--results-directory TestResults &
dotnet test GFramework.Ecs.Arch.Tests \
-c Release \
--no-build \
--logger "trx;LogFileName=ecs-arch-$RANDOM.trx" \
--results-directory TestResults
--results-directory TestResults &
# 等待所有后台测试完成
wait
- name: Generate CTRF report
run: |
@ -173,4 +198,4 @@ jobs:
fetch-previous-results: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always()
if: always()

5
.gitignore vendored
View File

@ -11,4 +11,7 @@ opencode.json
.claude/settings.json
.omc/
docs/.omc/
docs/.vitepress/cache/
docs/.vitepress/cache/
local-plan/
# tool
.venv/

220
AGENTS.md Normal file
View File

@ -0,0 +1,220 @@
# AGENTS.md
This document is the single source of truth for coding behavior in this repository.
All AI agents and contributors must follow these rules when writing, reviewing, or modifying code in `GFramework`.
## Environment Capability Inventory
- Before choosing runtimes or CLI tools, read `@.ai/environment/tools.ai.yaml`.
- Use `@.ai/environment/tools.raw.yaml` only when you need the full collected facts behind the AI-facing hints.
- Prefer the project-relevant tools listed there instead of assuming every installed system tool is fair game.
- If the real environment differs from the inventory, use the project-relevant installed tool and report the mismatch.
## Commenting Rules (MUST)
All generated or modified code MUST include clear and meaningful comments where required by the rules below.
### XML Documentation (Required)
- All public, protected, and internal types and members MUST include XML documentation comments (`///`).
- Use `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` where applicable.
- Comments must explain intent, contract, and usage constraints instead of restating syntax.
- If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior
explicitly.
### Inline Comments
- Add inline comments for:
- Non-trivial logic
- Concurrency or threading behavior
- Performance-sensitive paths
- Workarounds, compatibility constraints, or edge cases
- Registration order, lifecycle sequencing, or generated code assumptions
- Avoid obvious comments such as `// increment i`.
### Architecture-Level Comments
- Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types
MUST include high-level explanations of:
- Responsibilities
- Lifecycle
- Interaction with other components
- Why the abstraction exists
- When to use it instead of alternatives
### Source Generator Comments
- Generated logic and generator pipelines MUST explain:
- What is generated
- Why it is generated
- The semantic assumptions the generator relies on
- Any diagnostics or fallback behavior
### Complex Logic Requirement
- Methods with non-trivial logic MUST document:
- The core idea
- Key decisions
- Edge case handling, if any
### Quality Rules
- Comments MUST NOT be trivial, redundant, or misleading.
- Prefer explaining `why` and `when`, not just `what`.
- Code should remain understandable without requiring external context.
- Prefer slightly more explanation over too little for framework code.
### Enforcement
- Missing required documentation is a coding standards violation.
- Code that does not meet the documentation rules is considered incomplete.
## Code Style
### Language and Project Settings
- Follow the repository defaults:
- `ImplicitUsings` disabled
- `Nullable` enabled
- `GenerateDocumentationFile` enabled for shipped libraries
- `LangVersion` is generally `preview` in the main libraries and abstractions
- Do not rely on implicit imports. Declare every required `using` explicitly.
- Write null-safe code that respects nullable annotations instead of suppressing warnings by default.
### Naming and Structure
- Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments.
- Follow standard C# naming:
- Types, methods, properties, events, and constants: PascalCase
- Interfaces: `I` prefix
- Parameters and locals: camelCase
- Private fields: `_camelCase`
- Keep abstractions projects free of implementation details and engine-specific dependencies.
- Preserve existing module boundaries. Do not introduce new cross-module dependencies without clear architectural need.
### Formatting
- Use 4 spaces for indentation. Do not use tabs.
- Use Allman braces.
- Keep `using` directives at the top of the file and sort them consistently.
- Separate logical blocks with blank lines when it improves readability.
- Prefer one primary type per file unless the surrounding project already uses a different local pattern.
- Keep line length readable. Around 120 characters is the preferred upper bound.
### C# Conventions
- Prefer explicit, readable code over clever shorthand in framework internals.
- Match existing async patterns and naming conventions (`Async` suffix for asynchronous methods).
- Avoid hidden side effects in property getters, constructors, and registration helpers.
- Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs.
- When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not
obvious.
### Analyzer and Validation Expectations
- The repository uses `Meziantou.Analyzer`; treat analyzer feedback as part of the coding standard.
- Naming must remain compatible with `scripts/validate-csharp-naming.sh`.
## Testing Requirements
### Required Coverage
- Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test
is not practical.
- Public API changes must be covered by unit or integration tests.
- Regression fixes should include a test that fails before the fix and passes after it.
### Test Organization
- Mirror the source structure in test projects whenever practical.
- Reuse existing architecture test infrastructure when relevant:
- `ArchitectureTestsBase<T>`
- `SyncTestArchitecture`
- `AsyncTestArchitecture`
- Keep tests focused on observable behavior, not implementation trivia.
### Source Generator Tests
- Source generator changes MUST be covered by generator tests.
- Preserve snapshot-based verification patterns already used in the repository.
- When generator behavior changes intentionally, update snapshots together with the implementation.
### Validation Commands
Use the smallest command set that proves the change, then expand if the change is cross-cutting.
```bash
# Build the full solution
dotnet build GFramework.sln -c Release
# Run all tests
dotnet test GFramework.sln -c Release
# Run a single test project
dotnet test GFramework.Core.Tests -c Release
dotnet test GFramework.Game.Tests -c Release
dotnet test GFramework.SourceGenerators.Tests -c Release
dotnet test GFramework.Ecs.Arch.Tests -c Release
# Run a single NUnit test or test group
dotnet test GFramework.Core.Tests -c Release --filter "FullyQualifiedName~CommandExecutorTests.Execute"
# Validate naming rules used by CI
bash scripts/validate-csharp-naming.sh
```
### Test Execution Expectations
- Run targeted tests for the code you changed whenever possible.
- Run broader solution-level validation for changes that touch shared abstractions, lifecycle behavior, source
generators, or dependency wiring.
- Do not claim completion if required tests were skipped; state what was not run and why.
## Security Rules
- Validate external or user-controlled input before it reaches file system, serialization, reflection, code generation,
or process boundaries.
- Do not build command strings, file paths, type names, or generated code from untrusted input without strict validation
or allow-listing.
- Avoid logging secrets, tokens, credentials, or machine-specific sensitive data.
- Keep source generators deterministic and free of hidden environment or network dependencies.
- Prefer least-privilege behavior for file, process, and environment access.
- Do not introduce unsafe deserialization, broad reflection-based activation, or dynamic code execution unless it is
explicitly required and tightly constrained.
- When adding caching, pooling, or shared mutable state, document thread-safety assumptions and failure modes.
- Minimize new package dependencies. Add them only when necessary and keep scope narrow.
## Documentation Rules
### Code Documentation
- Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs.
- If a framework abstraction changes meaning or intended usage, update the explanatory comments in code as part of the
same change.
### Repository Documentation
- Update the relevant `README.md` or `docs/` page when behavior, setup steps, architecture guidance, or user-facing
examples change.
- The main documentation site lives under `docs/`, with Chinese content under `docs/zh-CN/`.
- Keep code samples, package names, and command examples aligned with the current repository state.
- Prefer documenting behavior and design intent, not only API surface.
### Documentation Preview
When documentation changes need local preview, use:
```bash
cd docs && bun install && bun run dev
```
## Review Standard
Before considering work complete, confirm:
- Required comments and XML docs are present
- Code follows repository style and naming rules
- Relevant tests were added or updated
- Sensitive or unsafe behavior was not introduced
- User-facing documentation is updated when needed

134
CLAUDE.md Normal file
View File

@ -0,0 +1,134 @@
# CLAUDE.md
This file provides project understanding for AI agents working in this repository.
## Project Overview
GFramework 是面向游戏开发的模块化 C# 框架,核心能力与引擎解耦。项目灵感参考 QFramework并在模块边界、工程组织和可扩展性方面持续重构。
## AI Agent Instructions
All coding rules are defined in:
@AGENTS.md
Follow them strictly.
## Module Dependency Graph
```text
GFramework (meta package) ─→ Core + Game
GFramework.Core ─→ Core.Abstractions
GFramework.Game ─→ Game.Abstractions, Core, Core.Abstractions
GFramework.Godot ─→ Core, Game, Core.Abstractions, Game.Abstractions
GFramework.Ecs.Arch ─→ Ecs.Arch.Abstractions, Core, Core.Abstractions
GFramework.SourceGenerators ─→ SourceGenerators.Common, SourceGenerators.Abstractions
```
- **Abstractions projects** (`netstandard2.1`): 只包含接口和契约定义,不承载运行时实现逻辑。
- **Core / Game / Ecs.Arch** (`net8.0;net9.0;net10.0`): 平台无关的核心实现层。
- **Godot**: Godot 引擎集成层,负责与节点、场景和引擎生命周期对接。
- **SourceGenerators** (`netstandard2.1`): Roslyn 增量源码生成器及其公共基础设施。
## Architecture Pattern
框架核心采用 `Architecture / Model / System / Utility` 四层结构:
- **IArchitecture**: 顶层容器,负责生命周期管理、组件注册、模块安装和统一服务访问。
- **IContextAware**: 统一上下文访问接口,组件通过 `SetContext(IArchitectureContext)` 获取架构上下文。
- **IModel**: 数据与状态层,负责长期状态和业务数据建模。
- **ISystem**: 业务逻辑层,负责命令执行、流程编排和规则落地。
- **IUtility**: 通用无状态工具层,供其他层复用。
关键实现位于 `GFramework.Core/Architectures/Architecture.cs`,其职责是作为总协调器串联生命周期、组件注册和模块系统。
## Architecture Details
### Lifecycle
Architecture 负责统一生命周期编排,核心阶段包括:
- `Init`
- `Ready`
- `Destroy`
在实现层中,生命周期被拆分为更细粒度的初始化与销毁阶段,用于保证 Utility、Model、System、服务模块和钩子的顺序一致性。
### Component Coordination
框架通过独立组件协作完成架构编排:
- `ArchitectureLifecycle`: 管理生命周期阶段、阶段转换和生命周期钩子。
- `ArchitectureComponentRegistry`: 管理 Model、System、Utility 的注册与解析。
- `ArchitectureModules`: 管理模块安装、服务模块接入和扩展点注册。
这组拆分的目标是降低单个核心类的职责密度,同时保持对外 API 稳定。
### Context Propagation
`IArchitectureContext` 和相关 Provider 类型负责在组件之间传播上下文能力,使 Model、System
和外部扩展都能通过统一入口访问架构服务,而不直接耦合具体实现细节。
## Key Patterns
### CQRS
命令与查询分离支持同步与异步执行。Mediator 模式通过源码生成器集成,以减少模板代码并保持调用路径清晰。
### EventBus
类型安全事件总线支持事件发布、订阅、优先级、过滤器和弱引用订阅。它是模块之间松耦合通信的核心基础设施之一。
### BindableProperty
响应式属性模型通过值变化通知驱动界面或业务层更新,适合表达轻量级状态同步。
### Coroutine
帧驱动协程系统基于 `IYieldInstruction` 和调度器抽象,支持等待时间、事件和任务完成等常见模式。
### IoC
依赖注入通过 `MicrosoftDiContainer``Microsoft.Extensions.DependencyInjection` 进行封装,用于统一组件注册和服务解析体验。
### Service Modules
`IServiceModule` 模式用于向 Architecture 注册内置服务,例如 EventBus、CommandExecutor、QueryExecutor 等。这一模式承担“基础设施能力装配”的职责。
## Source Generators
当前仓库包含多类 Roslyn 增量源码生成器:
- `LoggerGenerator` (`[Log]`): 自动生成日志字段和日志辅助方法。
- `PriorityGenerator` (`[Priority]`): 生成优先级比较相关实现。
- `EnumExtensionsGenerator` (`[GenerateEnumExtensions]`): 生成枚举扩展能力。
- `ContextAwareGenerator` (`[ContextAware]`): 自动实现 `IContextAware` 相关样板逻辑。
这些生成器的目标是减少重复代码,同时保持框架层 API 的一致性与可维护性。
## Module Structure
仓库以“抽象层 + 实现层 + 集成层 + 生成器层”的方式组织:
- `GFramework.Core.Abstractions` / `GFramework.Game.Abstractions`: 约束接口和公共契约。
- `GFramework.Core` / `GFramework.Game`: 提供平台无关实现。
- `GFramework.Godot`: 提供与 Godot 运行时集成的适配实现。
- `GFramework.Ecs.Arch`: 提供 ECS Architecture 相关扩展。
- `GFramework.SourceGenerators` 及相关 Abstractions/Common: 提供代码生成能力。
这种结构的核心设计目标是让抽象稳定、实现可替换、引擎集成隔离、生成器能力可独立演进。
## Documentation Structure
项目文档位于 `docs/`,中文内容位于 `docs/zh-CN/`。文档内容覆盖:
- 入门与安装
- Core / Game / Godot / ECS 各模块能力
- Source Generator 使用说明
- 教程、最佳实践与故障排查
阅读顺序通常建议先看根目录 `README.md` 和各子模块 `README.md`,再进入 `docs/` 查阅专题说明。
## Design Intent
GFramework 的设计重点不是把所有能力堆进单一核心类,而是通过清晰的模块边界、可组合的服务注册方式、稳定的抽象契约以及适度自动化的源码生成,构建一个适合长期演进的游戏开发基础框架。

View File

@ -1,13 +1,13 @@
using System.Collections.Concurrent;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构模块注册表 - 用于外部模块的自动注册
/// </summary>
public static class ArchitectureModuleRegistry
{
private static readonly ConcurrentDictionary<string, Func<IServiceModule>> _factories = new();
private static readonly ConcurrentDictionary<string, Func<IServiceModule>> Factories = new(StringComparer.Ordinal);
/// <summary>
/// 注册模块工厂(幂等操作,相同模块名只会注册一次)
@ -20,7 +20,7 @@ public static class ArchitectureModuleRegistry
var moduleName = tempModule.ModuleName;
// 幂等注册:相同模块名只注册一次
_factories.TryAdd(moduleName, factory);
Factories.TryAdd(moduleName, factory);
}
/// <summary>
@ -29,7 +29,7 @@ public static class ArchitectureModuleRegistry
/// <returns>模块实例集合</returns>
public static IEnumerable<IServiceModule> CreateModules()
{
return _factories.Values.Select(f => f());
return Factories.Values.Select(f => f());
}
/// <summary>
@ -37,6 +37,6 @@ public static class ArchitectureModuleRegistry
/// </summary>
public static void Clear()
{
_factories.Clear();
Factories.Clear();
}
}

View File

@ -1,10 +1,10 @@
using GFramework.Core.Abstractions.lifecycle;
using GFramework.Core.Abstractions.model;
using GFramework.Core.Abstractions.system;
using GFramework.Core.Abstractions.utility;
using GFramework.Core.Abstractions.Lifecycle;
using GFramework.Core.Abstractions.Model;
using GFramework.Core.Abstractions.Systems;
using GFramework.Core.Abstractions.Utility;
using Microsoft.Extensions.DependencyInjection;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构接口,专注于生命周期管理,包括系统、模型、工具的注册和获取

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.properties;
using GFramework.Core.Abstractions.Properties;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 定义架构配置的接口,提供日志工厂、日志级别和架构选项的配置功能

View File

@ -1,14 +1,14 @@
using GFramework.Core.Abstractions.command;
using GFramework.Core.Abstractions.environment;
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.model;
using GFramework.Core.Abstractions.query;
using GFramework.Core.Abstractions.system;
using GFramework.Core.Abstractions.utility;
using GFramework.Core.Abstractions.Command;
using GFramework.Core.Abstractions.Environment;
using GFramework.Core.Abstractions.Events;
using GFramework.Core.Abstractions.Model;
using GFramework.Core.Abstractions.Query;
using GFramework.Core.Abstractions.Systems;
using GFramework.Core.Abstractions.Utility;
using Mediator;
using ICommand = GFramework.Core.Abstractions.command.ICommand;
using ICommand = GFramework.Core.Abstractions.Command.ICommand;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构上下文接口,提供对系统、模型、工具类的访问以及命令、查询、事件的发送和注册功能
@ -19,8 +19,8 @@ public interface IArchitectureContext
/// 获取指定类型的服务实例
/// </summary>
/// <typeparam name="TService">服务类型</typeparam>
/// <returns>服务实例,如果不存在则返回null</returns>
TService? GetService<TService>() where TService : class;
/// <returns>服务实例,如果不存在则抛出异常</returns>
TService GetService<TService>() where TService : class;
/// <summary>
/// 获取指定类型的所有服务实例
@ -33,8 +33,8 @@ public interface IArchitectureContext
/// 获取指定类型的系统实例
/// </summary>
/// <typeparam name="TSystem">系统类型必须继承自ISystem接口</typeparam>
/// <returns>系统实例,如果不存在则返回null</returns>
TSystem? GetSystem<TSystem>() where TSystem : class, ISystem;
/// <returns>系统实例,如果不存在则抛出异常</returns>
TSystem GetSystem<TSystem>() where TSystem : class, ISystem;
/// <summary>
/// 获取指定类型的所有系统实例
@ -47,8 +47,8 @@ public interface IArchitectureContext
/// 获取指定类型的模型实例
/// </summary>
/// <typeparam name="TModel">模型类型必须继承自IModel接口</typeparam>
/// <returns>模型实例,如果不存在则返回null</returns>
TModel? GetModel<TModel>() where TModel : class, IModel;
/// <returns>模型实例,如果不存在则抛出异常</returns>
TModel GetModel<TModel>() where TModel : class, IModel;
/// <summary>
/// 获取指定类型的所有模型实例
@ -61,8 +61,8 @@ public interface IArchitectureContext
/// 获取指定类型的工具类实例
/// </summary>
/// <typeparam name="TUtility">工具类类型必须继承自IUtility接口</typeparam>
/// <returns>工具类实例,如果不存在则返回null</returns>
TUtility? GetUtility<TUtility>() where TUtility : class, IUtility;
/// <returns>工具类实例,如果不存在则抛出异常</returns>
TUtility GetUtility<TUtility>() where TUtility : class, IUtility;
/// <summary>
/// 获取指定类型的所有工具类实例
@ -115,7 +115,7 @@ public interface IArchitectureContext
/// <typeparam name="TResult">命令执行结果类型</typeparam>
/// <param name="command">要发送的命令</param>
/// <returns>命令执行结果</returns>
TResult SendCommand<TResult>(command.ICommand<TResult> command);
TResult SendCommand<TResult>(Command.ICommand<TResult> command);
/// <summary>
/// [Mediator] 发送命令的同步版本(不推荐,仅用于兼容性)
@ -158,7 +158,7 @@ public interface IArchitectureContext
/// <typeparam name="TResult">查询结果类型</typeparam>
/// <param name="query">要发送的查询</param>
/// <returns>查询结果</returns>
TResult SendQuery<TResult>(query.IQuery<TResult> query);
TResult SendQuery<TResult>(Query.IQuery<TResult> query);
/// <summary>
/// [Mediator] 发送查询的同步版本(不推荐,仅用于兼容性)

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构上下文提供者接口,用于解耦上下文获取逻辑

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.enums;
using GFramework.Core.Abstractions.Enums;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构生命周期钩子接口,用于在架构的不同生命周期阶段执行自定义逻辑。

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构模块接口,继承自架构生命周期接口。

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.enums;
using GFramework.Core.Abstractions.Enums;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构阶段监听器接口,用于监听和响应架构生命周期中的不同阶段变化。

View File

@ -1,10 +1,10 @@
using GFramework.Core.Abstractions.command;
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.ioc;
using GFramework.Core.Abstractions.query;
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.Command;
using GFramework.Core.Abstractions.Events;
using GFramework.Core.Abstractions.Ioc;
using GFramework.Core.Abstractions.Query;
using GFramework.Core.Abstractions.Rule;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 架构服务接口,定义了框架核心架构所需的服务组件

View File

@ -1,7 +1,7 @@
using GFramework.Core.Abstractions.ioc;
using GFramework.Core.Abstractions.lifecycle;
using GFramework.Core.Abstractions.Ioc;
using GFramework.Core.Abstractions.Lifecycle;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 服务模块接口,定义了服务模块的基本契约。

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.ioc;
using GFramework.Core.Abstractions.Ioc;
namespace GFramework.Core.Abstractions.architecture;
namespace GFramework.Core.Abstractions.Architectures;
/// <summary>
/// 服务模块管理器接口,用于管理架构中的服务模块。

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.bases;
namespace GFramework.Core.Abstractions.Bases;
/// <summary>
/// 定义具有键值访问能力的接口契约

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.bases;
namespace GFramework.Core.Abstractions.Bases;
/// <summary>
/// 表示键值对的接口,定义了通用的键值对数据结构契约

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.bases;
namespace GFramework.Core.Abstractions.Bases;
/// <summary>
/// 定义具有优先级的对象接口。

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.bases;
namespace GFramework.Core.Abstractions.Bases;
/// <summary>
/// 预定义的优先级分组常量

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.Rule;
namespace GFramework.Core.Abstractions.command;
namespace GFramework.Core.Abstractions.Command;
/// <summary>
/// 表示一个异步命令接口,该命令不返回结果

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.Rule;
namespace GFramework.Core.Abstractions.command;
namespace GFramework.Core.Abstractions.Command;
/// <summary>
/// 命令接口,定义了无返回值命令的基本契约

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.command;
namespace GFramework.Core.Abstractions.Command;
/// <summary>
/// 定义命令执行器接口,提供同步和异步方式发送并执行命令的方法。

View File

@ -0,0 +1,49 @@
// Copyright (c) 2025 GeWuYou
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using GFramework.Core.Abstractions.Utility;
namespace GFramework.Core.Abstractions.Concurrency;
/// <summary>
/// 异步键锁管理器接口,提供基于键的细粒度锁机制
/// </summary>
public interface IAsyncKeyLockManager : IUtility, IDisposable
{
/// <summary>
/// 异步获取指定键的锁(推荐使用)
/// </summary>
/// <param name="key">锁键</param>
/// <param name="cancellationToken">取消令牌</param>
/// <returns>锁句柄,使用 await using 自动释放</returns>
ValueTask<IAsyncLockHandle> AcquireLockAsync(string key, CancellationToken cancellationToken = default);
/// <summary>
/// 同步获取指定键的锁(兼容性方法)
/// </summary>
/// <param name="key">锁键</param>
/// <returns>锁句柄,使用 using 自动释放</returns>
IAsyncLockHandle AcquireLock(string key);
/// <summary>
/// 获取锁管理器的统计信息
/// </summary>
/// <returns>统计信息快照</returns>
LockStatistics GetStatistics();
/// <summary>
/// 获取当前活跃的锁信息(用于调试)
/// </summary>
/// <returns>键到锁信息的只读字典</returns>
IReadOnlyDictionary<string, LockInfo> GetActiveLocks();
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2025 GeWuYou
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.Concurrency;
/// <summary>
/// 异步锁句柄接口,支持 await using 语法
/// </summary>
public interface IAsyncLockHandle : IAsyncDisposable, IDisposable
{
/// <summary>
/// 锁的键
/// </summary>
string Key { get; }
/// <summary>
/// 锁获取时的时间戳Environment.TickCount64
/// </summary>
long AcquiredTicks { get; }
}

View File

@ -0,0 +1,43 @@
// Copyright (c) 2025 GeWuYou
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.Concurrency;
/// <summary>
/// 锁信息(用于调试)
/// </summary>
public readonly struct LockInfo
{
/// <summary>
/// 锁的键。
/// </summary>
public string Key { get; init; }
/// <summary>
/// 当前引用计数。
/// </summary>
public int ReferenceCount { get; init; }
/// <summary>
/// 最后访问时间戳Environment.TickCount64
/// </summary>
public long LastAccessTicks { get; init; }
/// <summary>
/// 等待队列长度(近似值)。
/// 注意:这是一个基于 SemaphoreSlim.CurrentCount 的近似指示器,
/// 当 CurrentCount == 0 时表示锁被持有且可能有等待者,返回 1
/// 否则返回 0。这不是精确的等待者数量仅用于调试参考。
/// </summary>
public int WaitingCount { get; init; }
}

View File

@ -0,0 +1,43 @@
// Copyright (c) 2025 GeWuYou
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Runtime.InteropServices;
namespace GFramework.Core.Abstractions.Concurrency;
/// <summary>
/// 锁统计信息
/// </summary>
[StructLayout(LayoutKind.Auto)]
public readonly struct LockStatistics
{
/// <summary>
/// 当前活跃的锁数量
/// </summary>
public int ActiveLockCount { get; init; }
/// <summary>
/// 累计获取锁的次数
/// </summary>
public int TotalAcquired { get; init; }
/// <summary>
/// 累计释放锁的次数
/// </summary>
public int TotalReleased { get; init; }
/// <summary>
/// 累计清理的锁数量
/// </summary>
public int TotalCleaned { get; init; }
}

View File

@ -1,7 +1,7 @@
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.utility;
using GFramework.Core.Abstractions.Events;
using GFramework.Core.Abstractions.Utility;
namespace GFramework.Core.Abstractions.configuration;
namespace GFramework.Core.Abstractions.Configuration;
/// <summary>
/// 配置管理器接口,提供类型安全的配置存储和访问

View File

@ -1,38 +1,38 @@
namespace GFramework.Core.Abstractions.controller;
/// <summary>
/// 控制器标记接口,用于标识控制器组件
/// </summary>
/// <remarks>
/// <para>
/// IController 是一个标记接口Marker Interface不包含任何方法或属性。
/// 它的作用是标识一个类是控制器,用于协调 Model、System 和 UI 之间的交互。
/// </para>
/// <para>
/// 架构访问 :控制器通常需要访问架构上下文。使用 [ContextAware] 特性
/// 自动生成上下文访问能力:
/// </para>
/// <code>
/// using GFramework.SourceGenerators.Abstractions.rule;
///
/// [ContextAware]
/// public partial class PlayerController : IController
/// {
/// public void Initialize()
/// {
/// // [ContextAware] 实现 IContextAware 接口,可使用扩展方法
/// var playerModel = this.GetModel&lt;PlayerModel&gt;();
/// var gameSystem = this.GetSystem&lt;GameSystem&gt;();
/// }
/// }
/// </code>
/// <para>
/// 注意:
/// </para>
/// <list type="bullet">
/// <item>必须添加 partial 关键字</item>
/// <item>[ContextAware] 特性会自动实现 IContextAware 接口</item>
/// <item>可使用 this.GetModel()、this.GetSystem() 等扩展方法访问架构</item>
/// </list>
/// </remarks>
namespace GFramework.Core.Abstractions.Controller;
/// <summary>
/// 控制器标记接口,用于标识控制器组件
/// </summary>
/// <remarks>
/// <para>
/// IController 是一个标记接口Marker Interface不包含任何方法或属性。
/// 它的作用是标识一个类是控制器,用于协调 Model、System 和 UI 之间的交互。
/// </para>
/// <para>
/// 架构访问 :控制器通常需要访问架构上下文。使用 [ContextAware] 特性
/// 自动生成上下文访问能力:
/// </para>
/// <code>
/// using GFramework.SourceGenerators.Abstractions.Rule;
///
/// [ContextAware]
/// public partial class PlayerController : IController
/// {
/// public void Initialize()
/// {
/// // [ContextAware] 实现 IContextAware 接口,可使用扩展方法
/// var playerModel = this.GetModel&lt;PlayerModel&gt;();
/// var gameSystem = this.GetSystem&lt;GameSystem&gt;();
/// }
/// }
/// </code>
/// <para>
/// 注意:
/// </para>
/// <list type="bullet">
/// <item>必须添加 partial 关键字</item>
/// <item>[ContextAware] 特性会自动实现 IContextAware 接口</item>
/// <item>可使用 this.GetModel()、this.GetSystem() 等扩展方法访问架构</item>
/// </list>
/// </remarks>
public interface IController;

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.Abstractions.Coroutine;
/// <summary>
/// 协程优先级枚举

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.Abstractions.Coroutine;
/// <summary>
/// 表示协程的执行状态枚举

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.Abstractions.Coroutine;
/// <summary>
/// 协程统计信息接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.Abstractions.Coroutine;
/// <summary>
/// 时间源接口,提供当前时间、时间增量以及更新功能

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.coroutine;
namespace GFramework.Core.Abstractions.Coroutine;
/// <summary>
/// 定义一个可等待指令的接口,用于协程系统中的异步操作控制

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.cqrs.command;
namespace GFramework.Core.Abstractions.Cqrs.Command;
/// <summary>
/// 命令输入接口,定义命令模式中输入数据的契约

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.cqrs;
namespace GFramework.Core.Abstractions.Cqrs;
/// <summary>
/// 表示输入数据的标记接口。

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.cqrs.notification;
namespace GFramework.Core.Abstractions.Cqrs.Notification;
/// <summary>
/// 表示通知输入数据的标记接口。

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.cqrs.query;
namespace GFramework.Core.Abstractions.Cqrs.Query;
/// <summary>
/// 查询输入接口,定义了查询操作的输入规范

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.cqrs.request;
namespace GFramework.Core.Abstractions.Cqrs.Request;
/// <summary>
/// 表示请求输入数据的标记接口。

View File

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
namespace GFramework.Core.Abstractions.data;
namespace GFramework.Core.Abstractions.Data;
/// <summary>
/// 定义从指定类型数据源加载数据的接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.enums;
namespace GFramework.Core.Abstractions.Enums;
/// <summary>
/// 架构阶段枚举,定义了系统架构初始化和运行过程中的各个关键阶段

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.environment;
namespace GFramework.Core.Abstractions.Environment;
/// <summary>
/// 定义环境接口,提供应用程序运行环境的相关信息

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件上下文,包装事件数据并提供控制方法

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件传播模式

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件接口,定义了事件注册的基本功能

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件总线接口,提供事件的发送、注册和注销功能

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件过滤器接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 事件统计信息接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 提供注销功能的接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.events;
namespace GFramework.Core.Abstractions.Events;
/// <summary>
/// 提供统一注销功能的接口,用于管理需要注销的对象列表

View File

@ -17,11 +17,11 @@
<Using Include="GFramework.Core.Abstractions"/>
</ItemGroup>
<ItemGroup>
<PackageReference Update="Meziantou.Analyzer" Version="3.0.19">
<PackageReference Update="Meziantou.Analyzer" Version="3.0.25">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Update="Meziantou.Polyfill" Version="1.0.103">
<PackageReference Update="Meziantou.Polyfill" Version="1.0.104">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

View File

@ -1,18 +1,20 @@
// IsExternalInit.cs
// This type is required to support init-only setters and record types
// when targeting netstandard2.0 or older frameworks.
#if !NET5_0_OR_GREATER
using System.ComponentModel;
namespace System.Runtime.CompilerServices;
/// <summary>
/// 提供一个占位符类型,用于支持 C# 9.0 的 init 访问器功能。
/// 该类型在 .NET 5.0 及更高版本中已内置,因此仅在较低版本的 .NET 中定义。
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
// IsExternalInit.cs
// This type is required to support init-only setters and record types
// when targeting netstandard2.0 or older frameworks.
#if !NET5_0_OR_GREATER
using System.ComponentModel;
// ReSharper disable CheckNamespace
namespace System.Runtime.CompilerServices;
/// <summary>
/// 提供一个占位符类型,用于支持 C# 9.0 的 init 访问器功能。
/// 该类型在 .NET 5.0 及更高版本中已内置,因此仅在较低版本的 .NET 中定义。
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
#endif

View File

@ -1,8 +1,8 @@
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.system;
using GFramework.Core.Abstractions.Rule;
using GFramework.Core.Abstractions.Systems;
using Microsoft.Extensions.DependencyInjection;
namespace GFramework.Core.Abstractions.ioc;
namespace GFramework.Core.Abstractions.Ioc;
/// <summary>
/// 依赖注入容器接口,定义了服务注册、解析和管理的基本操作

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 定义异步销毁接口,用于需要异步清理资源的组件

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 定义异步初始化接口,用于需要异步初始化的组件或服务

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 定义异步生命周期接口,组合了异步初始化和异步销毁

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 可销毁接口,为需要资源清理的组件提供标准销毁能力

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 可初始化接口,为需要初始化的组件提供标准初始化能力

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.lifecycle;
namespace GFramework.Core.Abstractions.Lifecycle;
/// <summary>
/// 完整生命周期接口,组合了初始化和销毁能力

View File

@ -0,0 +1,22 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化格式化器接口
/// </summary>
public interface ILocalizationFormatter
{
/// <summary>
/// 格式化器名称
/// </summary>
string Name { get; }
/// <summary>
/// 尝试格式化值
/// </summary>
/// <param name="format">格式字符串</param>
/// <param name="value">要格式化的值</param>
/// <param name="provider">格式提供者</param>
/// <param name="result">格式化结果</param>
/// <returns>是否成功格式化</returns>
bool TryFormat(string format, object value, IFormatProvider? provider, out string result);
}

View File

@ -0,0 +1,89 @@
using System.Globalization;
using GFramework.Core.Abstractions.Systems;
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化管理器接口
/// </summary>
public interface ILocalizationManager : ISystem
{
/// <summary>
/// 当前语言代码
/// </summary>
string CurrentLanguage { get; }
/// <summary>
/// 当前文化信息
/// </summary>
CultureInfo CurrentCulture { get; }
/// <summary>
/// 可用语言列表
/// </summary>
IReadOnlyList<string> AvailableLanguages { get; }
/// <summary>
/// 设置当前语言
/// </summary>
/// <param name="languageCode">语言代码</param>
void SetLanguage(string languageCode);
/// <summary>
/// 获取本地化表
/// </summary>
/// <param name="tableName">表名</param>
/// <returns>本地化表</returns>
ILocalizationTable GetTable(string tableName);
/// <summary>
/// 获取本地化文本
/// </summary>
/// <param name="table">表名</param>
/// <param name="key">键名</param>
/// <returns>本地化文本</returns>
string GetText(string table, string key);
/// <summary>
/// 获取本地化字符串(支持变量和格式化)
/// </summary>
/// <param name="table">表名</param>
/// <param name="key">键名</param>
/// <returns>本地化字符串</returns>
ILocalizationString GetString(string table, string key);
/// <summary>
/// 尝试获取本地化文本
/// </summary>
/// <param name="table">表名</param>
/// <param name="key">键名</param>
/// <param name="text">输出文本</param>
/// <returns>是否成功获取</returns>
bool TryGetText(string table, string key, out string text);
/// <summary>
/// 注册格式化器
/// </summary>
/// <param name="name">格式化器名称</param>
/// <param name="formatter">格式化器实例</param>
void RegisterFormatter(string name, ILocalizationFormatter formatter);
/// <summary>
/// 获取格式化器
/// </summary>
/// <param name="name">格式化器名称</param>
/// <returns>格式化器实例,如果不存在则返回 null</returns>
ILocalizationFormatter? GetFormatter(string name);
/// <summary>
/// 订阅语言变化事件
/// </summary>
/// <param name="callback">回调函数</param>
void SubscribeToLanguageChange(Action<string> callback);
/// <summary>
/// 取消订阅语言变化事件
/// </summary>
/// <param name="callback">回调函数</param>
void UnsubscribeFromLanguageChange(Action<string> callback);
}

View File

@ -0,0 +1,50 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化字符串接口(支持变量和格式化)
/// </summary>
public interface ILocalizationString
{
/// <summary>
/// 表名
/// </summary>
string Table { get; }
/// <summary>
/// 键名
/// </summary>
string Key { get; }
/// <summary>
/// 添加变量
/// </summary>
/// <param name="name">变量名</param>
/// <param name="value">变量值</param>
/// <returns>当前实例(支持链式调用)</returns>
ILocalizationString WithVariable(string name, object value);
/// <summary>
/// 批量添加变量
/// </summary>
/// <param name="variables">变量数组</param>
/// <returns>当前实例(支持链式调用)</returns>
ILocalizationString WithVariables(params (string name, object value)[] variables);
/// <summary>
/// 格式化并返回最终文本
/// </summary>
/// <returns>格式化后的文本</returns>
string Format();
/// <summary>
/// 获取原始文本(不进行格式化)
/// </summary>
/// <returns>原始文本</returns>
string GetRaw();
/// <summary>
/// 检查键是否存在
/// </summary>
/// <returns>是否存在</returns>
bool Exists();
}

View File

@ -0,0 +1,48 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化表接口
/// </summary>
public interface ILocalizationTable
{
/// <summary>
/// 表名
/// </summary>
string Name { get; }
/// <summary>
/// 语言代码
/// </summary>
string Language { get; }
/// <summary>
/// 回退表(当前表中找不到键时使用)
/// </summary>
ILocalizationTable? Fallback { get; }
/// <summary>
/// 获取原始文本(不进行格式化)
/// </summary>
/// <param name="key">键名</param>
/// <returns>原始文本</returns>
string GetRawText(string key);
/// <summary>
/// 检查是否包含指定键
/// </summary>
/// <param name="key">键名</param>
/// <returns>是否包含</returns>
bool ContainsKey(string key);
/// <summary>
/// 获取所有键
/// </summary>
/// <returns>键集合</returns>
IEnumerable<string> GetKeys();
/// <summary>
/// 合并覆盖数据
/// </summary>
/// <param name="overrides">覆盖数据</param>
void Merge(IReadOnlyDictionary<string, string> overrides);
}

View File

@ -0,0 +1,37 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化配置
/// </summary>
public class LocalizationConfig
{
/// <summary>
/// 默认语言代码
/// </summary>
public string DefaultLanguage { get; set; } = "eng";
/// <summary>
/// 回退语言代码(当目标语言缺少键时使用)
/// </summary>
public string FallbackLanguage { get; set; } = "eng";
/// <summary>
/// 本地化文件路径Godot 资源路径)
/// </summary>
public string LocalizationPath { get; set; } = "res://localization";
/// <summary>
/// 用户覆盖文件路径(用于热更新和自定义翻译)
/// </summary>
public string OverridePath { get; set; } = "user://localization_override";
/// <summary>
/// 是否启用热重载(监视覆盖文件变化)
/// </summary>
public bool EnableHotReload { get; set; } = true;
/// <summary>
/// 是否在加载时验证本地化文件
/// </summary>
public bool ValidateOnLoad { get; set; } = true;
}

View File

@ -0,0 +1,31 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化异常基类
/// </summary>
public class LocalizationException : Exception
{
/// <summary>
/// 初始化本地化异常
/// </summary>
public LocalizationException()
{
}
/// <summary>
/// 初始化本地化异常
/// </summary>
/// <param name="message">异常消息</param>
public LocalizationException(string message) : base(message)
{
}
/// <summary>
/// 初始化本地化异常
/// </summary>
/// <param name="message">异常消息</param>
/// <param name="innerException">内部异常</param>
public LocalizationException(string message, Exception innerException) : base(message, innerException)
{
}
}

View File

@ -0,0 +1,29 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化键未找到异常
/// </summary>
public class LocalizationKeyNotFoundException : LocalizationException
{
/// <summary>
/// 初始化键未找到异常
/// </summary>
/// <param name="tableName">表名</param>
/// <param name="key">键名</param>
public LocalizationKeyNotFoundException(string tableName, string key)
: base($"Localization key '{key}' not found in table '{tableName}'")
{
TableName = tableName;
Key = key;
}
/// <summary>
/// 表名
/// </summary>
public string TableName { get; }
/// <summary>
/// 键名
/// </summary>
public string Key { get; }
}

View File

@ -0,0 +1,22 @@
namespace GFramework.Core.Abstractions.Localization;
/// <summary>
/// 本地化表未找到异常
/// </summary>
public class LocalizationTableNotFoundException : LocalizationException
{
/// <summary>
/// 初始化表未找到异常
/// </summary>
/// <param name="tableName">表名</param>
public LocalizationTableNotFoundException(string tableName)
: base($"Localization table '{tableName}' not found")
{
TableName = tableName;
}
/// <summary>
/// 表名
/// </summary>
public string TableName { get; }
}

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 日志输出器接口,负责将日志条目写入特定目标

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 日志过滤器接口,用于决定是否应该记录某条日志

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 日志格式化器接口,用于将日志条目格式化为字符串

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 定义日志记录接口,提供日志记录和级别检查功能

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 定义日志工厂接口,用于创建日志记录器实例

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 定义日志工厂提供者的接口,用于创建具有指定名称和最小日志级别的日志记录器

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 支持结构化日志的日志记录器接口

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 日志上下文,用于在异步流中传递结构化属性

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 日志条目,包含完整的日志信息

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.logging;
namespace GFramework.Core.Abstractions.Logging;
/// <summary>
/// 定义日志级别的枚举,用于标识不同严重程度的日志消息

View File

@ -0,0 +1,10 @@
using GFramework.Core.Abstractions.Architectures;
using GFramework.Core.Abstractions.Lifecycle;
using GFramework.Core.Abstractions.Rule;
namespace GFramework.Core.Abstractions.Model;
/// <summary>
/// 模型接口,定义了模型的基本行为和功能
/// </summary>
public interface IModel : IContextAware, IArchitecturePhaseListener, IInitializable;

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pause;
namespace GFramework.Core.Abstractions.Pause;
/// <summary>
/// 暂停处理器接口,由引擎层实现具体的暂停/恢复逻辑

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.utility;
using GFramework.Core.Abstractions.Utility;
namespace GFramework.Core.Abstractions.pause;
namespace GFramework.Core.Abstractions.Pause;
/// <summary>
/// 暂停栈管理器接口,管理嵌套暂停状态
@ -75,7 +75,9 @@ public interface IPauseStackManager : IContextUtility
void UnregisterHandler(IPauseHandler handler);
/// <summary>
/// 暂停状态变化事件
/// 暂停状态变化事件。
/// 事件遵循标准 .NET 事件模式,事件源为触发通知的暂停管理器实例,
/// 事件数据由 <see cref="PauseStateChangedEventArgs"/> 提供。
/// </summary>
event Action<PauseGroup, bool>? OnPauseStateChanged;
event EventHandler<PauseStateChangedEventArgs>? OnPauseStateChanged;
}

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pause;
namespace GFramework.Core.Abstractions.Pause;
/// <summary>
/// 暂停组枚举,定义不同的暂停作用域

View File

@ -0,0 +1,30 @@
namespace GFramework.Core.Abstractions.Pause;
/// <summary>
/// 表示暂停状态变化事件的数据。
/// 该类型用于向事件订阅者传递暂停组以及该组变化后的暂停状态。
/// </summary>
public sealed class PauseStateChangedEventArgs : EventArgs
{
/// <summary>
/// 初始化 <see cref="PauseStateChangedEventArgs"/> 的新实例。
/// </summary>
/// <param name="group">发生状态变化的暂停组。</param>
/// <param name="isPaused">暂停组变化后的新状态。</param>
public PauseStateChangedEventArgs(PauseGroup group, bool isPaused)
{
Group = group;
IsPaused = isPaused;
}
/// <summary>
/// 获取发生状态变化的暂停组。
/// </summary>
public PauseGroup Group { get; }
/// <summary>
/// 获取暂停组变化后的新状态。
/// 为 <see langword="true"/> 表示进入暂停,为 <see langword="false"/> 表示恢复运行。
/// </summary>
public bool IsPaused { get; }
}

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pause;
namespace GFramework.Core.Abstractions.Pause;
/// <summary>
/// 暂停令牌,唯一标识一个暂停请求

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pool;
namespace GFramework.Core.Abstractions.Pool;
/// <summary>
/// 对象池系统接口,定义了对象池的基本操作

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pool;
namespace GFramework.Core.Abstractions.Pool;
/// <summary>
/// 定义可池化对象的接口,提供对象在池中的生命周期管理方法

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.pool;
namespace GFramework.Core.Abstractions.Pool;
/// <summary>
/// 对象池统计信息

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.properties;
namespace GFramework.Core.Abstractions.Properties;
/// <summary>
/// 架构选项配置类,用于定义架构行为的相关配置选项。

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.logging;
using GFramework.Core.Abstractions.Logging;
namespace GFramework.Core.Abstractions.properties;
namespace GFramework.Core.Abstractions.Properties;
/// <summary>
/// 日志配置选项类,用于配置日志系统的相关参数

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.property;
namespace GFramework.Core.Abstractions.Property;
/// <summary>
/// 可绑定属性接口,继承自只读可绑定属性接口,提供可读写的属性绑定功能

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.Events;
namespace GFramework.Core.Abstractions.property;
namespace GFramework.Core.Abstractions.Property;
/// <summary>
/// 只读可绑定属性接口,提供属性值的读取和变更监听功能

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.query;
namespace GFramework.Core.Abstractions.Query;
/// <summary>
/// 异步查询接口,定义了执行异步查询操作的方法

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.query;
namespace GFramework.Core.Abstractions.Query;
/// <summary>

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.Rule;
namespace GFramework.Core.Abstractions.query;
namespace GFramework.Core.Abstractions.Query;
/// <summary>
/// 查询接口,定义了执行查询操作的契约

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.query;
namespace GFramework.Core.Abstractions.Query;
/// <summary>

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.bases;
using GFramework.Core.Abstractions.Bases;
namespace GFramework.Core.Abstractions.registries;
namespace GFramework.Core.Abstractions.Registries;
/// <summary>
/// 表示一个通用的注册表接口用于根据键类型T获取值类型TR的对象

View File

@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using GFramework.Core.Abstractions.bases;
using GFramework.Core.Abstractions.Bases;
namespace GFramework.Core.Abstractions.registries;
namespace GFramework.Core.Abstractions.Registries;
/// <summary>
/// 基于Dictionary的通用键值注册表基类

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.resource;
namespace GFramework.Core.Abstractions.Resource;
/// <summary>
/// 资源句柄接口,用于管理资源的生命周期和引用

View File

@ -1,4 +1,4 @@
namespace GFramework.Core.Abstractions.resource;
namespace GFramework.Core.Abstractions.Resource;
/// <summary>
/// 资源加载器接口,用于加载特定类型的资源

View File

@ -1,6 +1,6 @@
using GFramework.Core.Abstractions.utility;
using GFramework.Core.Abstractions.Utility;
namespace GFramework.Core.Abstractions.resource;
namespace GFramework.Core.Abstractions.Resource;
/// <summary>
/// 资源管理器接口,提供资源加载、缓存和卸载功能

Some files were not shown because too many files have changed in this diff Show More