mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
docs(cqrs): 收口 source generator 文档命名空间
- 更新 docs/zh-CN 中 source generator 示例的命名空间到当前公开 API - 修正文档叙述与 API 参考中的旧聚合模块表述 - 对齐 source generator 家族文档与教程示例的当前模块划分
This commit is contained in:
parent
d54d770c2f
commit
4eca2f1060
@ -434,9 +434,11 @@ Godot 引擎集成模块。
|
||||
|
||||
## 源码生成器
|
||||
|
||||
### GFramework.SourceGenerators
|
||||
### Source Generators 家族
|
||||
|
||||
自动代码生成工具。
|
||||
自动代码生成工具按模块拆分为 `GFramework.Core.SourceGenerators`、`GFramework.Game.SourceGenerators`、
|
||||
`GFramework.Godot.SourceGenerators` 与 `GFramework.Cqrs.SourceGenerators`。面向业务代码声明的 Attribute
|
||||
主要来自 `GFramework.Core.SourceGenerators.Abstractions.*` 与对应模块的 runtime/generator 包。
|
||||
|
||||
#### 支持的生成器
|
||||
|
||||
|
||||
@ -657,7 +657,7 @@ public partial class UIController : IController
|
||||
### 事件组合
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
// 使用 OrEvent 组合多个事件
|
||||
[ContextAware]
|
||||
|
||||
@ -33,7 +33,7 @@ public class CombatSystem : AbstractSystem
|
||||
}
|
||||
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PlayerController : IController
|
||||
@ -182,7 +182,7 @@ public class StorageUtility : IUtility { }
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class MyController : IController
|
||||
|
||||
@ -278,7 +278,7 @@ public class PoolMonitorSystem : AbstractSystem
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
// ✅ 好的做法:正确管理事件订阅
|
||||
[ContextAware]
|
||||
|
||||
@ -57,7 +57,7 @@ public class SimpleCommand : AbstractCommand
|
||||
|
||||
// 使用命令
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
@ -221,7 +221,7 @@ public class StartGameCommand : AbstractCommand<StartGameInput>
|
||||
|
||||
// 使用命令
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
|
||||
@ -622,7 +622,7 @@ public class SettingsSystem : AbstractSystem
|
||||
### 在 Controller 中使用
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class SettingsController : IController
|
||||
|
||||
@ -354,7 +354,7 @@ public class CombatSystem : AbstractSystem
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
@ -452,7 +452,7 @@ public class EventBridge : AbstractSystem
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class TutorialController : IController
|
||||
@ -502,7 +502,7 @@ public class AchievementSystem : AbstractSystem
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class MyController : IController
|
||||
|
||||
@ -109,7 +109,7 @@ event EventHandler<PauseStateChangedEventArgs>? OnPauseStateChanged;
|
||||
### 1. 获取暂停管理器
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
@ -127,7 +127,7 @@ public partial class GameController : IController
|
||||
### 2. 简单的暂停/恢复
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PauseMenuController : IController
|
||||
@ -163,7 +163,7 @@ public partial class PauseMenuController : IController
|
||||
### 3. 使用作用域自动管理
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class DialogController : IController
|
||||
@ -215,7 +215,7 @@ public class GameplaySystem : AbstractSystem
|
||||
### 1. 嵌套暂停
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class UIManager : IController
|
||||
@ -254,7 +254,7 @@ public partial class UIManager : IController
|
||||
### 2. 分组暂停
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameManager : IController
|
||||
@ -362,7 +362,7 @@ public class GameInitializer
|
||||
### 4. 监听暂停状态变化
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PauseIndicator : IController
|
||||
@ -404,7 +404,7 @@ public partial class PauseIndicator : IController
|
||||
### 5. 调试暂停状态
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PauseDebugger : IController
|
||||
@ -441,7 +441,7 @@ public partial class PauseDebugger : IController
|
||||
### 6. 紧急恢复
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class EmergencyController : IController
|
||||
@ -682,7 +682,7 @@ public class ThreadSafeUsage
|
||||
在组件销毁时注销处理器和事件:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class ProperCleanup : IController
|
||||
@ -784,7 +784,7 @@ public class SelectiveSystem : AbstractSystem
|
||||
A: 暂停系统控制是否执行,时间缩放需要使用时间系统:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class SlowMotionController : IController
|
||||
@ -829,7 +829,7 @@ _pauseManager.Push("AI 系统", PauseGroup.Custom3);
|
||||
A: 使用 `PauseScope` 配合 `async/await`:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class AsyncPauseExample : IController
|
||||
|
||||
@ -240,7 +240,7 @@ public class PlayerModel : AbstractModel
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PlayerUI : Control, IController
|
||||
@ -384,7 +384,7 @@ public class PlayerModel : AbstractModel
|
||||
|
||||
```c#
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class CombatController : Node, IController
|
||||
|
||||
@ -145,7 +145,7 @@ public class LoadPlayerDataQuery : AbstractAsyncQuery<LoadPlayerDataInput, Playe
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class ShopUI : IController
|
||||
|
||||
@ -129,7 +129,7 @@ public class GameArchitecture : Architecture
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
@ -221,7 +221,7 @@ public class LoadingState : AsyncContextAwareStateBase
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
|
||||
@ -390,7 +390,7 @@ using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Abstractions.Events;
|
||||
using GFramework.Core.Events;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PlayerPanelController : IController
|
||||
|
||||
@ -186,7 +186,7 @@ public class GameArchitecture : Architecture
|
||||
```csharp
|
||||
// 在 Controller 中
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
|
||||
@ -164,7 +164,7 @@ public class GameArchitecture : Architecture
|
||||
```csharp
|
||||
using Arch.Core;
|
||||
using GFramework.Core.Abstractions.Rule;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using MyGame.Components;
|
||||
|
||||
[ContextAware]
|
||||
@ -508,7 +508,7 @@ World.Query(in query, (Entity entity, ref Position pos) =>
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.bases;
|
||||
using GFramework.SourceGenerators.Abstractions.bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
|
||||
// 使用 Priority 特性设置优先级
|
||||
[Priority(10)] // 高优先级,先执行
|
||||
|
||||
@ -131,7 +131,7 @@ public class SaveData : IVersionedData
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class SaveController : IController
|
||||
@ -238,7 +238,7 @@ public async Task ShowSaveList()
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class AutoSaveController : IController
|
||||
@ -367,7 +367,7 @@ public async Task<SaveData> LoadGame(int slot)
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class SettingsController : IController
|
||||
|
||||
@ -165,7 +165,7 @@ public class GameSceneRegistry : IGameSceneRegistry
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class GameController : IController
|
||||
@ -353,7 +353,7 @@ sceneRouter.AddTransitionHandler(new FadeTransitionHandler());
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class SceneNavigationController : IController
|
||||
@ -437,7 +437,7 @@ public class GameplayScene : IScene
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PreloadController : IController
|
||||
|
||||
@ -94,7 +94,7 @@ public class GameArchitecture : Architecture
|
||||
使用泛型 API 序列化对象:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
public class PlayerData
|
||||
{
|
||||
@ -175,7 +175,7 @@ public void SerializeRuntimeType()
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Storage;
|
||||
using GFramework.Game.Storage;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class DataManager : IController
|
||||
|
||||
@ -127,7 +127,7 @@ public class MainMenuPage : IUiPage
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class UiController : IController
|
||||
@ -305,7 +305,7 @@ uiRouter.RegisterHandler(new FadeTransitionHandler());
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class DialogController : IController
|
||||
@ -338,7 +338,7 @@ public partial class DialogController : IController
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class NavigationController : IController
|
||||
@ -374,7 +374,7 @@ public partial class NavigationController : IController
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class LayerController : IController
|
||||
|
||||
@ -341,7 +341,7 @@ public class GameArchitecture : AbstractArchitecture
|
||||
```csharp
|
||||
using Godot;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class Player : CharacterBody2D, IController
|
||||
@ -519,7 +519,7 @@ public partial class GameRoot : Node
|
||||
使用 `[ContextAware]` 特性或直接使用单例:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
// 方式 1: 使用 [ContextAware] 特性(推荐)
|
||||
[ContextAware]
|
||||
|
||||
@ -29,7 +29,7 @@ using GFramework.Core.Abstractions.Architectures;
|
||||
using GFramework.Core.Abstractions.Model;
|
||||
using GFramework.Core.Abstractions.Systems;
|
||||
using GFramework.Core.Abstractions.Utility;
|
||||
using GFramework.SourceGenerators.Abstractions.Architectures;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Architectures;
|
||||
|
||||
public sealed class RunStateModel : IModel
|
||||
{
|
||||
|
||||
@ -126,7 +126,7 @@ partial class MainMenu
|
||||
```csharp
|
||||
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||
using GFramework.Game.Abstractions.Enums;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using Godot;
|
||||
|
||||
[ContextAware]
|
||||
|
||||
@ -640,7 +640,7 @@ private void OnQuitButtonPressed() { }
|
||||
在需要架构访问的场景中,与 `[ContextAware]` 结合:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
||||
|
||||
[ContextAware]
|
||||
|
||||
@ -21,7 +21,7 @@ ContextAware 生成器为标记了 `[ContextAware]` 属性的类自动生成 `IC
|
||||
使用 `[ContextAware]` 属性标记需要访问架构上下文的类:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
|
||||
[ContextAware]
|
||||
@ -233,7 +233,7 @@ public partial class GameFlowController : IController
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class PlayerController : Node, IController
|
||||
|
||||
@ -45,7 +45,7 @@ Context Get 注入依赖 `[ContextAware]` 特性提供的上下文访问能力
|
||||
使用 `[GetModel]`、`[GetSystem]`、`[GetUtility]` 和 `[GetService]` 注入单个实例:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.Abstractions.Model;
|
||||
using GFramework.Core.Abstractions.Systems;
|
||||
using GFramework.Core.Abstractions.Utility;
|
||||
@ -80,7 +80,7 @@ public partial class PlayerController
|
||||
使用 `[GetModels]`、`[GetSystems]`、`[GetUtilities]` 和 `[GetServices]` 注入多个实例:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
public partial class StrategyManager
|
||||
@ -108,7 +108,7 @@ public partial class StrategyManager
|
||||
`[GetAll]` 特性标记在类上,自动推断所有符合类型的字段并注入:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
[GetAll]
|
||||
@ -280,7 +280,7 @@ public partial class GameNode : Node
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
[GetAll]
|
||||
@ -328,7 +328,7 @@ public partial class StrategyManager
|
||||
|
||||
```csharp
|
||||
using Godot;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[ContextAware]
|
||||
[GetAll]
|
||||
@ -623,7 +623,7 @@ public partial class GameController
|
||||
|
||||
## 注册可见性分析
|
||||
|
||||
除了生成注入方法,`GFramework.SourceGenerators` 现在还会分析 `Model`、`System`、`Utility` 的使用点是否存在静态可见注册。
|
||||
除了生成注入方法,`GFramework.Core.SourceGenerators` 现在还会分析 `Model`、`System`、`Utility` 的使用点是否存在静态可见注册。
|
||||
|
||||
当前支持的使用点:
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
## 基础使用
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Enums;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Enums;
|
||||
|
||||
[GenerateEnumExtensions]
|
||||
public enum GameState
|
||||
|
||||
@ -172,7 +172,7 @@ public partial class Example : Control
|
||||
|
||||
```csharp
|
||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using Godot;
|
||||
|
||||
[ContextAware]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 日志生成器
|
||||
|
||||
> GFramework.SourceGenerators 自动生成日志代码,减少样板代码
|
||||
> GFramework.Core.SourceGenerators 自动生成日志代码,减少样板代码
|
||||
|
||||
## 概述
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
### 标记类
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Logging;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Logging;
|
||||
|
||||
[Log]
|
||||
public partial class MyService
|
||||
@ -165,8 +165,8 @@ public partial class MySystem : AbstractSystem
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Logging;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Logging;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[Log]
|
||||
[ContextAware]
|
||||
|
||||
@ -27,7 +27,7 @@ Priority 生成器通过源代码生成器自动实现 `IPrioritized` 接口,
|
||||
使用 `[Priority]` 特性为类标记优先级:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
|
||||
[Priority(10)]
|
||||
public partial class MySystem
|
||||
@ -91,7 +91,7 @@ foreach (var system in sorted)
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Bases;
|
||||
using GFramework.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
|
||||
[Priority(PriorityGroup.Critical)] // -100
|
||||
public partial class InputSystem : AbstractSystem { }
|
||||
@ -132,7 +132,7 @@ public static class PriorityGroup
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Systems;
|
||||
using GFramework.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.Abstractions.Bases;
|
||||
|
||||
// 输入系统最先初始化
|
||||
@ -550,9 +550,9 @@ public partial class GenericSystem<T> : ISystem
|
||||
Priority 可以与其他源代码生成器特性组合使用:
|
||||
|
||||
```csharp
|
||||
using GFramework.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.SourceGenerators.Abstractions.Logging;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Logging;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
[Priority(PriorityGroup.High)]
|
||||
[Log]
|
||||
@ -662,7 +662,7 @@ public class ManualPrioritySystem : IPrioritized
|
||||
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Systems;
|
||||
using GFramework.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Bases;
|
||||
using GFramework.Core.Abstractions.Bases;
|
||||
|
||||
// 输入系统(最先初始化)
|
||||
|
||||
@ -187,7 +187,7 @@ architecture.RegisterModel<ICounterModel>(new CounterModel());
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using Godot;
|
||||
using MyGFrameworkGame.scripts.Model;
|
||||
|
||||
@ -219,7 +219,7 @@ public partial class App : Control, IController // ← 实现 IController 接
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using Godot;
|
||||
using MyGFrameworkGame.scripts.Model;
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ public class DecreaseCountCommand : AbstractCommand
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using Godot;
|
||||
using MyGFrameworkGame.scripts.Command;
|
||||
using MyGFrameworkGame.scripts.Model;
|
||||
|
||||
@ -474,7 +474,7 @@ namespace MyShooterGame.Systems
|
||||
// Scripts/Controllers/PlayerController.cs
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using MyShooterGame.Architecture;
|
||||
using MyShooterGame.Models;
|
||||
using Godot;
|
||||
@ -630,7 +630,7 @@ public partial class Main : Node
|
||||
using Godot;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using MyShooterGame.Architecture;
|
||||
using MyShooterGame.Systems;
|
||||
|
||||
@ -673,7 +673,7 @@ using Godot;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.Core.Abstractions.Architecture;
|
||||
using GFramework.Core.Extensions;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using MyShooterGame.Architecture;
|
||||
using MyShooterGame.Systems;
|
||||
using MyShooterGame.Models;
|
||||
|
||||
@ -324,7 +324,7 @@ namespace MyGame.Systems
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Pause;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
namespace MyGame.Controllers
|
||||
{
|
||||
@ -664,7 +664,7 @@ namespace MyGame
|
||||
```csharp
|
||||
using GFramework.Core.Abstractions.Pause;
|
||||
using GFramework.Core.Abstractions.Controller;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MyGame.Controllers
|
||||
|
||||
@ -398,7 +398,7 @@ using GFramework.Core.Abstractions.State;
|
||||
using GFramework.Core.Extensions;
|
||||
using MyGame.States;
|
||||
using System.Threading.Tasks;
|
||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||
using GFramework.Core.SourceGenerators.Abstractions.Rule;
|
||||
|
||||
namespace MyGame.Controllers
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user