主题
GameCore.Interface
ExecutionContextExtensions 双端
命名空间 GameCore.Interface
csharp
public static class ExecutionContextExtensions方法
ExecuteChild 仅服务端
csharp
public static CmdResult ExecuteChild(this IExecutionContext context, IGameLink<GameDataEffect>? link, ITarget? target = null)FactoryCreateChild 仅服务端
csharp
public static Effect? FactoryCreateChild(this IExecutionContext context, IGameLink<GameDataEffect> link, ITarget defaultTarget, bool preValidateOnly = false)ExecuteReward 仅服务端
csharp
public static ValueTask<CmdResult> ExecuteReward(this IExecutionContext context, IGameLink<GameDataReward>? link, Entity? RewardTarget = null)IActor 双端
命名空间 GameCore.Interface
csharp
public interface IActor属性
ShouldRemoveWithParent 仅客户端
csharp
public bool ShouldRemoveWithParent { get; }IsValid 双端
csharp
public bool IsValid { get; }Scope 双端
csharp
public IActorScope? Scope { get; }Facing 双端
csharp
public Angle Facing { get; }Position 双端
csharp
public ScenePoint Position { get; }Player 双端
csharp
public Player Player { get; }Parent 双端
csharp
public IActor? Parent { get; set; }方法
GetByViewActorId 仅客户端
csharp
static IActor? GetByViewActorId(int id)Kill 双端
csharp
void Kill()Destroy 双端
csharp
void Destroy(bool forceNoFade = false)Attach 仅客户端
csharp
bool Attach(IActor child, UTF8String? socket = null)AttachTo 仅客户端
csharp
bool AttachTo(IActor? parent, UTF8String? socket = null)Detach 仅客户端
csharp
bool Detach(bool resetBearings = false)OnAddedToScope 仅客户端
csharp
void OnAddedToScope(IActorScope actorScope)IsVisibleTo 仅服务端
csharp
bool IsVisibleTo(Player player)IActorSync 双端
命名空间 GameCore.Interface
csharp
public interface IActorSync : IActor属性
Host 双端
csharp
public IActorSync? Host { get; set; }Synced actor's host. Have no socket.
ViewActor 双端
csharp
public IViewActor? ViewActor { get; }IDebugDraw 双端
命名空间 GameCore.Interface
csharp
public interface IDebugDrawDefines an interface for drawing debug shapes and text in the game scene. Implementations provide methods to visualize geometric primitives such as lines, circles, points, sectors, parallelograms, rectangles, and text for debugging purposes.
方法
Clear 仅客户端
csharp
void Clear()Clears all debug drawings from the current debug graph.
Destroy 仅客户端
csharp
void Destroy(bool isHostDispose = false)Destroys the debug drawing context and releases associated resources.
isHostDispose— Indicates whether the destruction is triggered by the host's disposal process. this will skip some cleanup steps if true, as the host will handle them.
DrawCircle 仅客户端
csharp
void DrawCircle(Vector3 center, Vector3 eulerRotation, float radius, Color color, bool fill)Draws a circle in 3D space.
center— The center of the circle.eulerRotation— The rotation of the circle in Euler angles (degrees).radius— The radius of the circle.color— The color of the circle.fill— Whether to fill the circle (true) or draw only the outline (false).
DrawLine 仅客户端
csharp
void DrawLine(Vector3 origin, Vector3 end, Color color)Draws a line between two points in 3D space.
origin— The starting point of the line.end— The ending point of the line.color— The color of the line.
DrawParallelogram 仅客户端
csharp
void DrawParallelogram(Vector3 origin, Vector3 sideVectorA, Vector3 sideVectorB, Color color, bool fill)Draws a parallelogram in 3D space, defined by an origin and two side vectors.
origin— The origin (one corner) of the parallelogram.sideVectorA— The first side vector from the origin.sideVectorB— The second side vector from the origin.color— The color of the parallelogram.fill— Whether to fill the parallelogram (true) or draw only the outline (false).
DrawPoint 仅客户端
csharp
void DrawPoint(Vector3 point, Color color)Draws a point in 3D space.
point— The position of the point.color— The color of the point.
DrawRectangle 仅客户端
csharp
void DrawRectangle(Vector3 center, float width, float height, Vector3 rotation, Color color, bool fill)Draws a rectangle in 3D space, defined by its center, width, height, and rotation (XYZ order).
center— The center of the rectangle.width— The width of the rectangle.height— The height of the rectangle.rotation— The rotation of the rectangle in Euler angles (degrees, XYZ order).color— The color of the rectangle.fill— Whether to fill the rectangle (true) or draw only the outline (false).
DrawSector 仅客户端
csharp
void DrawSector(Vector3 center, Vector3 eulerRotation, float radius, float angle, Color color, bool fill)Draws a sector (pie slice) in 3D space.
center— The center of the sector.eulerRotation— The rotation of the sector in Euler angles (degrees).radius— The radius of the sector.angle— The angle of the sector in degrees.color— The color of the sector.fill— Whether to fill the sector (true) or draw only the outline (false).
DrawText 仅客户端
csharp
void DrawText(Vector3 position, string text, Color color, bool onTopOfEverything)Draws text at a specified position in 3D space.
position— The position where the text will be drawn.text— The text to display.color— The color of the text.onTopOfEverything— Whether to render the text on top of all other elements.
IExecutableData 双端
命名空间 GameCore.Interface
csharp
public interface IExecutableData : IGameDataRepresents game data that can be executed within a specific context, such as abilities, spells, or items.
备注
This interface extends IGameData to provide execution capabilities with validation. Implementers define specific logic for how the data should be executed and what validation rules apply.
属性
Validators 双端
csharp
public Validator? Validators { get; }Gets the validator function used for additional validation checks, if any.
方法
Execute 双端
csharp
void Execute(IExecutableObject context)Executes the data's logic within the specified context.
context— The execution context containing information about the caster, targets, and environment.
Validate 双端
csharp
CmdResult Validate(IExecutableObject context)Validates whether the data can be executed in the given context.
context— The execution context to validate against.
返回: A CmdResult indicating whether execution is valid.
IExecutableObject 双端
命名空间 GameCore.Interface
csharp
public interface IExecutableObject : IExecutionContext, IGameObjectRepresents an object that can execute game logic within a specific context, providing access to execution parameters and validation.
备注
This interface combines IExecutionContext and IGameObject to create objects that can both hold execution state and be executed. It provides access to casters, targets, abilities, items, and scene information needed for complex game operations.
属性
Parent 双端
csharp
public IExecutableObject? Parent { get; }Gets the parent executable object in the execution hierarchy, if any.
Shared 双端
csharp
public ExecutionParamShared Shared { get; }Gets the shared execution parameters containing common data like caster, targets, and level.
LocVarUnit 双端
csharp
public QuickDictionary<LocVarType, Unit>? LocVarUnit { get; }Gets the local variable dictionary for unit references, if any.
LocVarPoint 双端
csharp
public QuickDictionary<LocVarType, ScenePoint>? LocVarPoint { get; }Gets the local variable dictionary for scene point references, if any.
Missile 双端
csharp
public Entity? Missile { get; }Gets the missile entity associated with this execution, if any.
PersistIndex 双端
csharp
public uint? PersistIndex { get; }Gets the persistence index for this executable object, if any.
LaunchScene 双端
csharp
public Scene LaunchScene { get; }Gets the scene where this execution was launched.
Cache 双端
csharp
new IExecutableData Cache { get; }Gets the executable data cache for this object.
方法
SearchAncestor 双端
csharp
IExecutableObject? SearchAncestor(IGameLink? link)Searches up the execution hierarchy to find an ancestor with the specified link.
link— The game link to search for, or null to return this object.
返回: The ancestor executable object with the matching link, or null if not found.
ExecuteAsync 双端
csharp
ValueTask<CmdResult> ExecuteAsync()Executes this object asynchronously after validating that execution is allowed.
返回: A ValueTask1indicating the success or failure of the execution. For synchronous implementations, usereturn new ValueTask<CmdResult>(result);` to avoid allocations.
备注
Implementers can provide either synchronous or asynchronous implementations. Synchronous implementations using ValueTask1` have zero overhead.
ValidateImplement 双端
csharp
protected internal CmdResult ValidateImplement()ValidateAsync 双端
csharp
ValueTask<CmdResult> ValidateAsync()Validates whether this object can be executed in its current state.
返回: A ValueTask1containing the validation result. For synchronous implementations, usereturn new ValueTask<CmdResult>(result);` to avoid allocations.
备注
Implementers can provide either synchronous or asynchronous implementations. Synchronous implementations using ValueTask1` have zero overhead.
IExecutionContext 双端
命名空间 GameCore.Interface
csharp
public interface IExecutionContext执行上下文接口,在效果树、指令、技能等执行链中传递施法者、目标、技能、物品等上下文信息。 提供创建子效果和执行奖励的默认实现。
属性
IsValid 双端
csharp
public bool IsValid { get; }Caster 双端
csharp
public Entity Caster { get; }Ability 双端
csharp
public Ability? Ability { get; }Item 双端
csharp
public Item? Item { get; }Order 双端
csharp
public Order? Order { get; }Level 双端
csharp
public uint Level { get; }FactoryParent 双端
csharp
public IExecutableObject? FactoryParent { get; }Target 双端
csharp
public ITarget? Target { get; }MainTarget 双端
csharp
public ITarget MainTarget { get; }DefaultTarget 双端
csharp
public ITarget DefaultTarget { get; }Source 双端
csharp
public ITarget? Source { get; }方法
FactoryCreateChild 仅服务端
csharp
Effect? FactoryCreateChild(IGameLink<GameDataEffect> link, ITarget defaultTarget, bool preValidateOnly = false)基于当前执行上下文创建一个子效果节点,但仅做“构造”和上下文挂接,不会自动解析目标,也不会执行。
link— 要创建的效果节点链接。defaultTarget— 传给子效果的默认目标。preValidateOnly— 是否仅用于预验证。
返回: 创建出的效果实例;若链接无效则返回 null。
备注
这个方法适合你需要在执行前进一步改写 effect、注入 LocVar、调整 Source / Shared 等“手动组装效果树”的场景。 注意:Boolean) 返回的效果节点此时还没有经过 ResolveTarget 目标解析。 如果直接对返回值调用 Execute,很容易因为 Target 仍为 null 而验证失败, 特别是根效果或手工创建的独立效果节点。 如果你的需求只是“给一个目标,直接正确执行某个效果”,优先使用 Effect}); 它会在执行前自动调用 ResolveTarget。
ExecuteChild 仅服务端
csharp
CmdResult<Effect> ExecuteChild(IGameLink<GameDataEffect>? link, ITarget? target = null, Action<Effect>? initialAction = null)在当前执行上下文下直接创建并执行一个子效果节点。
link— 要执行的效果节点链接。target— 显式目标;为 null 时回退到当前上下文的Target。initialAction— 在目标解析完成后、正式执行前,对 effect 做最后调整的回调。
返回: 成功时返回执行后的 effect;失败时返回错误码。
备注
这是“我只想把这个效果打到某个目标上并立即执行”的首选入口。 相比 Boolean), 它会自动完成 ResolveTarget,然后再执行 Execute。 因此,当你不想自己处理目标解析、也不需要先拿到 effect 实例做复杂装配时,优先用这个方法。
ExecuteChildImplementation 仅服务端
csharp
protected static CmdResult ExecuteChildImplementation(IExecutionContext context, IGameLink<GameDataEffect>? link, ITarget? target = null)ExecuteReward 仅服务端
csharp
ValueTask<CmdResult> ExecuteReward(IGameLink<GameDataReward>? link, Entity? RewardTarget = null)字段
Random 双端
csharp
static readonly Random RandomIResponseOwnerData 双端
命名空间 GameCore.Interface
csharp
public interface IResponseOwnerData属性
Responses 双端
csharp
public List<IGameLink<GameDataResponse>?>? Responses { get; }