mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
style(docs): 修复代码块标记语法错误
- 修正了所有代码块前的标记符号,从 ``csharp 更改为 ```csharp - 确保了文档中代码片段的正确显示格式 - 提高了文档的可读性和语法规范性
This commit is contained in:
parent
033e2b076a
commit
8c04a5008a
@ -68,7 +68,7 @@ public sealed class QueryBus : IQueryBus
|
||||
|
||||
### 1. 定义查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 定义查询输入参数
|
||||
public record GetPlayerGoldQueryInput : IQueryInput;
|
||||
|
||||
@ -123,7 +123,7 @@ public GetItemCountQuery(string itemId) : base(new GetItemCountQueryInput(itemId
|
||||
|
||||
### 2. 发送查询(在 Controller 中)
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
public partial class ShopUI : Control, IController
|
||||
{
|
||||
[Export] private Button _buyButton;
|
||||
@ -156,7 +156,7 @@ public partial class ShopUI : Control, IController
|
||||
|
||||
### 3. 在 System 中使用
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
public class CombatSystem : AbstractSystem
|
||||
{
|
||||
protected override void OnInit()
|
||||
@ -185,7 +185,7 @@ this.RegisterEvent<EnemyAttackEvent>(OnEnemyAttack);
|
||||
|
||||
### 1. 带参数的复杂查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 查询指定范围内的敌人列表
|
||||
public class GetEnemiesInRangeQuery : AbstractQuery<List<Enemy>>
|
||||
{
|
||||
@ -209,7 +209,7 @@ var enemies = this.SendQuery(new GetEnemiesInRangeQuery
|
||||
|
||||
### 2. 组合查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 查询玩家是否可以使用技能
|
||||
public class CanUseSkillQuery : AbstractQuery<bool>
|
||||
{
|
||||
@ -256,7 +256,7 @@ public string SkillId { get; set; }
|
||||
|
||||
### 3. 聚合数据查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 查询玩家战斗力
|
||||
public class GetPlayerPowerQuery : AbstractQuery<int>
|
||||
{
|
||||
@ -295,7 +295,7 @@ public class GetPlayerInfoQuery : AbstractQuery<PlayerInfo>
|
||||
|
||||
### 4. 跨 System 查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 在 AI System 中查询玩家状态
|
||||
public class EnemyAISystem : AbstractSystem
|
||||
{
|
||||
@ -346,7 +346,7 @@ protected override void OnInit() { }
|
||||
- **返回值**:有返回值
|
||||
- **示例**:获取金币数量、检查技能冷却、查询玩家位置
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// ❌ 错误:在 Query 中修改状态
|
||||
public class BadQuery : AbstractQuery<int>
|
||||
{
|
||||
@ -392,7 +392,7 @@ public class AddGoldCommand : AbstractCommand
|
||||
|
||||
### 1. 缓存查询结果
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 在 Model 中缓存复杂计算
|
||||
public class PlayerModel : AbstractModel
|
||||
{
|
||||
@ -424,7 +424,7 @@ private int? _cachedPower;
|
||||
|
||||
### 2. 批量查询
|
||||
|
||||
``csharp
|
||||
```csharp
|
||||
// 一次查询多个数据,而不是多次单独查询
|
||||
public class GetMultipleItemCountsQuery : AbstractQuery<Dictionary<string, int>>
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user