主题
GameCore · 其他
AssemblySetup 双端
命名空间 GameCore
csharp
public static class AssemblySetup属性
Loaded 双端
csharp
public static bool Loaded { get; }Loading 双端
csharp
public static bool Loading { get; }方法
Setup 双端
csharp
public static void Setup()ScopeData 双端
命名空间 GameCore
csharp
public class ScopeData : IGameClass框架级 GameLink 声明注册表。此处仅声明链接引用,不创建 GameData 实例。
备注
所有 GameData 的实际实例化由 GameSparkCore 数据资源库完成: 数据编辑器配置:GameSparkCore/editor/data/gamesparkcore/ScopeData/{类型名}/{名称}.json 生成的初始化代码:GameSparkCore/src/DataGenerated/gamesparkcore/ScopeData/{类型名}/{名称}.cs 例如 AI.Default 的实现位于 GameSparkCore/editor/data/gamesparkcore/ScopeData/GameDataAIThinkTree/Default.json。
构造函数
ScopeData 双端
csharp
public ScopeData()方法
OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()Called during game class registration phase to initialize scope data.
ScopeScript 双端
命名空间 GameCore
csharp
public class ScopeScriptProvides access to recently created game objects for scripting and debugging purposes.
备注
This class maintains references to the most recently created instances of various game object types. It is primarily used in debugging scenarios, script execution contexts, and situations where immediate access to newly created objects is needed without explicit reference passing. The references are updated automatically by the creation systems and should be used promptly as they may be overwritten by subsequent object creation.
构造函数
ScopeScript 双端
csharp
public ScopeScript()属性
LastCreatedUnit 双端
csharp
public static Unit? LastCreatedUnit { get; set; }Gets or sets the most recently created unit in the game.
备注
This property is automatically updated whenever a new unit is created through the game's unit creation systems. It provides convenient access for scripts and debugging tools that need to reference the most recent unit without maintaining explicit references.
LastCreatedActor 双端
csharp
public static Actor? LastCreatedActor { get; set; }Gets or sets the most recently created actor in the game.
备注
This property is automatically updated whenever a new actor is created through the game's actor creation systems. Actors represent visual and interactive elements in the game world, and this reference is useful for immediate manipulation or attachment operations.
LastCreatedItem 双端
csharp
public static Item? LastCreatedItem { get; set; }Gets or sets the most recently created item in the game.
备注
This property is automatically updated whenever a new item is created through the game's item creation systems. Items represent collectible objects, equipment, and other inventory entities in the game world.
EventAdminOperationMessage 仅服务端
命名空间 GameCore.AdminOperationSystem.Event
csharp
public sealed class EventAdminOperationMessage : ITriggerEvent<EventAdminOperationMessage>后台 operation 消息事件。
备注
可通过 Boolean) 监听。 Host 会原生处理关服类 operation;此事件用于游戏逻辑感知公告、展示弹窗或处理自定义后台指令。
构造函数
EventAdminOperationMessage 仅服务端
csharp
public EventAdminOperationMessage(AdminOperationMessage message)后台 operation 消息事件。
备注
可通过 Boolean) 监听。 Host 会原生处理关服类 operation;此事件用于游戏逻辑感知公告、展示弹窗或处理自定义后台指令。
属性
Message 仅服务端
csharp
public AdminOperationMessage Message { get; }后台 operation 消息。
Operation 仅服务端
csharp
public string Operation { get; }operation 名称。
Content 仅服务端
csharp
public string Content { get; }后台传入的文本内容。
GameSessionId 仅服务端
csharp
public long? GameSessionId { get; }后台消息指定的游戏局 ID;未指定时为 null。
RawMessage 仅服务端
csharp
public byte[] RawMessage { get; }原始 msgpack 消息体。
Ads 双端
命名空间 GameCore.AdvertisingSystem
csharp
public static class Ads服务端广告系统 API,用于请求指定玩家观看激励视频广告并等待平台结果。
备注
仅服务端可用。项目代码应在服务端 await 播放结果,并只在 IsCompleted 为 true 时发放奖励。 Android 会等待平台服务端验证;iOS 在平台 SDK 成功发起播放后按完成处理。 调试模式下如果广告请求明确失败,会额外写入 warning 日志。
方法
ShowRewardedVideoAsync 仅服务端
csharp
public static Task<RewardedVideoAdResult> ShowRewardedVideoAsync(Player player, TimeSpan? timeout = null, CancellationToken cancellationToken = default(CancellationToken))请求指定玩家观看激励视频广告,使用默认超时时间等待平台结果。
player— 要展示广告的在线玩家。timeout— 等待平台结果的最长时间;为空时默认等待两分钟。cancellationToken— 取消等待广告结果的令牌。
返回: 广告请求结果。只有 IsCompleted 表示可发放奖励。
ShowRewardedVideoAsync 仅服务端
csharp
public static Task<RewardedVideoAdResult> ShowRewardedVideoAsync(Player player, TimeSpan timeout, CancellationToken cancellationToken = default(CancellationToken))请求指定玩家观看激励视频广告,并使用指定超时时间等待平台结果。
player— 要展示广告的在线玩家。timeout— 等待平台结果的最长时间。cancellationToken— 取消等待广告结果的令牌。
返回: 广告请求结果。只有 IsCompleted 表示可发放奖励。
RewardedVideoAdResult 双端
命名空间 GameCore.AdvertisingSystem
csharp
public sealed class RewardedVideoAdResult : IEquatable<RewardedVideoAdResult>激励视频广告请求结果。
Status— 广告请求状态。RequestId— 本次广告请求的内部标识。请求未成功创建时可能为空。Message— 补充说明,通常用于记录失败、超时或完成来源。
构造函数
RewardedVideoAdResult 双端
csharp
public RewardedVideoAdResult(RewardedVideoAdStatus Status, string RequestId, string? Message = null)激励视频广告请求结果。
Status— 广告请求状态。RequestId— 本次广告请求的内部标识。请求未成功创建时可能为空。Message— 补充说明,通常用于记录失败、超时或完成来源。
属性
Status 双端
csharp
public RewardedVideoAdStatus Status { get; init; }广告请求状态。
RequestId 双端
csharp
public string RequestId { get; init; }本次广告请求的内部标识。请求未成功创建时可能为空。
Message 双端
csharp
public string? Message { get; init; }补充说明,通常用于记录失败、超时或完成来源。
IsCompleted 双端
csharp
public bool IsCompleted { get; }是否已经达到项目可发放奖励的条件。
方法
ToString 双端
csharp
public override string ToString()operator != 双端
csharp
public static bool operator !=(RewardedVideoAdResult? left, RewardedVideoAdResult? right)operator == 双端
csharp
public static bool operator ==(RewardedVideoAdResult? left, RewardedVideoAdResult? right)GetHashCode 双端
csharp
public override int GetHashCode()Equals 双端
csharp
public override bool Equals(object? obj)Equals 双端
csharp
public bool Equals(RewardedVideoAdResult? other)Deconstruct 双端
csharp
public void Deconstruct(out RewardedVideoAdStatus Status, out string RequestId, out string? Message)RewardedVideoAdStatus 双端
命名空间 GameCore.AdvertisingSystem
csharp
public enum RewardedVideoAdStatus激励视频广告请求状态。
枚举值
Completed— 广告请求已完成,项目可以按自己的业务规则发放奖励。RequestFailed— 广告请求未能成功发起,或客户端明确返回播放失败。Timeout— 广告请求已发出,但在指定时间内没有等到平台结果。Canceled— 调用方传入的取消令牌取消了本次等待。
CollisionType 双端
命名空间 GameCore.CollisionSystem.Data.Enum
csharp
public enum CollisionType枚举值
DynamicStatic
Footprint 双端
命名空间 GameCore.CollisionSystem.Data.Struct
csharp
public class Footprint构造函数
Footprint 双端
csharp
public Footprint()Footprint 双端
csharp
public Footprint(short width, short height, CollisionType collisionType = CollisionType.Dynamic)属性
CollisionType 双端
csharp
public CollisionType CollisionType { get; set; }Anchor 双端
csharp
public Vector2 Anchor { get; set; }单位原点在足印包围矩形中的归一化锚点。 (0, 0) 表示最小角,(0.5, 0.5) 表示几何中心,(1, 1) 表示最大角。 默认值为 (0, 0)。
Width 双端
csharp
public short Width { get; set; }Height 双端
csharp
public short Height { get; set; }Blocks 双端
csharp
public List<Block> Blocks { get; set; }索引器
this[] 双端
csharp
ICostSpender 双端
命名空间 GameCore.CostSystem
csharp
public interface ICostSpender : ICooldownOwner, IPropertyOwner, ISyncIdOwnerEverything that implements this interface should call InitializeCooldown in its constructor, and ClearUpCooldowns in its dispose method.
属性
Cooldown 双端
csharp
public CooldownActive? Cooldown { get; set; }Charge 双端
csharp
public CooldownCharge? Charge { get; set; }IsValidCooldownLocation 双端
csharp
public bool IsValidCooldownLocation { get; }MonitorCooldownEvents 双端
csharp
public bool MonitorCooldownEvents { get; }Item 双端
csharp
public Item? Item { get; }方法
GetCooldown 双端
csharp
Cooldown? GetCooldown(CooldownType type)GetCooldownOwner 双端
csharp
ICooldownOwner GetCooldownOwner(CooldownLocation location, IExecutionContext? context = null)CheckCooldownAndCharge 双端
csharp
CmdResult CheckCooldownAndCharge()InitializeCooldown 仅服务端
csharp
void InitializeCooldown(Cost? cost)ClearUpCooldowns 仅服务端
csharp
void ClearUpCooldowns()OnChargeAffordableInternal 仅服务端
csharp
void OnChargeAffordableInternal()OnCooldownAffordableInternal 仅服务端
csharp
void OnCooldownAffordableInternal()ISpendable 双端
命名空间 GameCore.CostSystem
csharp
public interface ISpendable方法
CheckAffordable 双端
csharp
CmdResult CheckAffordable()Spend 仅服务端
csharp
bool Spend(IExecutionContext context, bool checkAffordable = true)Damage 双端
命名空间 GameCore.DamageSystem
csharp
public class Damage伤害实例,承载一次伤害的当前值、原始值、暴击标记、致命标记和伤害类型。 在伤害流程中可被修改(如减伤、护盾吸收)。
构造函数
Damage 仅客户端
csharp
public Damage(double origin, IGameLink<GameDataEffectDamage> effect, IGameLink<GameDataDamageType> type)Damage 仅服务端
csharp
public Damage(double origin, EffectDamage effect, IGameLink<GameDataDamageType> type)属性
Current 双端
csharp
public double Current { get; set; }Origin 双端
csharp
public double Origin { get; }IsFatal 双端
csharp
public bool IsFatal { get; set; }IsCritical 双端
csharp
public bool IsCritical { get; set; }Type 双端
csharp
public IGameLink<GameDataDamageType> Type { get; set; }DeathType 双端
csharp
public DeathType DeathType { get; set; }致死类型,当伤害导致目标死亡时使用
EffectLink 双端
csharp
public IGameLink<GameDataEffectDamage> EffectLink { get; init; }Caster 双端
csharp
public Entity? Caster { get; init; }CasterPlayer 双端
csharp
public Player CasterPlayer { get; init; }Target 双端
csharp
public Entity? Target { get; init; }TargetScenePoint 仅客户端
csharp
public ScenePoint TargetScenePoint { get; init; }Effect 仅服务端
csharp
public EffectDamage Effect { get; }方法
ToString 双端
csharp
public override string? ToString()GameDataDamageType 双端
命名空间 GameCore.DamageSystem.Data
csharp
public class GameDataDamageType : GameDataCategory<GameDataDamageType>, IGameDataCategory<GameDataDamageType>, IGameData<GameDataDamageType>, IGameData伤害类型配置,定义浮动文字、暴击样式及通知规则。
构造函数
GameDataDamageType 双端
csharp
public GameDataDamageType(GameLink<GameDataDamageType, GameDataDamageType> link)GameDataDamageType 双端
csharp
public GameDataDamageType(IGameLink<GameDataDamageType> link)属性
FloatingTextDealt 双端
csharp
public IGameLink<GameDataFloatingText>? FloatingTextDealt { get; set; }玩家造成此类型伤害时显示的浮动文字。未设置时可监听事件自行显示。
FloatingTextDealtCritical 双端
csharp
public IGameLink<GameDataFloatingText>? FloatingTextDealtCritical { get; set; }玩家造成此类型暴击时显示的浮动文字。未设置则使用默认暴击样式。
FloatingTextReceived 双端
csharp
public IGameLink<GameDataFloatingText>? FloatingTextReceived { get; set; }玩家受到此类型伤害时显示的浮动文字。未设置时可监听事件自行显示。
FloatingTextReceivedCritical 双端
csharp
public IGameLink<GameDataFloatingText>? FloatingTextReceivedCritical { get; set; }玩家受到此类型暴击时显示的浮动文字。未设置则使用默认暴击样式。
CustomFormular 仅服务端
csharp
public Func<Damage, double>? CustomFormular { get; set; }自定义伤害计算公式,返回最终伤害数值。未设置则使用默认公式。
CustomFormularIsCritical 仅服务端
csharp
public Func<Damage, bool>? CustomFormularIsCritical { get; set; }自定义暴击判定逻辑,返回是否视为暴击。
NotificationPredicate 仅服务端
csharp
public Func<Player, Damage, bool>? NotificationPredicate { get; set; }判断是否向指定玩家客户端发送伤害通知的谓词。为 null 则不发送任何通知。
备注
可基于队伍、距离、视野、伤害阈值等逻辑控制通知范围。AI 玩家无客户端,即使返回 true 也不会收到。
ProtoDamageNotification 双端
命名空间 GameCore.DamageSystem.Protocol
csharp
public struct ProtoDamageNotification : IProtocolServerTransient<ProtoDamageNotification>, IBytesReplicableUnmanaged<ProtoDamageNotification>, IBytesReplicable<ProtoDamageNotification>, IProtocolServerTransient, IGameClass属性
ProtoCaster 双端
csharp
public ProtoEntity ProtoCaster { get; set; }ProtoCasterPlayer 双端
csharp
public ProtoPlayer ProtoCasterPlayer { get; set; }ProtoTarget 双端
csharp
public ProtoEntity ProtoTarget { get; set; }ProtoTargetScenePoint 双端
csharp
public ProtoScenePoint ProtoTargetScenePoint { get; set; }ProtoEffectDamage 双端
csharp
public ProtoIGameLink<GameDataEffectDamage> ProtoEffectDamage { get; set; }ProtoDamageType 双端
csharp
public ProtoIGameLink<GameDataDamageType> ProtoDamageType { get; set; }Damage 双端
csharp
public double Damage { get; set; }Origin 双端
csharp
public double Origin { get; set; }IsCritical 双端
csharp
public bool IsCritical { get; set; }IsFatal 双端
csharp
public bool IsFatal { get; set; }方法
Handle 仅客户端
csharp
public readonly void Handle()GameDiagnostics 双端
命名空间 GameCore.Diagnostics
csharp
public static class GameDiagnostics方法
CaptureManaged 双端
csharp
public static ManagedGameDiagnostics CaptureManaged()按需采样,不触发 GC。服务端调用得到服务端数据,跨端展示由项目显式同步。
ManagedGameDiagnostics 双端
命名空间 GameCore.Diagnostics
csharp
public sealed class ManagedGameDiagnostics : IEquatable<ManagedGameDiagnostics>本局当前端的托管对象与 GC 快照。客户端只统计已同步到本地的对象。
构造函数
ManagedGameDiagnostics 双端
csharp
public ManagedGameDiagnostics(int Entities, int Units, int Buffs, long? ManagedHeapBytes, int? Gen0Collections, int? Gen1Collections, int? Gen2Collections)本局当前端的托管对象与 GC 快照。客户端只统计已同步到本地的对象。
属性
Entities 双端
csharp
public int Entities { get; init; }Units 双端
csharp
public int Units { get; init; }Buffs 双端
csharp
public int Buffs { get; init; }ManagedHeapBytes 双端
csharp
public long? ManagedHeapBytes { get; init; }Gen0Collections 双端
csharp
public int? Gen0Collections { get; init; }Gen1Collections 双端
csharp
public int? Gen1Collections { get; init; }Gen2Collections 双端
csharp
public int? Gen2Collections { get; init; }方法
ToString 双端
csharp
public override string ToString()operator != 双端
csharp
public static bool operator !=(ManagedGameDiagnostics? left, ManagedGameDiagnostics? right)operator == 双端
csharp
public static bool operator ==(ManagedGameDiagnostics? left, ManagedGameDiagnostics? right)GetHashCode 双端
csharp
public override int GetHashCode()Equals 双端
csharp
public override bool Equals(object? obj)Equals 双端
csharp
public bool Equals(ManagedGameDiagnostics? other)Deconstruct 双端
csharp
public void Deconstruct(out int Entities, out int Units, out int Buffs, out long? ManagedHeapBytes, out int? Gen0Collections, out int? Gen1Collections, out int? Gen2Collections)IDisplayInfo 双端
命名空间 GameCore.DisplayInfo
csharp
public interface IDisplayInfo属性
Cache 双端
csharp
public IDisplayInfoData Cache { get; }DisplayName 双端
csharp
public string DisplayName { get; }Gets the display name of the object.
Description 双端
csharp
public string? Description { get; }Gets the description of the object.
Icon 双端
csharp
public Icon? Icon { get; }Gets the icon associated with the object.
Stack 双端
csharp
public int? Stack { get; }Gets the current stack value for display purposes, or null if no stack is defined.
Level 双端
csharp
public int? Level { get; }Gets the current level value for display purposes, or null if the level is not set.
Quality 双端
csharp
public int? Quality { get; }Cooldown 双端
csharp
public double? Cooldown { get; }Gets the cooldown duration, in seconds, for display purposes, or null if no cooldown is defined.
CoolDownMax 双端
csharp
public double? CoolDownMax { get; }Gets the maximum cooldown duration, in seconds, for display purposes, or null if no maximum cooldown is defined.
ChargeCooldown 双端
csharp
public double? ChargeCooldown { get; }Gets the charge cooldown duration, in seconds, for display purposes, or null if no IDisplayInfo cooldown is defined.
ChargeCooldownMax 双端
csharp
public double? ChargeCooldownMax { get; }Gets the maximum charge cooldown duration, in seconds, for display purposes, or null if no maximum cooldown is defined.
GameDataRuleDisplayInfo 双端
命名空间 GameCore.DisplayInfo.Data
csharp
public class GameDataRuleDisplayInfo : GameDataRule, IGameData<GameDataRuleDisplayInfo>, IGameData规则类对象的显示信息配置,用于自定义名称、描述、图标的获取逻辑。
构造函数
GameDataRuleDisplayInfo 双端
csharp
public GameDataRuleDisplayInfo(GameLink<GameDataRule, GameDataRuleDisplayInfo> link)GameDataRuleDisplayInfo 双端
csharp
public GameDataRuleDisplayInfo(IGameLink<GameDataRuleDisplayInfo> link)属性
DisplayNameGetter 双端
csharp
public Func<IDisplayInfo, string?> DisplayNameGetter { get; set; }根据显示对象返回显示名称,默认使用缓存中的 DisplayName。
DescriptionGetter 双端
csharp
public Func<IDisplayInfo, string?> DescriptionGetter { get; set; }根据显示对象返回描述文本,默认使用缓存中的 Description。
IconGetter 双端
csharp
public Func<IDisplayInfo, Icon?> IconGetter { get; set; }根据显示对象返回图标,默认使用缓存中的 Icon;能力开关关闭时可返回 IconOff。
Link 双端
csharp
public new IGameLink<GameDataRuleDisplayInfo> Link { get; }IDisplayInfoData 双端
命名空间 GameCore.DisplayInfo.Data
csharp
public interface IDisplayInfoData : IGameData属性
DisplayName 双端
csharp
public LocalizedString? DisplayName { get; }Gets the display name of the object.
Description 双端
csharp
public LocalizedString? Description { get; }Gets the description of the object.
Icon 双端
csharp
public Icon? Icon { get; }Gets the icon associated with the object.
HdrColor 双端
命名空间 GameCore.Drawing
csharp
public struct HdrColor : IArithmeticAnimatable<HdrColor>, IEquatable<HdrColor>Represents a high-dynamic-range (HDR) color with 16-bit (short) channels for red, green, and blue, and an alpha channel. Supports construction from standard Color and scaling for HDR scenarios.
构造函数
HdrColor 双端
csharp
public HdrColor(Color color)Initializes a new HdrColor from a standard Color.
color— The source color.
HdrColor 双端
csharp
public HdrColor(Color color, float hdrScale)Initializes a new HdrColor from a standard Color and applies an HDR scale to the RGB channels.
color— The source color.hdrScale— The scale factor to apply to the RGB channels.
HdrColor 双端
csharp
public HdrColor(short r, short g, short b, short a = 255)Initializes a new HdrColor from explicit channel values.
r— The red channel value.g— The green channel value.b— The blue channel value.a— The alpha channel value. Defaults to 255 (fully opaque).
属性
PrefersRealtimeAnimation 双端
csharp
public static bool PrefersRealtimeAnimation { get; }方法
implicit operator 双端
csharp
public static HdrColor implicit operator(Color color)Implicitly converts a Color to an HdrColor.
color— The color to convert.
implicit operator 双端
csharp
public static HdrColor implicit operator((short R, short G, short B, short A) tuple)implicit operator 双端
csharp
public static (short R, short G, short B, short A) implicit operator(HdrColor color)ToString 双端
csharp
public override readonly string? ToString()Equals 双端
csharp
public override readonly bool Equals(object? obj)Equals 双端
csharp
public readonly bool Equals(HdrColor other)operator == 双端
csharp
public static bool operator ==(HdrColor left, HdrColor right)operator != 双端
csharp
public static bool operator !=(HdrColor left, HdrColor right)GetHashCode 双端
csharp
public override readonly int GetHashCode()字段
R 双端
csharp
public short RThe red channel value. Can exceed the standard 0-255 range for HDR purposes.
G 双端
csharp
public short GThe green channel value. Can exceed the standard 0-255 range for HDR purposes.
B 双端
csharp
public short BThe blue channel value. Can exceed the standard 0-255 range for HDR purposes.
A 双端
csharp
public short AThe alpha (opacity) channel value. Typically in the range 0-255.
FloatingText 仅客户端
命名空间 GameCore.FloatingTextSystem
csharp
public class FloatingText : DisposableObjectRuntime handle for a floating text instance.
构造函数
FloatingText 仅客户端
csharp
protected internal FloatingText(IViewFloatingText viewFloatingText)属性
IsValid 仅客户端
csharp
public override bool IsValid { get; }WidgetCount 仅客户端
csharp
public int WidgetCount { get; }方法
DisposeManaged 仅客户端
csharp
protected override void DisposeManaged()AttachToEntity 仅客户端
csharp
public void AttachToEntity(Entity unit)Set the position of the floating text to the entity's position.
unit— The entity to attach the floating text to.
SetWorldPosition 仅客户端
csharp
public void SetWorldPosition(Vector3 position3D)Set the position of the floating text in world space.
position3D— The position of the floating text in world space. It useVector3instead ofScenePointbecause the floating text does not depend on the scene.
SetScreenPosition 仅客户端
csharp
public void SetScreenPosition(Vector2 position2D)HasWidget 仅客户端
csharp
public bool HasWidget(IGameLink<GameDataWidget>? link)Returns whether this instance contains a widget created from the specified widget data link.
GetWidget 仅客户端
csharp
public Widget? GetWidget(IGameLink<GameDataWidget>? link)Gets a widget by data link. Returns null after this floating text is destroyed.
GetWidgetText 仅客户端
csharp
public WidgetText? GetWidgetText(IGameLink<GameDataWidgetText>? link)Gets a text widget by data link.
GetWidgetImage 仅客户端
csharp
public WidgetImage? GetWidgetImage(IGameLink<GameDataWidgetImage>? link)Gets an image widget by data link.
GetWidgetBar 仅客户端
csharp
public WidgetBar? GetWidgetBar(IGameLink<GameDataWidgetBar>? link)Gets a bar widget by data link.
GetWidgetByIndex 仅客户端
csharp
public Widget? GetWidgetByIndex(int index)Gets a widget by its current instance order. Prefer link-based lookup for long-lived game logic.
GameDataFloatingText 双端
命名空间 GameCore.FloatingTextSystem.Data
csharp
public class GameDataFloatingText : GameDataCategory<GameDataFloatingText>, IGameDataCategory<GameDataFloatingText>, IGameData<GameDataFloatingText>, IGameDataFloatingText template data used when creating transient combat feedback text.
构造函数
GameDataFloatingText 双端
csharp
public GameDataFloatingText(GameLink<GameDataFloatingText, GameDataFloatingText> link)GameDataFloatingText 双端
csharp
public GameDataFloatingText(IGameLink<GameDataFloatingText> link)属性
Widgets 双端
csharp
public List<IGameLink<GameDataWidget>?> Widgets { get; set; }Root widgets in this floating text template.
Anchor 双端
csharp
public Vector2? Anchor { get; set; }RandomRange 双端
csharp
public Vector2? RandomRange { get; set; }Animations 双端
csharp
public List<WidgetAnimationSequence> Animations { get; set; }OverlayWindow 双端
csharp
public TimeSpan? OverlayWindow { get; set; }AllowOverlay 双端
csharp
public bool AllowOverlay { get; set; }方法
CreateFloatingText 仅客户端
csharp
public FloatingText? CreateFloatingText(Vector3 worldPosition, UTF8String text)Creates a floating text instance at a world-space position.
CreateFloatingText 仅客户端
csharp
public FloatingText? CreateFloatingText(Vector2 screenPosition, UTF8String text)Creates a floating text instance at a screen-space position.
CreateFloatingText 仅客户端
csharp
public FloatingText? CreateFloatingText(Entity entity, UTF8String text)Creates a floating text instance attached to an entity.
LobbyService 仅客户端
命名空间 GameCore.LobbySystem
csharp
public static class LobbyService提供客户端大厅相关的高层 API。
备注
当前版本公开当前游戏局退出及“允许中途加入的游戏局”相关能力: 请求主动退出当前游戏并返回大厅。 获取当前本地游戏局对应的开放局引用。 提交“退出当前游戏并加入目标开放局”的切换请求。
方法
QuitCurrentGame 仅客户端
csharp
public static bool QuitCurrentGame()请求主动退出当前游戏并返回大厅。
返回: 客户端成功排队退出请求时返回 true。
备注
该方法是 fire-and-forget 语义:客户端向 Host 发送主动退出请求,禁止当前局重连, 清理当前游戏局并切回大厅。
LeaveAndJoinOpenGame 仅客户端
csharp
public static bool LeaveAndJoinOpenGame(OpenGameRef openGame)提交“退出当前游戏并加入目标开放局”的切换请求。
openGame— 目标开放局引用。
返回: 请求在宿主侧成功排队时返回 true;如果参数非法或宿主未接受该请求,则返回 false。
备注
该方法是 fire-and-forget 语义。 当前调用环境如果位于游戏局内,宿主可能会在退局过程中直接销毁当前 WASM 运行时, 因此不提供可等待的完成结果。
TryGetCurrentOpenGameRef 仅客户端
csharp
public static bool TryGetCurrentOpenGameRef(out OpenGameRef? openGame)尝试获取当前本地游戏局对应的开放局引用。
openGame— 成功时返回当前游戏局的OpenGameRef;失败时为null。
返回: 当前游戏局允许中途加入并且本地可解析出开放局引用时返回 true;否则返回 false。
备注
该方法读取的是客户端本地当前游戏状态,不会向服务器发起额外请求。 常见失败场景包括:当前没有活跃游戏局、当前局不是开放局、当前局是 quick start 局, 或当前局没有可用的 join key。
LocalizationManager 双端
命名空间 GameCore.Localization
csharp
public class LocalizationManager构造函数
LocalizationManager 双端
csharp
public LocalizationManager()属性
Primary 双端
csharp
public static LocalizationManager Primary { get; }PrimaryResourceManager 双端
csharp
public ResourceManager? PrimaryResourceManager { get; set; }方法
AddResourceManager 双端
csharp
public void AddResourceManager(ResourceManager resourceManager)GetString 双端
csharp
public string? GetString(string name, CultureInfo? culture = null)GetStringOrDefault 双端
csharp
public string GetStringOrDefault(string name, string defaultValue, CultureInfo? culture = null)LocalizedString 双端
命名空间 GameCore.Localization
csharp
public class LocalizedStringRepresents a localized string that automatically resolves its value from the localization system using a key.
key— The localization key used to lookup the string value.
备注
This class provides lazy loading of localized strings and automatic fallback to the key if the resource is not found. It supports implicit conversion from and to string for convenience.
构造函数
LocalizedString 双端
csharp
public LocalizedString(string key)Represents a localized string that automatically resolves its value from the localization system using a key.
key— The localization key used to lookup the string value.
备注
This class provides lazy loading of localized strings and automatic fallback to the key if the resource is not found. It supports implicit conversion from and to string for convenience.
属性
Key 双端
csharp
public string Key { get; set; }Gets or sets the localization key used to lookup the string value.
Value 双端
csharp
public string? Value { get; }Gets the localized string value for the current key, or null if the resource is not found.
备注
The value is lazily loaded from the LocalizationManager when first accessed. If the resource cannot be found, ResourceNotFound will be set to true.
ResourceNotFound 双端
csharp
public bool ResourceNotFound { get; set; }Gets a value indicating whether the localization resource for this key was not found.
方法
ToString 双端
csharp
public override string ToString()Returns the localized string value, or the key if the value is not available.
返回: The localized value or the fallback key.
implicit operator 双端
csharp
public static string? implicit operator(LocalizedString? localizedString)Implicitly converts a LocalizedString to a String.
localizedString— The localized string to convert.
返回: The string representation of the localized string.
implicit operator 双端
csharp
public static LocalizedString implicit operator(string key)Implicitly converts a String key to a LocalizedString.
key— The localization key.
返回: A new LocalizedString instance with the specified key.
OperationMailApi 仅服务端
命名空间 GameCore.OperationMail
csharp
public static class OperationMailApiProvides server-side queries for operation mails configured by the operation backend.
备注
Operation mails are backend or system delivered messages, such as global operation mails and mails targeted to a specific player. This API does not send mail, does not implement player-to-player mail, and does not store read or claim state. Persist per-player inbox state with CloudData when needed.
属性
IsReady 仅服务端
csharp
public static bool IsReady { get; }Gets whether the operation mail service has been marked as ready.
方法
WaitUntilReadyAsync 仅服务端
csharp
public static Task WaitUntilReadyAsync()Waits until the operation mail service is ready.
返回: A task that completes after the host-side operation mail provider is ready.
QueryGlobalOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryGlobalOperationMailsAsync(string mapName, string env, DateTime now)Queries currently active global operation mails for a map and backend environment.
mapName— The published map name to query.env— The backend environment name.now— Current time for the mail validity window. UTC and Local values are converted to Beijing time; Unspecified values are treated as Beijing wall time.
返回: The query result and the matching global operation mail records.
备注
The host performs a fixed backend query against email.admin_email using , , state = 0, target_type = 0, and the supplied time window.
QueryGlobalOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryGlobalOperationMailsAsync(string mapName, GameRuntimeEnvironment env, DateTime now)Queries currently active global operation mails for a runtime environment.
mapName— The published map name to query.env— The runtime environment (debug, test, or formal).now— Current time for the mail validity window. UTC and Local values are converted to Beijing time; Unspecified values are treated as Beijing wall time.
返回: The query result and the matching global operation mail records.
QueryUserOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryUserOperationMailsAsync(long userId, string mapName, string env, DateTime now)Queries currently active operation mails addressed to a specific user.
userId— The platform user id.mapName— The published map name to query.env— The backend environment name.now— Current time for the mail validity window. UTC and Local values are converted to Beijing time; Unspecified values are treated as Beijing wall time.
返回: The query result and the matching user operation mail records.
备注
The host performs a fixed backend query against email.user_email using , , , state = 0, and the supplied time window.
QueryUserOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryUserOperationMailsAsync(long userId, string mapName, GameRuntimeEnvironment env, DateTime now)Queries currently active user operation mails for a runtime environment.
userId— The platform user id.mapName— The published map name to query.env— The runtime environment (debug, test, or formal).now— Current time for the mail validity window. UTC and Local values are converted to Beijing time; Unspecified values are treated as Beijing wall time.
返回: The query result and the matching user operation mail records.
OperationMailOperations 仅服务端
命名空间 GameCore.OperationMail
csharp
public static class OperationMailOperationsImplements server-side operation mail query operations.
备注
Prefer OperationMailApi for game code. This type contains the lower-level validation and host-provider calls used by the public API.
方法
QueryGlobalOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryGlobalOperationMailsAsync(string mapName, string env, DateTime now)Queries currently active global operation mails for a map and backend environment.
mapName— The published map name to query.env— The backend environment name.now— The current time used for the mail validity window.
返回: The query result and matching global operation mail records.
QueryUserOperationMailsAsync 仅服务端
csharp
public static Task<OperationMailQueryResult> QueryUserOperationMailsAsync(long userId, string mapName, string env, DateTime now)Queries currently active operation mails addressed to a specific user.
userId— The platform user id.mapName— The published map name to query.env— The backend environment name.now— The current time used for the mail validity window.
返回: The query result and matching user operation mail records.
Resources 双端
命名空间 GameCore.Properties
csharp
public class ResourcesA strongly-typed resource class, for looking up localized strings, etc.
属性
ResourceManager 双端
csharp
public static ResourceManager ResourceManager { get; }Returns the cached ResourceManager instance used by this class.
Culture 双端
csharp
public static CultureInfo Culture { get; set; }Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class.
PropertyObject 双端
命名空间 GameCore.PropertyObjectSystem
csharp
public class PropertyObject : IDisposable, ISyncIdOwner, IEventSender, ICooldownHost, ICooldownOwner, IPropertyOwner, IPropertyHost, IPropertyOwner<PropertyPropertyObject>属性数据对象,用于在服务器和客户端之间同步自定义属性。
备注
PropertyObject 是一个无场景位置和表现的纯逻辑数据容器,底层使用 CoreActor 机制实现属性同步。 与 Entity 不同,PropertyObject 不需要场景、位置和数编 Link,可以随时动态创建和销毁。 🎮 2D 联机游戏的理想选择: PropertyObject 特别适合 2D 联机游戏开发,因为这类游戏通常不需要真实的 3D 场景空间、物理碰撞和寻路系统, 但需要在服务端和客户端之间同步游戏状态。相比使用 Entity,PropertyObject 提供了更轻量、更直观的解决方案。 适用的 2D 联机游戏类型: 多人卡牌对战 - 卡牌作为逻辑对象,使用 OrderIndex 表示手牌位置,GroupId 表示区域(手牌/战场/墓地) 在线回合制策略 - 棋盘格子上的单位,使用属性存储格子坐标和状态 多人放置/挂机游戏 - 纯数值驱动的角色,无需场景表现 多人塔防 - 塔和敌人使用路径索引和进度值,而非3D坐标 在线养成游戏 - 纯逻辑的游戏对象需要在服务端验证 主要用途: 2D 联机游戏的主要游戏对象(卡牌、棋子、角色等) 玩家级别的数据同步(背包、仓库、任务进度等) 跨场景的全局数据(事件状态、排行榜等) 多人会话数据(交易、组队请求等) 不需要场景表现的逻辑对象 注意:单机游戏不需要 PropertyObject,因为单机游戏无需同步机制,可以直接在客户端管理数据。 示例用法: 示例1 - 2D 多人卡牌游戏: #if SERVER // 创建卡牌对象 var card = new PropertyObject(player, SyncType.All); card.SetPropertyGeneric<PropertyCard, int>(PropertyCard.CardId, 101); card.SetPropertyGeneric<PropertyCard, int>(PropertyCard.Attack, 5); card.OrderIndex = 3; // 手牌第3个位置 card.GroupId = 1; // 组1 = 手牌区 // 可以使用框架的 Buff 和技能系统 buffData.CreateBuff(card, context); abilityData.CreateAbility(card); // 打出卡牌时移动到战场 card.GroupId = 2; // 组2 = 战场区 card.OrderIndex = battlefieldSlot; #endif #if CLIENT // 客户端自动复制,根据属性更新UI var cardId = card.GetPropertyGeneric<PropertyCard, int>(PropertyCard.CardId); var zone = card.GroupId; var slot = card.OrderIndex; UpdateCardUI(card, zone, slot); // 客户端自行处理UI表现 #endif 示例2 - 玩家数据同步: #if SERVER // 使用默认属性枚举 PropertyPropertyObject(可通过代码生成扩展) var sessionData = new PropertyObject(player, SyncType.Self); sessionData.SetProperty(PropertyPropertyObject.SessionId, 12345); // 或使用自定义属性枚举(推荐,类型更安全) var bagData = new PropertyObject(player, SyncType.Self); bagData.SetPropertyGeneric<PropertyBag, int>(PropertyBag.Gold, 1000); bagData.SetPropertyGeneric<PropertyBag, int>(PropertyBag.Capacity, 100); // 使用完毕后销毁 bagData.Destroy(); sessionData.Destroy(); #endif
构造函数
PropertyObject 仅服务端
csharp
public PropertyObject(Player owner, SyncType syncType = SyncType.Self)创建一个新的 PropertyObject(仅服务端)
owner— 拥有此对象的玩家syncType— 同步类型,默认为 Self(仅同步给所属玩家)
属性
AggregatorWeakReference 双端
csharp
public WeakReference<EventAggregator> AggregatorWeakReference { get; }事件聚合器弱引用(用于 IEventSender)
Id 双端
csharp
public int Id { get; }获取此 PropertyObject 的唯一标识符
Owner 双端
csharp
public Player Owner { get; }获取此 PropertyObject 所属的玩家
IsValid 双端
csharp
public bool IsValid { get; }获取一个值,指示此 PropertyObject 是否有效
SyncId 双端
csharp
public int SyncId { get; }获取同步 ID
SyncIdType 双端
csharp
public static SyncIdType SyncIdType { get; }获取同步 ID 类型
All 双端
csharp
public static IEnumerable<PropertyObject> All { get; }所有 PropertyObject 的快照(服务端 = 本局已创建的全部;客户端 = 已复制到本机的集合)。
备注
客户端「发现」PropertyObject 的两条标准途径(无需继承任何模板基类,如已弃用的 Simple2DMultiplayerGame): 遍历快照 PropertyObject.All(常按 Category 过滤); 到达回调:订阅 EventPropertyObjectReplicated(PropertyObject 复制到本机时发布)。
Category 双端
csharp
public int Category { get; }获取或设置此 PropertyObject 的类别
备注
类别用于标识 PropertyObject 表示的游戏对象类型,便于分类查询和管理。 使用建议: 定义类别常量或枚举,避免使用魔法数字 在创建 PropertyObject 时立即设置 Category 使用 LINQ 查询特定类别的对象:PropertyObject.All.Where(o => o.Category == CardCategory) 示例: // 定义类别常量 const int CategoryCard = 1; const int CategoryItem = 2; const int CategoryPet = 3; // 创建不同类别的对象 var card = new PropertyObject(player, SyncType.All); card.Category = CategoryCard; var item = new PropertyObject(player, SyncType.Self); item.Category = CategoryItem; // 查询特定类别 var allCards = PropertyObject.All.Where(o => o.Category == CategoryCard);
OrderIndex 双端
csharp
public int? OrderIndex { get; }获取或设置此 PropertyObject 的顺序索引
备注
顺序索引是一个可选的整数值,用于在联机游戏中同步对象的位置、顺序或槽位。 这是 2D 联机游戏中替代 3D 场景坐标的核心机制。 典型用法: 多人卡牌游戏:手牌槽位(0, 1, 2, 3...) 在线棋盘游戏:格子索引或编码坐标(x * 100 + y) 联机背包系统:物品栏位编号 多人队列系统:队列中的位置 在线塔防游戏:路径节点索引
GroupId 双端
csharp
public int? GroupId { get; }获取或设置此 PropertyObject 的分组 ID
备注
分组 ID 用于在联机游戏中同步对象的分类或所属区域。 在 2D 联机游戏中,这通常用于区分对象的逻辑"空间"。 典型用法: 多人卡牌游戏:区域分类(手牌=1、战场=2、墓地=3、牌库=4) 在线棋盘游戏:阵营或玩家分组 联机背包系统:页签分类(装备=1、消耗品=2、任务物品=3) 在线任务系统:任务类型(主线=1、支线=2、日常=3) 多人队列系统:队列类型或优先级
Aggregator 双端
csharp
public EventAggregator Aggregator { get; }获取事件聚合器
方法
GetById 双端
csharp
public static PropertyObject? GetById(int id)根据 ID 获取 PropertyObject
id— PropertyObject 的 ID
返回: 找到的 PropertyObject,如果不存在则返回 null
Dispose 双端
csharp
protected virtual void Dispose(bool disposing)释放资源的实际实现
disposing— 是否正在释放托管资源
ToString 双端
csharp
public override string ToString()返回此 PropertyObject 的字符串表示
GetCooldownWithHash 双端
csharp
public TimeSpan? GetCooldownWithHash(long propertyHash)根据哈希获取冷却时间
GetCooldownMaxWithHash 双端
csharp
public TimeSpan? GetCooldownMaxWithHash(long propertyHash)根据哈希获取冷却最大时间
GetCooldownDataWithHash 双端
csharp
public byte[]? GetCooldownDataWithHash(long propertyHash)根据哈希获取冷却数据
Publish 双端
csharp
public virtual void Publish<TEvent>(TEvent eventToPublish)发布事件
eventToPublish— 要发布的事件
GetPublisher 双端
csharp
public Action<TEvent>? GetPublisher<TEvent>()获取事件发布器
返回: 事件发布器
GetPropertyWithHash 双端
csharp
public T? GetPropertyWithHash<T>(long propertyHash)根据哈希获取属性值
GetPropertiesWithHash 仅客户端
csharp
public ReadOnlySpan<PropertyHashKeyValue> GetPropertiesWithHash(bool modifiedOnly = true)获取所有属性(包括哈希)
GetBytesPropertiesWithHash 仅客户端
csharp
public IEnumerable<PropertyHashKeyValueBytes> GetBytesPropertiesWithHash(bool modifiedOnly = true)获取所有字节属性(包括哈希)
GetProperty 双端
csharp
public TValue? GetProperty<TValue>(PropertyPropertyObject property)获取指定属性的值(类型安全)
property— 属性枚举
返回: 属性值
GetPropertyGeneric 双端
csharp
public TValue? GetPropertyGeneric<TProperty, TValue>(TProperty property) where TProperty : IExtendableEnum获取指定属性的值(通用版本,接受任何属性枚举类型)
property— 属性枚举
返回: 属性值
备注
此方法允许使用自定义的属性枚举类型,而不仅限于 PropertyPropertyObject。 适用于需要为不同用途的 PropertyObject 定义专门属性类型的场景。
Destroy 仅服务端
csharp
public void Destroy()销毁此 PropertyObject(仅服务端)
SetCooldownWithHash 仅服务端
csharp
public void SetCooldownWithHash(long propertyHash, TimeSpan max, TimeSpan? current = null)根据哈希设置冷却
SetCooldownWithHash 仅服务端
csharp
public void SetCooldownWithHash(long propertyHash, TimeSpan max, TimeSpan current, byte[] data)根据哈希设置冷却(带数据)
RestartCooldownWithHash 仅服务端
csharp
public void RestartCooldownWithHash(long propertyHash)根据哈希重启冷却
ClearCooldownWithHash 仅服务端
csharp
public void ClearCooldownWithHash(long propertyHash)根据哈希清除冷却
DeclarePropertyHashSyncType 仅服务端
csharp
public static void DeclarePropertyHashSyncType(long propertyHash, SyncType syncType)声明某属性 hash 的权威默认同步范围,取代首次写入时无脑设 All(供 codegen 在首次写入前调用)。
DeclarePropertySyncType 仅服务端
csharp
public static void DeclarePropertySyncType<TProperty>(TProperty property, SyncType syncType) where TProperty : IExtendableEnum声明某条属性(强类型枚举)的权威默认同步范围。供 codegen 生成的属性组件在 OnRegisterProperties 中调用, 在该属性首次写入前生效,使其初始快照与后续增量都按该范围分发——无需「首次写入后再设」的命令式时序。
备注
客户端为 no-op(同步范围仅服务端决定)。
SetPropertyWithHash 仅服务端
csharp
public void SetPropertyWithHash<T>(long propertyHash, T value)根据哈希设置属性值
AddPropertyWithHash 仅服务端
csharp
public void AddPropertyWithHash(long propertyHash, double value)根据哈希增加属性值
SetSyncType 仅服务端
csharp
public void SetSyncType(SyncType type)设置本对象的复制 SyncType。
备注
也服务于「场景门控」绑定的无竞态创建姿势(见 GameGraph 的 PropertyObject.BindToSceneGraph 扩展): 先以 None 创建(此刻本体 appear 的受众为空集,不会抢先发给全体玩家), 再 BindToSceneGraph + Publish,最后用本方法放开目标 SyncType—— 此时本体受众已确定为 SyncType ∩ 场景当前订阅集,非订阅者从头到尾收不到本体/快照。 直接以目标 SyncType 创建再绑定也可(绑定后服务端会在下一 tick 自动收窄受众、对非订阅者补发消失), 但创建瞬间会先把本体发给 SyncType 全体、再撤回,存在一次「闪现」抖动;配合 None 创建可彻底规避。
SetPropertyHashDefaultSyncType 仅服务端
csharp
public void SetPropertyHashDefaultSyncType(int propertyHash, SyncType type)设置某条属性的同步范围(per-actor 覆盖)。
备注
只影响本 PropertyObject 该属性的同步范围,不改变全局 hash 默认(仍为 All), 也不影响其它 PropertyObject 的同名属性。用于 per-property 隐私分级,例如把私有属性设为 Self,使其只同步给 owner(敌方收不到字节)。
SetComponentHashSyncType 仅服务端
csharp
public void SetComponentHashSyncType(int syncId, SyncType type)设置组件哈希的同步类型
TogglePropertyModifyEvent 仅服务端
csharp
public void TogglePropertyModifyEvent(long property, bool on)切换属性修改事件
SetProperty 仅服务端
csharp
public void SetProperty<TValue>(PropertyPropertyObject property, TValue value)设置指定属性的值(类型安全)
property— 属性枚举value— 要设置的值
AddProperty 仅服务端
csharp
public void AddProperty(PropertyPropertyObject property, double value)增加指定属性的值(类型安全)
property— 属性枚举value— 要增加的值
SetPropertyGeneric 仅服务端
csharp
public void SetPropertyGeneric<TProperty, TValue>(TProperty property, TValue value) where TProperty : IExtendableEnum设置指定属性的值(通用版本,接受任何属性枚举类型)
property— 属性枚举value— 要设置的值
备注
此方法允许使用自定义的属性枚举类型,而不仅限于 PropertyPropertyObject。 例如: // 使用自定义的背包属性枚举 bagObject.SetPropertyGeneric<PropertyBag, int>(PropertyBag.Gold, 1000); bagObject.SetPropertyGeneric<PropertyBag, int>(PropertyBag.Capacity, 100);
AddPropertyGeneric 仅服务端
csharp
public void AddPropertyGeneric<TProperty>(TProperty property, double value) where TProperty : IExtendableEnum增加指定属性的值(通用版本,接受任何属性枚举类型)
property— 属性枚举value— 要增加的值
SetPropertySyncType 仅服务端
csharp
public void SetPropertySyncType(PropertyPropertyObject property, SyncType syncType)设置指定属性的同步范围(per-instance)。默认所有属性为 All。
property— 属性枚举syncType— 同步范围(Self / Ally / All 等)
备注
走 per-actor 通道,仅影响本 PropertyObject 的该属性,不改变全局 hash 默认,也不影响其它 PropertyObject 的同名属性。 典型用途:把私有数据(如背包)设为 Self,使其只同步给 owner,敌方收不到字节(反作弊)。 建议在该属性首次写入后调用:未写入过的属性此刻没有值/快照可同步,且同步范围的变更要等该属性被初始化后才会推送; 先写一次再设范围,可确保范围覆盖既作用于已有数据、又能在该属性的初始快照里就按目标范围正确分发。
SetPropertySyncType 仅服务端
csharp
public void SetPropertySyncType<TProperty>(TProperty property, SyncType syncType) where TProperty : IExtendableEnum设置指定属性的同步范围(通用版本,接受任何属性枚举类型)。默认所有属性为 All。
property— 属性枚举syncType— 同步范围(Self / Ally / All 等)
备注
见 SyncType)。
字段
_coreActor 双端
csharp
protected internal ICoreActor _coreActor底层 CoreActor 实例
aggregator 双端
csharp
protected readonly EventAggregator aggregator事件聚合器
EPropertyPropertyObject 双端
命名空间 GameCore.PropertyObjectSystem.Enum
csharp
public enum EPropertyPropertyObjectPropertyObject 的属性枚举
备注
此枚举定义了 PropertyObject 的内置属性。用户可以通过代码生成扩展此枚举来定义自定义属性, 或者定义新的专门属性枚举并使用 SetPropertyGeneric 方法。 对于 2D 联机游戏开发: PropertyObject 是 2D 联机游戏的理想数据同步方案。OrderIndex、GroupId 和 UIPosition 是专为 2D 多人游戏设计的核心属性, 用于替代 3D 游戏中的场景坐标概念。更多复杂属性可以通过扩展此枚举或定义专门的属性枚举来实现。 注意:单机游戏不需要 PropertyObject,应直接在客户端管理游戏数据,无需服务端同步。
枚举值
OrderIndex— 顺序索引,用于表示对象的位置、顺序或槽位GroupId— 分组 ID,用于将 PropertyObject 分类或表示所属区域UIPosition— UI 位置,用于在联机游戏中同步对象的 UI 位置。通常保存为 结构体。Category— 对象类别,用于区分 PropertyObject 表示的游戏对象类型
PropertyPropertyObject 双端
命名空间 GameCore.PropertyObjectSystem.Enum
csharp
public readonly struct PropertyPropertyObject : IGameClass, IExtendableEnum<PropertyPropertyObject>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(PropertyPropertyObject left, PropertyPropertyObject right)operator != 双端
csharp
public static bool operator !=(PropertyPropertyObject left, PropertyPropertyObject right)Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()字段
InnerValue 双端
csharp
public readonly System.Enum InnerValueOrderIndex 双端
csharp
public static readonly PropertyPropertyObject OrderIndex顺序索引,用于表示对象的位置、顺序或槽位
备注
在 2D 联机游戏中,OrderIndex 替代 3D 游戏的场景坐标,表示对象的逻辑位置。 常见用法:多人卡牌游戏:手牌槽位(0=第1张,1=第2张...)在线棋盘游戏:格子索引(可编码二维坐标,如 x*100+y)联机背包系统:物品栏位编号多人队列/列表:排序位置
GroupId 双端
csharp
public static readonly PropertyPropertyObject GroupId分组 ID,用于将 PropertyObject 分类或表示所属区域
备注
在 2D 联机游戏中,GroupId 用于区分对象的逻辑"空间"或分类。 常见用法:多人卡牌游戏:区域(手牌=1、战场=2、墓地=3、牌库=4)在线棋盘游戏:阵营或控制者(玩家1=1、玩家2=2)联机背包系统:页签(装备、消耗品、任务物品)在线任务系统:类型(主线、支线、日常)
UIPosition 双端
csharp
public static readonly PropertyPropertyObject UIPositionUI 位置,用于在联机游戏中同步对象的 UI 位置。通常保存为 UIPosition 结构体。
备注
适用于需要在多个客户端之间同步 UI 位置的场景,例如多人协作的棋盘游戏、卡牌对战等。 单机游戏应直接在客户端管理 UI 位置,无需通过 PropertyObject 同步。
Category 双端
csharp
public static readonly PropertyPropertyObject Category对象类别,用于区分 PropertyObject 表示的游戏对象类型
备注
在 2D 联机游戏中,可能使用不同的 PropertyObject 实例来表示不同类型的游戏对象(如卡牌、道具、宠物等)。 Category 用于标识对象的全局类别,便于在遍历和查询时进行分类。 与其他属性的层次关系:Category - 全局类别(卡牌=1、道具=2、宠物=3)GroupId - 局部分组(手牌区=1、背包页=2)OrderIndex - 位置索引(第0、1、2个)典型用法:多人卡牌游戏:Category 区分卡牌、道具、技能等不同对象类型在线养成游戏:Category 区分角色、宠物、装备等遍历过滤:PropertyObject.All.Where(o => o.Category == 1) 获取所有卡牌使用示例: // 创建不同类别的对象 var card = new PropertyObject(player, SyncType.All); card.Category = 1; // 类别:卡牌 card.GroupId = 1; // 分组:手牌区 card.OrderIndex = 3; // 位置:第3张 var item = new PropertyObject(player, SyncType.Self); item.Category = 2; // 类别:道具 item.GroupId = 1; // 分组:背包第1页 item.OrderIndex = 5; // 位置:第5个槽位 // 遍历时分类查询 var allCards = PropertyObject.All.Where(o => o.Category == 1); var handCards = allCards.Where(c => c.GroupId == 1);
ServerChannelMessage 仅服务端
命名空间 GameCore.ServerChannelSystem
csharp
public static class ServerChannelMessage表示服务器间频道消息,用于在同一游戏的多个服务器实例之间传递数据
备注
ServerChannelMessage 提供了一个简单的API来发送和接收跨服务器消息。 基于Redis Pub/Sub实现,支持频道订阅和消息广播。 核心特性: 跨服务器通信:在同一游戏的多个服务器实例之间传递消息 频道隔离:通过频道名称实现消息分组和路由 自动序列化:支持任意数据格式,推荐使用JSON 事件驱动:基于事件系统进行消息分发 使用场景: 跨服务器状态同步(如世界Boss血量) 全局公告广播(如服务器维护通知) 分布式游戏逻辑协调(如跨服同步事件) 服务器间数据共享(如排行榜更新) 基本用法示例: // 发送消息到频道 var data = new { EventType = "WorldBossKilled", BossId = 123, KillerServer = "Server-1" }; ServerChannelMessage.Publish("world-events", data); // 在游戏初始化时订阅频道 ServerChannelMessage.Subscribe("world-events"); // 注册消息处理器 var trigger = new Trigger<EventChannelMessage>(OnChannelMessageReceived); trigger.Register(Game.Instance); private static async Task<bool> OnChannelMessageReceived(object sender, EventChannelMessage args) { if (args.Channel == "world-events") { var data = JsonSerializer.Deserialize<WorldEventData>(args.Message); // 处理世界事件... } return true; }
方法
Publish 仅服务端
csharp
public static bool Publish(string channel, ReadOnlySpan<byte> message)发布消息到指定频道
channel— 频道名称message— 消息内容(字节数组)
返回: 如果消息成功发送则返回 true;否则返回 false
备注
消息将被发送到所有订阅了该频道的服务器实例,包括当前服务器(如果也订阅了该频道)。
Publish 仅服务端
csharp
public static bool Publish(string channel, byte[] message)发布消息到指定频道(字节数组版本)
channel— 频道名称message— 消息内容(字节数组)
返回: 如果消息成功发送则返回 true;否则返回 false
Publish 仅服务端
csharp
public static bool Publish<T>(string channel, T data)发布JSON序列化的对象到指定频道
channel— 频道名称data— 要发送的数据对象
返回: 如果消息成功发送则返回 true;否则返回 false
备注
此方法会自动将对象序列化为JSON格式后发送。接收方需要使用相同的类型进行反序列化。 序列化使用 Default,支持可扩展枚举等框架特性。
Subscribe 仅服务端
csharp
public static bool Subscribe(string channel)订阅指定频道的消息
channel— 频道名称
返回: 如果订阅成功则返回 true;否则返回 false
备注
订阅后,该频道的所有消息都会触发 EventChannelMessage 事件。 多次订阅同一频道是幂等的(不会重复订阅)。 建议在游戏初始化阶段(如 OnGameInstanceInitialization)进行频道订阅。
Unsubscribe 仅服务端
csharp
public static bool Unsubscribe(string channel)取消订阅指定频道
channel— 频道名称
返回: 如果取消订阅成功则返回 true;否则返回 false
备注
取消订阅后,该服务器将不再接收该频道的消息。 取消订阅一个未订阅的频道是安全的操作(不会报错)。
TryParseJson 仅服务端
csharp
public static bool TryParseJson<T>(ReadOnlySpan<byte> message, out T? result)尝试将消息内容解析为JSON对象
message— 消息字节数组result— 解析结果
返回: 如果解析成功则返回 true;否则返回 false
备注
这是一个辅助方法,用于在事件处理器中方便地解析JSON消息。 反序列化使用 Default,支持可扩展枚举等框架特性。
SubscribeUser 仅服务端
csharp
public static bool SubscribeUser(long userId, string subchannel)订阅指定用户的专属子频道
userId— 用户IDsubchannel— 子频道名称(如 "chat"、"friend"、"team" 等)
返回: 如果订阅成功则返回 true;否则返回 false
备注
此方法会订阅格式为 user-{userId}-{subchannel} 的频道,用于接收发送给特定用户特定类型的消息。 通常在用户登录时调用此方法订阅所需的子频道,在用户登出时调用 String) 取消订阅。 推荐的子频道分类: chat - 跨服私聊消息 friend - 好友相关通知(上线、下线等) team - 跨服组队邀请 trade - 交易和拍卖行通知 mail - 邮件到达通知 system - 系统通知
UnsubscribeUser 仅服务端
csharp
public static bool UnsubscribeUser(long userId, string subchannel)取消订阅指定用户的专属子频道
userId— 用户IDsubchannel— 子频道名称
返回: 如果取消订阅成功则返回 true;否则返回 false
备注
通常在用户登出时调用此方法,释放不再需要的频道订阅。
PublishToUser 仅服务端
csharp
public static bool PublishToUser(long userId, string subchannel, ReadOnlySpan<byte> message)向指定用户的子频道发送消息(字节数组)
userId— 目标用户IDsubchannel— 子频道名称(如 "chat"、"friend" 等)message— 消息内容(字节数组)
返回: 如果消息成功发送则返回 true;否则返回 false
备注
消息将被发送到该用户的专属子频道 user-{userId}-{subchannel}。 只有订阅了该用户该子频道的服务器(通常是该用户当前所在的服务器)会接收到此消息。 注意:如果目标用户不在线或其所在服务器未订阅该子频道,消息将会丢失。
PublishToUser 仅服务端
csharp
public static bool PublishToUser(long userId, string subchannel, byte[] message)向指定用户的子频道发送消息(字节数组)
userId— 目标用户IDsubchannel— 子频道名称message— 消息内容(字节数组)
返回: 如果消息成功发送则返回 true;否则返回 false
PublishToUser 仅服务端
csharp
public static bool PublishToUser<T>(long userId, string subchannel, T data)向指定用户的子频道发送JSON序列化的对象消息
userId— 目标用户IDsubchannel— 子频道名称(如 "chat"、"friend"、"team" 等)data— 要发送的数据对象
返回: 如果消息成功发送则返回 true;否则返回 false
备注
此方法会自动将对象序列化为JSON格式后发送到用户的专属子频道 user-{userId}-{subchannel}。 典型用例: 跨服私聊 (chat):在Server-1的用户向Server-2的用户发送消息 好友通知 (friend):通知用户上线/下线状态 跨服组队 (team):向其他服务器的用户发送组队邀请 邮件通知 (mail):通知用户收到新邮件 交易通知 (trade):拍卖行物品售出通知
GetUserChannelName 仅服务端
csharp
public static string GetUserChannelName(long userId, string subchannel)获取用户专属子频道的名称
userId— 用户IDsubchannel— 子频道名称
返回: 格式为 user-{userId}-{subchannel} 的频道名称
备注
此方法是公开的,允许开发者在需要时手动构造用户频道名称, 例如在消息处理器中判断是否为特定子频道的用户消息。
TryGetUserIdFromChannel 仅服务端
csharp
public static bool TryGetUserIdFromChannel(string channelName, out long userId, out string subchannel)从频道名称中尝试提取用户ID和子频道名称
channelName— 频道名称userId— 提取的用户IDsubchannel— 提取的子频道名称
返回: 如果频道是用户专属子频道且成功提取用户ID和子频道名称则返回 true;否则返回 false
备注
此辅助方法用于在消息处理器中判断、提取用户ID和子频道名称。 频道格式必须为 user-{userId}-{subchannel}。
EventChannelMessage 仅服务端
命名空间 GameCore.ServerChannelSystem.Event
csharp
public class EventChannelMessage : ITriggerEvent<EventChannelMessage>服务器频道消息事件,当从其他服务器实例接收到频道消息时触发
备注
此事件在接收到订阅频道的消息时被触发,包含频道名称和消息内容。 可以通过注册此事件的监听器来处理跨服务器消息。 事件参数: Channel:消息来源的频道名称 Message:消息内容(字节数组) 使用示例: // 注册事件监听器 var trigger = new Trigger<EventChannelMessage>(OnChannelMessageReceived); trigger.Register(Game.Instance); private static async Task<bool> OnChannelMessageReceived(object sender, EventChannelMessage args) { Game.Logger.LogInformation("Received message from channel: {Channel}", args.Channel); // 根据频道处理不同的消息 switch (args.Channel) { case "world-events": HandleWorldEvent(args.Message); break; case "server-sync": HandleServerSync(args.Message); break; } return true; }
构造函数
EventChannelMessage 仅服务端
csharp
public EventChannelMessage(string channel, ReadOnlySpan<byte> message)服务器频道消息事件,当从其他服务器实例接收到频道消息时触发
备注
此事件在接收到订阅频道的消息时被触发,包含频道名称和消息内容。 可以通过注册此事件的监听器来处理跨服务器消息。 事件参数: Channel:消息来源的频道名称 Message:消息内容(字节数组) 使用示例: // 注册事件监听器 var trigger = new Trigger<EventChannelMessage>(OnChannelMessageReceived); trigger.Register(Game.Instance); private static async Task<bool> OnChannelMessageReceived(object sender, EventChannelMessage args) { Game.Logger.LogInformation("Received message from channel: {Channel}", args.Channel); // 根据频道处理不同的消息 switch (args.Channel) { case "world-events": HandleWorldEvent(args.Message); break; case "server-sync": HandleServerSync(args.Message); break; } return true; }
属性
Channel 仅服务端
csharp
public string Channel { get; }获取消息来源的频道名称
Message 仅服务端
csharp
public byte[] Message { get; }获取消息内容的字节数组
备注
消息内容格式由发送方决定。推荐使用JSON格式以便于跨语言和调试。 可以使用 ServerChannelMessage.TryParseJson 方法来解析JSON消息。
ClientCompatibleHash 双端
命名空间 GameCore.Standard
csharp
public static class ClientCompatibleHash显式算法的稳定散列工具,不使用运行时随机化的 string.GetHashCode。
方法
Djb2 双端
csharp
public static uint Djb2(string text)旧 common.string_hash:UTF-8 字节的 DJB2,初值 5381,遇 NUL 终止,32 位无符号溢出。
Md5 双端
csharp
public static string Md5(ReadOnlySpan<byte> bytes)字节内容的 MD5 小写十六进制校验值。
GameDataStatusBar 双端
命名空间 GameCore.StatusBarSystem
csharp
public class GameDataStatusBar : GameDataCategory<GameDataStatusBar>, IGameDataCategory<GameDataStatusBar>, IGameData<GameDataStatusBar>, IGameDataStatusBar template data used by units through StatusBarSetting.
构造函数
GameDataStatusBar 双端
csharp
public GameDataStatusBar(GameLink<GameDataStatusBar, GameDataStatusBar> link)GameDataStatusBar 双端
csharp
public GameDataStatusBar(IGameLink<GameDataStatusBar> link)属性
Widgets 双端
csharp
public List<IGameLink<GameDataWidget>?> Widgets { get; set; }Root widgets in this status bar template.
Anchor 双端
csharp
public Vector2? Anchor { get; set; }Animations 双端
csharp
public List<WidgetAnimationSequence> Animations { get; set; }Priority 双端
csharp
public int Priority { get; set; }方法
CreateStatusBarCustom 仅客户端
csharp
public StatusBarCustom? CreateStatusBarCustom(Vector3 worldPosition)Creates an independent status bar at a world-space position.
CreateStatusBarCustom 仅客户端
csharp
public StatusBarCustom? CreateStatusBarCustom(Vector2 screenPosition)Creates an independent status bar at a screen-space position.
StatusBar 仅客户端
命名空间 GameCore.StatusBarSystem
csharp
public sealed class StatusBarRuntime handle for the status bar currently attached to a unit.
属性
IsValid 仅客户端
csharp
public bool IsValid { get; }Link 仅客户端
csharp
public IGameLink<GameDataStatusBar>? Link { get; }The template link used by the current status bar instance, or null if it cannot be resolved.
WidgetCount 仅客户端
csharp
public int WidgetCount { get; }方法
HasWidget 仅客户端
csharp
public bool HasWidget(IGameLink<GameDataWidget>? link)Returns whether this instance contains a widget created from the specified widget data link.
GetWidget 仅客户端
csharp
public Widget? GetWidget(IGameLink<GameDataWidget>? link)Gets a widget by data link. Returns null if the link is null or this status bar does not contain that widget.
GetWidgetText 仅客户端
csharp
public WidgetText? GetWidgetText(IGameLink<GameDataWidgetText>? link)Gets a text widget by data link.
GetWidgetImage 仅客户端
csharp
public WidgetImage? GetWidgetImage(IGameLink<GameDataWidgetImage>? link)Gets an image widget by data link.
GetWidgetBar 仅客户端
csharp
public WidgetBar? GetWidgetBar(IGameLink<GameDataWidgetBar>? link)Gets a bar widget by data link.
GetWidgetByIndex 仅客户端
csharp
public Widget? GetWidgetByIndex(int index)Gets a widget by its current instance order. Prefer link-based lookup for long-lived game logic.
事件
OnInitialized 仅客户端
csharp
public event Action? OnInitializedFired when the unit status bar is created or rebuilt. Reacquire widget handles in this callback. If the status bar already exists when subscribing, the callback is invoked immediately.
OnDestroyed 仅客户端
csharp
public event Action? OnDestroyedFired when the current native status bar instance is removed. Widget handles from the old instance should be treated as invalid.
StatusBarCustom 仅客户端
命名空间 GameCore.StatusBarSystem
csharp
public sealed class StatusBarCustom : DisposableObjectRuntime handle for an independent status bar created from status bar data.
属性
IsValid 仅客户端
csharp
public override bool IsValid { get; }Link 仅客户端
csharp
public IGameLink<GameDataStatusBar> Link { get; }The template link used to create this custom status bar.
WidgetCount 仅客户端
csharp
public int WidgetCount { get; }方法
DisposeManaged 仅客户端
csharp
protected override void DisposeManaged()Destroy 仅客户端
csharp
public new void Destroy()SetScreenPosition 仅客户端
csharp
public void SetScreenPosition(Vector2 position)SetWorldPosition 仅客户端
csharp
public void SetWorldPosition(Vector3 position)Sets the status bar position in world space.
HasWidget 仅客户端
csharp
public bool HasWidget(IGameLink<GameDataWidget>? link)Returns whether this instance contains a widget created from the specified widget data link.
GetWidget 仅客户端
csharp
public Widget? GetWidget(IGameLink<GameDataWidget>? link)Gets a widget by data link. Returns null after this status bar is destroyed.
GetWidgetText 仅客户端
csharp
public WidgetText? GetWidgetText(IGameLink<GameDataWidgetText>? link)Gets a text widget by data link.
GetWidgetImage 仅客户端
csharp
public WidgetImage? GetWidgetImage(IGameLink<GameDataWidgetImage>? link)Gets an image widget by data link.
GetWidgetBar 仅客户端
csharp
public WidgetBar? GetWidgetBar(IGameLink<GameDataWidgetBar>? link)Gets a bar widget by data link.
GetWidgetByIndex 仅客户端
csharp
public Widget? GetWidgetByIndex(int index)Gets a widget by its current instance order. Prefer link-based lookup for long-lived game logic.
Task 双端
命名空间 GameCore.TaskSystem
csharp
public abstract class Task : ITickFinalizerRepresents an abstract base class for asynchronous tasks that can be executed, monitored, and cancelled within the game framework.
token— Optional cancellation token to monitor for cancellation requests.allowSynchronousStop— Whether the task can be stopped immediately or must wait for the next tick finalizer.
备注
The Task class provides a foundation for implementing long-running operations that need to be executed over multiple game ticks. Unlike standard .NET tasks, these tasks are integrated with the game's tick system and provide cancellation support through cancellation tokens. Tasks can be started, stopped, and monitored through events. The class supports both synchronous and asynchronous stopping mechanisms depending on the allowSynchronousStop parameter.
构造函数
Task 双端
csharp
protected Task(CancellationToken? token = null, bool allowSynchronousStop = false)Represents an abstract base class for asynchronous tasks that can be executed, monitored, and cancelled within the game framework.
token— Optional cancellation token to monitor for cancellation requests.allowSynchronousStop— Whether the task can be stopped immediately or must wait for the next tick finalizer.
备注
The Task class provides a foundation for implementing long-running operations that need to be executed over multiple game ticks. Unlike standard .NET tasks, these tasks are integrated with the game's tick system and provide cancellation support through cancellation tokens. Tasks can be started, stopped, and monitored through events. The class supports both synchronous and asynchronous stopping mechanisms depending on the allowSynchronousStop parameter.
属性
Status 双端
csharp
public TaskStatus Status { get; set; }Gets the current status of the task.
备注
Setting the status triggers appropriate events (OnStarted, OnCompleted, OnStopped) and manages the task's lifecycle transitions. The status changes are monitored by the task system.
IsCompleted 双端
csharp
public bool IsCompleted { get; }Gets a value indicating whether the task has completed successfully.
IsEnded 双端
csharp
public bool IsEnded { get; }Gets a value indicating whether the task has finished execution (either completed, cancelled, or faulted).
备注
This property is useful for determining if a task is no longer active and can be cleaned up or removed from tracking collections.
方法
Start 双端
csharp
public virtual void Start()Starts the execution of the task.
备注
This method transitions the task from WaitingForActivation to Running status. If a cancellation token was provided, it registers a callback to handle cancellation requests. The method has no effect if the task is not in the WaitingForActivation state.
Cancel 双端
csharp
public void Cancel()Cancels the task execution.
备注
This is a convenience method that calls Stop(false) to cancel the task. The actual stopping behavior depends on the allowSynchronousStop parameter set during construction.
Stop 双端
csharp
protected virtual bool Stop(bool completed)Stops the task execution, either due to completion or cancellation.
completed— True if the task is stopping because it completed successfully; false for cancellation.
返回: True if the stop operation was initiated successfully; otherwise, false.
备注
The behavior depends on the allowSynchronousStop setting. If synchronous stopping is allowed, the task stops immediately. Otherwise, the stop operation is deferred to the next tick finalizer for completed tasks, or marked as pending cancel for cancelled tasks.
StopSynchronous 双端
csharp
protected virtual bool StopSynchronous(bool completed)Immediately stops the task and performs cleanup operations.
completed— True if the task completed successfully; false if it was cancelled.
返回: True if the task was stopped successfully; otherwise, false.
备注
This method performs the actual stopping logic including unregistering cancellation tokens, updating the status, and clearing event handlers. It's called either immediately (for synchronous stops) or during tick finalization (for asynchronous stops).
TickFinalizer 双端
csharp
public void TickFinalizer()Finalizes the task state during the tick finalizer phase.
备注
This method is called by the game's tick finalizer system to handle deferred task stopping. It checks for pending cancellation or cancellation token requests and performs the appropriate stopping action. For tasks that don't have pending cancellation, it assumes successful completion.
事件
OnStarted 双端
csharp
public event Action? OnStartedOccurs when the task starts running.
备注
This event is raised when the task transitions from WaitingForActivation to Running status. Subscribers can use this event to perform initialization or logging when a task begins execution.
OnStopped 双端
csharp
public event Action? OnStoppedOccurs when the task stops running, regardless of whether it completed successfully or was cancelled.
备注
This event is raised for both successful completion and cancellation scenarios. It's useful for cleanup operations that need to occur regardless of how the task ended.
OnCompleted 双端
csharp
public event Action? OnCompletedOccurs when the task completes successfully.
备注
This event is raised only when the task finishes its work successfully (not when cancelled). It's raised before the OnStopped event for completed tasks.
字段
cancellationToken 双端
csharp
protected readonly CancellationToken? cancellationTokentokenRegistration 双端
csharp
protected CancellationTokenRegistration? tokenRegistrationallowSynchronousStop 双端
csharp
protected readonly bool allowSynchronousStopTaskResult 双端
命名空间 GameCore.TaskSystem
csharp
public readonly struct TaskResult<T> where T : notnull构造函数
TaskResult 双端
csharp
public TaskResult(T value)TaskResult 双端
csharp
public TaskResult(TaskStatus error)Constructor for error result
error— Can only pass values that are not TaskStatus.RanToCompletion
属性
Value 双端
csharp
public T? Value { get; }Result 双端
csharp
public TaskStatus Result { get; }Error 双端
csharp
public TaskStatus? Error { get; }IsSuccess 双端
csharp
public bool IsSuccess { get; }方法
implicit operator 双端
csharp
public static TaskResult<T> implicit operator(T value)implicit operator 双端
csharp
public static TaskResult<T> implicit operator(TaskStatus error)operator true 双端
csharp
public static bool operator true(TaskResult<T> x)operator false 双端
csharp
public static bool operator false(TaskResult<T> x)operator ! 双端
csharp
public static bool operator !(TaskResult<T> x)operator & 双端
csharp
public static TaskResult<T> operator &(TaskResult<T> x, TaskResult<T> y)GameplaySnapshot 双端
命名空间 GameCore.Testing
csharp
public static class GameplaySnapshotRead-only authoritative gameplay evidence used by Runtime MCP.
属性
IsAvailable 仅客户端
csharp
public static bool IsAvailable { get; }方法
SetTransport 仅客户端
csharp
public static void SetTransport(Func<GameplaySnapshotRequest, bool>? transport)Request 仅客户端
csharp
public static bool Request(GameplaySnapshotRequest request)Receive 仅客户端
csharp
public static void Receive(GameplaySnapshotResponse response)Read 仅客户端
csharp
public static JsonObject Read(Guid id)Capture 仅服务端
csharp
public static JsonObject Capture(Player player, GameplaySnapshotRequest request)GameplaySnapshotRequest 双端
命名空间 GameCore.Testing
csharp
public sealed class GameplaySnapshotRequest : IEquatable<GameplaySnapshotRequest>构造函数
GameplaySnapshotRequest 双端
csharp
public GameplaySnapshotRequest(Guid RequestId, int? SceneId = null, int? UnitId = null, int Offset = 0, int Limit = 8, int TraceSeconds = 0)属性
RequestId 双端
csharp
public Guid RequestId { get; init; }SceneId 双端
csharp
public int? SceneId { get; init; }UnitId 双端
csharp
public int? UnitId { get; init; }Offset 双端
csharp
public int Offset { get; init; }Limit 双端
csharp
public int Limit { get; init; }TraceSeconds 双端
csharp
public int TraceSeconds { get; init; }方法
ToString 双端
csharp
public override string ToString()operator != 双端
csharp
public static bool operator !=(GameplaySnapshotRequest? left, GameplaySnapshotRequest? right)operator == 双端
csharp
public static bool operator ==(GameplaySnapshotRequest? left, GameplaySnapshotRequest? right)GetHashCode 双端
csharp
public override int GetHashCode()Equals 双端
csharp
public override bool Equals(object? obj)Equals 双端
csharp
public bool Equals(GameplaySnapshotRequest? other)Deconstruct 双端
csharp
public void Deconstruct(out Guid RequestId, out int? SceneId, out int? UnitId, out int Offset, out int Limit, out int TraceSeconds)GameplaySnapshotResponse 双端
命名空间 GameCore.Testing
csharp
public sealed class GameplaySnapshotResponse : IEquatable<GameplaySnapshotResponse>构造函数
GameplaySnapshotResponse 双端
csharp
public GameplaySnapshotResponse(Guid RequestId, JsonObject Report)属性
RequestId 双端
csharp
public Guid RequestId { get; init; }Report 双端
csharp
public JsonObject Report { get; init; }方法
ToString 双端
csharp
public override string ToString()operator != 双端
csharp
public static bool operator !=(GameplaySnapshotResponse? left, GameplaySnapshotResponse? right)operator == 双端
csharp
public static bool operator ==(GameplaySnapshotResponse? left, GameplaySnapshotResponse? right)GetHashCode 双端
csharp
public override int GetHashCode()Equals 双端
csharp
public override bool Equals(object? obj)Equals 双端
csharp
public bool Equals(GameplaySnapshotResponse? other)Deconstruct 双端
csharp
public void Deconstruct(out Guid RequestId, out JsonObject Report)