PlayZone
namespace Griff.Modules.Cards;
public sealed class PlayZone : CardZone, IDrawable, IPlaytestReportA place on the table cards are played onto, with no code: drag a card from a Hand onto it (or click the card, then it) and it slides into place, laid out in a row or a pile. It takes only the kinds it Accepts, up to its Limit, from the hands named in From; a card it won’t take slides back to the hand. It lights up while a card it would take is held over it. Each card played sends its PlayMessage.
Its Count and Played outputs are there for a Counter or a Text, and its Discard action (put every card on it on its discard pile: clearing the table at the end of a round) for a Trigger, a wire or a script. What’s on it and how many have been played are saved with the scene, so a rewind takes them back.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Accepts
Section titled “Accepts”public string? Accepts { get; set; }The kinds of card it takes (each a card’s Kind), separated by commas, e.g. “Creature, Spell”. Empty takes any.
public Color Color { get; set; }The color it’s drawn in on the table. Transparent draws nothing (it can lie over a picture of the table).
DiscardAfter
Section titled “DiscardAfter”public float DiscardAfter { get; set; }Seconds a card played onto it stays once it has slid into place, before it goes on to its DiscardPile: a spell, cast and gone. Cards that stay on the table to do something (a creature, with a Health, or a card with a Card Effect that acts each turn) stay. 0 keeps every card until its Discard action.
DiscardPile
Section titled “DiscardPile”public string? DiscardPile { get; set; }The deck its Discard action puts its cards on, by name. Empty uses the scene’s first face-up deck.
FaceUp
Section titled “FaceUp”public bool FaceUp { get; set; }Turns the cards played onto it face up. Untick it to play cards face down: a trap, a hidden bet.
public string? From { get; set; }The hands that may play onto it, by name, separated by commas: each side’s own row. Empty: any hand.
HoverColor
Section titled “HoverColor”public Color HoverColor { get; set; }The color it lights up in while a card it would take is held over it, or the keys point at it.
IsFull
Section titled “IsFull”public bool IsFull { get; }True while it holds its Limit.
public string? Label { get; set; }Words written in it while it’s empty, e.g. “Play a card”.
Layout
Section titled “Layout”public CardLayout Layout { get; set; }How it lays out the cards played onto it: in a Row or a Pile.
public int Limit { get; set; }The most cards it holds: once it has this many it takes no more. 0 is no limit.
PlayMessage
Section titled “PlayMessage”public string? PlayMessage { get; set; }A message sent as a card is played onto it, with the card’s entity as its data.
PlaySound
Section titled “PlaySound”public string? PlaySound { get; set; }A sound played as a card is played onto it, e.g. “Sounds/play.wav”.
Played
Section titled “Played”public int Played { get; set; }How many cards have been played onto it, all told. Saved with the scene, so a rewind takes them back.
RefuseSound
Section titled “RefuseSound”public string? RefuseSound { get; set; }A sound played as it turns a card away.
public Vector2 Size { get; set; }How big it is, in world units: cards dropped inside it are played onto it.
SlideTime
Section titled “SlideTime”public float SlideTime { get; set; }Seconds a card takes to slide into place on it.
Spacing
Section titled “Spacing”public float Spacing { get; set; }How far apart cards in a row are, middle to middle, while there’s room.
Methods
Section titled “Methods”AcceptsKind
Section titled “AcceptsKind”public bool AcceptsKind(string? kind)True if it takes a card of kind (a card’s Kind): it accepts any, or names that one.
Discard
Section titled “Discard”public void Discard()Puts every card on it on its discard pile at the start of the next frame.
TakesFrom
Section titled “TakesFrom”public bool TakesFrom(Hand hand)True if hand may play onto it: From is empty or names it.
Events
Section titled “Events”CardPlayed
Section titled “CardPlayed”public event Action<PlayZone, Card>? CardPlayedRaised as a card is played onto it.