主题
GameSystemUI.CardSystem
CardExtensions 双端
命名空间 GameSystemUI.CardSystem
csharp
public static class CardExtensions卡牌接口扩展 - 提供便捷方法
方法
GetCardType 双端
csharp
public static CardType GetCardType(this ICard card)获取卡牌类型
CanDropToScene 双端
csharp
public static bool CanDropToScene(this ICard card)检查卡牌是否支持场景放置
GetSceneTargetType 双端
csharp
public static CardSceneTargetType GetSceneTargetType(this ICard card)获取场景放置目标类型
ICard 双端
命名空间 GameSystemUI.CardSystem
csharp
public interface ICard卡牌接口 - 客户端和服务端共用的核心契约 定义卡牌实例的基本属性,供UI系统和业务逻辑使用
备注
使用说明:
- 实现此接口创建您自己的卡牌类
- CardLink 指向 GameDataCard 配置数据
- 运行时数据(如当前费用、冷却等)由您的实现类管理
属性
InstanceId 双端
csharp
public long InstanceId { get; }卡牌唯一实例ID(运行时生成,用于区分同类型卡牌的不同实例)
CardLink 双端
csharp
public IGameLink<GameDataCard> CardLink { get; }卡牌配置数据链接
CardData 双端
csharp
public GameDataCard? CardData { get; }卡牌配置数据(从 CardLink 获取)
Name 双端
csharp
public string Name { get; }卡牌名称(可重写以支持动态名称)
CurrentCost 双端
csharp
public int CurrentCost { get; }卡牌当前费用(可能受 Buff 等影响,默认返回配置费用)
IsUsable 双端
csharp
public bool IsUsable { get; }卡牌是否可用(由业务逻辑决定,如费用是否足够、是否在冷却等)
CardSceneTargetType 双端
命名空间 GameSystemUI.CardSystem.Data
csharp
public enum CardSceneTargetType卡牌场景目标类型 - 决定拖拽到场景时如何选择目标
枚举值
Point— 点目标 - 在鼠标位置释放Unit— 单位目标 - 需要选中一个单位None— 无目标 - 直接释放,无需指定位置
CardType 双端
命名空间 GameSystemUI.CardSystem.Data
csharp
public readonly struct CardType : IGameClass, IExtendableEnum<CardType>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(CardType left, CardType right)operator != 双端
csharp
public static bool operator !=(CardType left, CardType 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 Enum InnerValueNormal 双端
csharp
public static readonly CardType Normal普通卡牌
Skill 双端
csharp
public static readonly CardType Skill技能卡牌
Equipment 双端
csharp
public static readonly CardType Equipment装备卡牌
Consumable 双端
csharp
public static readonly CardType Consumable消耗品卡牌
Special 双端
csharp
public static readonly CardType Special特殊卡牌
ECardType 双端
命名空间 GameSystemUI.CardSystem.Data
csharp
public enum ECardType卡牌类型枚举(可扩展)
枚举值
Normal— 普通卡牌Skill— 技能卡牌Equipment— 装备卡牌Consumable— 消耗品卡牌Special— 特殊卡牌
GameDataCard 双端
命名空间 GameSystemUI.CardSystem.Data
csharp
public class GameDataCard : GameDataCategory<GameDataCard>, IGameDataCategory<GameDataCard>, IGameData<GameDataCard>, IGameData卡牌配置数据 - 定义卡牌的静态属性(在编辑器中配置)
构造函数
GameDataCard 双端
csharp
public GameDataCard(GameLink<GameDataCard, GameDataCard> link)GameDataCard 双端
csharp
public GameDataCard(IGameLink<GameDataCard> link)属性
Description 双端
csharp
public string Description { get; set; }卡牌描述
IconPath 双端
csharp
public Icon IconPath { get; set; }卡牌图标路径
BackgroundPath 双端
csharp
public Icon BackgroundPath { get; set; }卡牌背景图路径
BorderPath 双端
csharp
public Icon BorderPath { get; set; }卡牌边框图路径
Type 双端
csharp
public CardType Type { get; set; }卡牌类型
Cost 双端
csharp
public int Cost { get; set; }卡牌费用/消耗
CanDropToScene 双端
csharp
public bool CanDropToScene { get; set; }是否可以拖拽到场景(启用后可以释放到游戏世界中)
SceneTargetType 双端
csharp
public CardSceneTargetType SceneTargetType { get; set; }场景放置目标类型(决定如何处理场景放置)
AbilityLink 双端
csharp
public IGameLink<GameDataAbility>? AbilityLink { get; set; }关联的技能链接(用于场景释放时执行技能)