Files
daluandou/.codely.packages/cn.tuanjie.codely.bridge@1.0.85-785dea6a/Editor/Bridge/Helpers/CommandContext.cs
T
huadexuan 53d95802e5 ```
feat(gameplay): 更新单位属性和材质配置

- 调整多个单位的基础生命值和攻击力数值平衡
- 修改CoreBattleGround材质的纹理缩放比例
- 更新地砖材质颜色为白色
- 优化纹理资源设置,调整最大纹理尺寸并添加PlayableAds平台支持
- 修复弓箭手技能目标查找逻辑,改用统一的敌人检测方法
- 为水晶矿添加中立阵营设置和光球视觉效果同步
- 调整预制体中的全局缩放参数
- 为狼人和石巨人添加NavMeshAgent组件支持
- 优化水晶矿血条显示位置计算方式
```
2026-09-20 21:52:31 +08:00

39 lines
1.4 KiB
C#

using System;
namespace UnityTcp.Editor.Helpers
{
/// <summary>
/// Ambient context for the command currently being dispatched. The dispatching loop sets it
/// right before a handler runs and clears it afterwards, so a <c>HandleCommand(JObject)</c>
/// can read the native request id (to start a runner job) without changing its prototype.
///
/// Commands are dispatched serially per thread — the editor main loop and the
/// <see cref="BackgroundCommandPump"/> worker each set/clear around a handler — so the
/// backing fields are thread-local to keep the two dispatchers from seeing each other's
/// context.
/// </summary>
public static class CommandContext
{
[ThreadStatic] private static ulong _requestId;
[ThreadStatic] private static string _commandType;
/// <summary>Native request id of the command being handled (for EnqueueResponse).</summary>
public static ulong RequestId => _requestId;
/// <summary>Command type of the command being handled (usable as a job name).</summary>
public static string CommandType => _commandType;
public static void Set(ulong requestId, string commandType)
{
_requestId = requestId;
_commandType = commandType;
}
public static void Clear()
{
_requestId = 0;
_commandType = null;
}
}
}