Skip to content

The Match Screen

The match screen only shows what a player’s client knows and turns their clicks into commands. It contains no rules, so you can restyle or rebuild it freely without affecting the game.

Component Job
MatchBootstrap Starts a match on this device: against the computer or hotseat.
MatchPresenter Plays each update from the host as animations, then syncs the board to the new view.
BoardView Owns the card objects and makes the screen match the view.
ZoneView The area for one zone of one player.
ZoneLayout Decides where cards sit in a zone: FanLayout, RowLayout, PileLayout.
CardView One card: shows what it is bound to and glides to where its zone wants it.
StatLabel, CostLabel Show a card’s stat or cost.
PlayerPanel, PlayerStatLabel Show a player’s name and stats; clicking one targets that player.
EventAnimator Shows one kind of event.
MatchInput Turns clicks and drags into commands. ClickAndDragInput is the default.
MatchHud Turn counter, turn banner, messages, game over screen and rewards.
CardPreview Shows a large copy of the card under the pointer.
HandoverScreen Covers the board between hotseat turns.
AutoInputModule Adds the right UI input module for your project’s input settings.

Place a ZoneView for each zone you want visible and set:

  • Zone: the Zone Definition it shows.
  • Seat Offset: whose zone, counted from the player looking at the screen: 0 is them, 1 the next player round the table.
  • Layout: a layout component, usually on the same object.
  • Count Only: show a number instead of cards, as for decks.

Zones the player cannot see (the opponent’s hand) are shown face down with the right count. Zones without a view still work; they are just not drawn.

The board’s Default Card Prefab is used for every card unless a card type names its own Card Prefab. A card prefab needs a CardView and a CanvasGroup on its root. All its other parts are optional:

  • Front and Back objects, switched for face-up and face-down cards.
  • Highlight (playable) and Selection (chosen) objects.
  • Art, Name Text, Rules Text and Keywords Text.
  • Rarity Mark: coloured with the card’s rarity.
  • A StatLabel per stat to show, and a CostLabel per resource. A stat you add to your game later needs only one more label, no code.

The sample’s prefab is in Samples/ManaAndMinions/Prefabs/Card.prefab.

MatchPresenter uses every EventAnimator component among its children, one per event type. The kit’s animators are CardMovedAnimator, CardCreatedAnimator, StatChangedAnimator (with optional floating numbers), AttackAnimator and TurnBannerAnimator. To change an animation, remove its component and add your own; events without an animator are skipped. Turn on the presenter’s Instant to skip all animation time, or change Duration Scale.

Whatever an animator leaves out of place is corrected when the board syncs to the new view at the end of each update, so animators can be as simple as you like.

ClickAndDragInput never works out what is legal itself: it offers only the commands the host says are open to the player, so the screen cannot offer an illegal move. Assign its End Phase Button, and optionally a Confirm Choice Button (for choices of more or fewer than one card) and a Prompt Text.

In hotseat the screen switches to whoever must act next once the last move has finished showing. With a HandoverScreen set on the bootstrap, the board is cleared and covered first, so players never see each other’s hands.

MatchBootstrap shows how: compile the rules, create a host and clients through the MatchInstaller, call presenter.Initialize, join each client with a deck, and presenter.Bind the client whose side should be shown. Online play does the same with network transports; see Online Play.