Class: D6<G>
Specialized piece for representing 6-sided dice
Example
import { D6 } from '@boardzilla/core/components';
...
game.create(D6, 'my-die');
Type parameters
Name | Type |
---|---|
G | extends Game = Game |
Hierarchy
-
Piece
<G
>↳
D6
Adjacency
isAdjacentTo
▸ isAdjacentTo(element
): boolean
If this element is adjacent to some other element, using the nearest containing space that has an adjacency map.
Parameters
Name | Type |
---|---|
element | GameElement <BaseGame , BasePlayer > |
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/element.ts:540
distanceTo
▸ distanceTo(element
): number
Finds the shortest distance between two spaces
Parameters
Name | Type | Description |
---|---|---|
element | GameElement <BaseGame , BasePlayer > | element to measure distance to |
Returns
number
Inherited from
Defined in
boardzilla-core/src/board/element.ts:552
adjacencies
▸ adjacencies<F
>(className
, ...finders
): ElementCollection
<F
>
Find all elements adjacent based on row/column placement or based on this element having connections created by Space#connectTo. Uses the same parameters as GameElement#all
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:564
withinDistance
▸ withinDistance<F
>(distance
, className
, ...finders
): ElementCollection
<F
>
Finds all spaces connected to this space by a distance no more than
distance
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
distance | number |
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:578
setShape
▸ setShape(...shape
): void
Set an irregular shape for this element. This is only meaningful for the purposes of finding specifically adjacent cells when placed into a PieceGrid. See PieceGrid#adjacenciesByCell. When rendered in a PieceGrid, the element will have a size large enough to fill the appropriate number of spaces in the grid, but it's appearance is otherwise unaffected and will be based on appearance. When not rendered in a PieceGrid, the element will take up a single cell but will be scaled relatively to other elements with a shape in the same layout.
Parameters
Name | Type | Description |
---|---|---|
...shape | string [] | A set of single characters used as labels for each cell. The cell label characters are provided as an array of strings, with each string being one row of cell labels, with spaces used to indicate empty "holes" in the shape. Each row must be the same length. The specific non-space characters used are used for labelling the adjacencies in PieceGrid#adjacenciesByCell but are otherwise unimportant. |
Returns
void
Example
domino12.setShape(
'12'
);
tetrisPiece.setShape(
'XX ',
' XX'
);
Inherited from
Defined in
boardzilla-core/src/board/element.ts:902
setEdges
▸ setEdges(edges
): void
Set the edge labels for this element. These are only meaningful for the purposes of finding specifically adjacent edges when placed into a PieceGrid. See PieceGrid#adjacenciesByEdge.
Parameters
Name | Type | Description |
---|---|---|
edges | Partial <Record <Direction , string >> | Record <string , Partial <Record <Direction , string >>> | A set of edge labels for each cell label provided by setShape. For simple 1-celled shapes, the edges can be provided without cell labels. |
Returns
void
Example
// a bridge tile with a road leading from left to right and a river leading
// from top to bottom.
simpleTile.setEdge(
up: 'river',
down: 'river',
left: 'road'
right: 'road'
});
// A tetris-shaped tile with sockets coming out either "end"
tetrisPiece.setShape(
'AX ',
' XB'
);
tetrisPiece.setEdge({
A: {
left: 'socket'
},
B: {
right: 'socket'
}
});
Inherited from
Defined in
boardzilla-core/src/board/element.ts:947
D6
current
• current: number
= 1
Currently shown face
Defined in
boardzilla-core/src/components/d6/d6.ts:21
roll
▸ roll(): void
Randomly choose a new face, causing the roll animation
Returns
void
Defined in
boardzilla-core/src/components/d6/d6.ts:28
Other
layoutAsDrawer
▸ layoutAsDrawer(applyTo
, attributes
): void
Creates a collapsible drawer layout for a Space within this Element. This is like GameElement#layout except for one specific Space, with additional parameters that set the behaviour/appearance of the drawer. A tab will be attached the drawer that will allow it be opened/closed.
Parameters
Name | Type | Description |
---|---|---|
applyTo | string | Space <G , NonNullable <G ["player" ]>> | The Space for the drawer. Either the Space itself or its name. |
attributes | Object | - |
attributes.area? | Box | - |
attributes.openDirection | "left" | "right" | "up" | "down" | - |
attributes.tab? | ReactNode | - |
attributes.closedTab? | ReactNode | - |
attributes.openIf? | (actions : { name : string ; args : Record <string , Argument > }[]) => boolean | - |
attributes.closeIf? | (actions : { name : string ; args : Record <string , Argument > }[]) => boolean | - |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1157
layoutAsTabs
▸ layoutAsTabs(tabs
, attributes
): void
Creates a tabbed layout for a set of Space's within this Element. This is like GameElement#layout except for a set of Spaces, with additional parameters that set the behaviour/appearance of the tabs. Each Space will be laid out into the same area, with a set of tabs attached to allow the Player or the game rules to select which tab is shown.
Parameters
Name | Type | Description |
---|---|---|
tabs | Record <string , string | Space <G , NonNullable <G ["player" ]>>> | JSX for the appearance of the tabs as a set of key-value pairs |
attributes | Object | - |
attributes.area? | Box | - |
attributes.tabDirection | "left" | "right" | "up" | "down" | - |
attributes.tabs? | Record <string , ReactNode > | - |
attributes.setTabTo? | (actions : { name : string ; args : Record <string , Argument > }[]) => string | - |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1185
layoutAsPopout
▸ layoutAsPopout(applyTo
, attributes
): void
Hides a Space within this element and replaces it with popout button. Clicking on the button opens this Space in a full-board modal. This is like GameElement#layout except for one Space, with additional parameters that set the behaviour/appearance of the popout modal.
Parameters
Name | Type | Description |
---|---|---|
applyTo | string | Space <G , NonNullable <G ["player" ]>> | The Space for the popout. Either a Space or the name of a Space. |
attributes | Object | - |
attributes.area? | Box | - |
attributes.button | ReactNode | - |
attributes.popoutMargin? | number | { top : number ; bottom : number ; left : number ; right : number } | - |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1213
Queries
name
• name: string
Element name, used to distinguish elements. Elements with the same name are generally considered indistibuishable. Names are also used for easy searching of elements.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:241
player
• Optional
player: NonNullable
<G
["player"
]>
Player with which this element is identified. This does not affect
behaviour but will mark the element as mine
in queries in the context of
this player (during an action taken by a player or while the game is
viewed by a given player.).
Inherited from
Defined in
boardzilla-core/src/board/element.ts:250
all
▸ all<F
>(className
, ...finders
): ElementCollection
<F
>
Finds all elements within this element recursively that match the arguments provided.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
className | ElementClass <F > | Optionally provide a class as the first argument as a class filter. This will only match elements which are instances of the provided class |
...finders | ElementFinder <F >[] | All other parameters are filters. See ElementFinder for more information. |
Returns
An ElementCollection of as many matching elements as can be
found. The collection is typed to ElementCollection<className>
if one was
provided.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:379
first
▸ first<F
>(className
, ...finders
): undefined
| F
Finds the first element within this element recursively that matches the arguments provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
undefined
| F
A matching element, if found
Inherited from
Defined in
boardzilla-core/src/board/element.ts:391
firstN
▸ firstN<F
>(n
, className
, ...finders
): ElementCollection
<F
>
Finds the first n
elements within this element recursively that match the arguments
provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
n | number | number of matches |
className | ElementClass <F > | - |
...finders | ElementFinder <F >[] | - |
Returns
An ElementCollection of as many matching elements as can be
found, up to n
. The collection is typed to ElementCollection<className>
if one was provided.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:407
last
▸ last<F
>(className
, ...finders
): undefined
| F
Finds the last element within this element recursively that matches the arguments provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
undefined
| F
A matching element, if found
Inherited from
Defined in
boardzilla-core/src/board/element.ts:419
lastN
▸ lastN<F
>(n
, className
, ...finders
): ElementCollection
<F
>
Finds the last n
elements within this element recursively that match the arguments
provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
n | number | number of matches |
className | ElementClass <F > | - |
...finders | ElementFinder <F >[] | - |
Returns
An ElementCollection of as many matching elements as can be
found, up to n
. The collection is typed to ElementCollection<className>
if one was provided.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:435
top
▸ top<F
>(className
, ...finders
): undefined
| F
Alias for first
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
undefined
| F
Inherited from
Defined in
boardzilla-core/src/board/element.ts:446
topN
▸ topN<F
>(n
, className
, ...finders
): ElementCollection
<F
>
Alias for firstN
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
n | number |
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:456
bottom
▸ bottom<F
>(className
, ...finders
): undefined
| F
Alias for last
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
undefined
| F
Inherited from
Defined in
boardzilla-core/src/board/element.ts:466
bottomN
▸ bottomN<F
>(n
, className
, ...finders
): ElementCollection
<F
>
Alias for lastN
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
n | number |
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:476
next
▸ next<F
>(this
, ...finders
): undefined
| F
Finds next element in this element's Space of the same class that matches the arguments provided, e.g. the next card after this one in the same pile.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
this | F | - |
...finders | ElementFinder <F >[] | any number of ElementFinder arguments to filter |
Returns
undefined
| F
Inherited from
Defined in
boardzilla-core/src/board/element.ts:489
previous
▸ previous<F
>(this
, ...finders
): undefined
| F
Finds previous element in this element's Space of the same class that matches the arguments provided, e.g. the previous card before this one in the same pile.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
this | F | - |
...finders | ElementFinder <F >[] | any number of ElementFinder arguments to filter |
Returns
undefined
| F
Inherited from
Defined in
boardzilla-core/src/board/element.ts:502
others
▸ others<F
>(className
, ...finders
): ElementCollection
<F
>
Finds "sibling" elements (elements that are directly inside the parent of this element) that match the arguments provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:513
has
▸ has<F
>(className
, ...finders
): boolean
Return whether any element within this element recursively matches the arguments provided. See all for parameter details.
Type parameters
Name | Type |
---|---|
F | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
className | ElementClass <F > |
...finders | ElementFinder <F >[] |
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/element.ts:525
container
▸ container<T
>(className?
): undefined
| T
Returns this elements parent.
Type parameters
Name | Type |
---|---|
T | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
className? | ElementClass <T > | If provided, searches up the parent tree to find the first matching element. E.g. if a Token is placed on a Card in a players Tableau. calling token.container(Tableau) can be used to find the grandparent. |
Returns
undefined
| T
Inherited from
Defined in
boardzilla-core/src/board/element.ts:611
containerWithProperty
▸ containerWithProperty(property
, value?
): undefined
| GameElement
<BaseGame
, BasePlayer
>
Returns this elements containing element that also has a given property.
Parameters
Name | Type |
---|---|
property | string |
value? | any |
Returns
undefined
| GameElement
<BaseGame
, BasePlayer
>
Inherited from
Defined in
boardzilla-core/src/board/element.ts:622
mine
• get
mine(): boolean
Whether this element belongs to the player viewing the game. A player is considered to be currently viewing the game if this is called in the context of an action taken by a given player (during an action taken by a player or while the game is viewed by a given player.) It is an error to call this method when not in the context of a player action. When querying for elements using ElementFinder such as all and first, mine is available as a search key that accepts a value of true/false
Returns
boolean
Inherited from
Piece.mine
Defined in
boardzilla-core/src/board/element.ts:679
Structure
row
• Optional
row: number
Row of element within its layout grid if specified directly or by a "sticky" layout.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:257
column
• Optional
column: number
Column of element within its layout grid if specified directly or by a "sticky" layout.
Inherited from
Defined in
boardzilla-core/src/board/element.ts:264
game
• game: G
The Game to which this element belongs
Inherited from
Defined in
boardzilla-core/src/board/element.ts:272
constructor
• new D6<G
>(ctx
): D6
<G
>
Do not use the constructor directly. Instead Call GameElement#create or GameElement#createMany on the element in which you want to create a new element.
Type parameters
Name | Type |
---|---|
G | extends Game <BaseGame , BasePlayer > = Game <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
ctx | Partial <ElementContext > |
Returns
D6
<G
>
Inherited from
Defined in
boardzilla-core/src/board/element.ts:319
toString
▸ toString(): string
String used for representng this element in game messages when the object is passed directly, e.g. when taking the choice directly from a chooseOnBoard choice.
Returns
string
Inherited from
Defined in
boardzilla-core/src/board/element.ts:351
setOrder
▸ setOrder(order
): void
Set this class to use a different ordering style.
Parameters
Name | Type | Description |
---|---|---|
order | undefined | "normal" | "stacking" | ordering style - "normal": Elements placed into this element are put at the end of the list (default) - "stacking": Used primarily for stacks of cards. Elements placed into this element are put at the beginning of the list. E.g. if a stack of cards has order set to stacking the first method will return the last card placed in the stack, rather than the first one placed in the stack. Hidden items in the stack are not tracked or animated while reordered to prevent their identity from being exposed as they move |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:599
isEmpty
▸ isEmpty(): boolean
Returns whether this element has no elements placed within it.
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/element.ts:633
sortBy
▸ sortBy(key
, direction?
): ElementCollection
<GameElement
<G
, NonNullable
<G
["player"
]>>>
Sorts the elements directly contained within this element by some Sorter.
Parameters
Name | Type |
---|---|
key | GenericSorter | GenericSorter [] |
direction? | "desc" | "asc" |
Returns
ElementCollection
<GameElement
<G
, NonNullable
<G
["player"
]>>>
Inherited from
Defined in
boardzilla-core/src/board/element.ts:641
shuffle
▸ shuffle(): void
re-orders the elements directly contained within this element randomly.
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:649
owner
• get
owner(): undefined
| P
The player that owns this element, or the first element that contains this
element searching up through the parent hierarchy. This is related to, but
different than player. E.g. if a standard playing card is in a
player's hand, typically the hand.player
will be assigned to that player
but the card itself would not have a player
. In this case the
card.owner() will equal the player in whose hand the card is placed.
Returns
undefined
| P
Inherited from
Piece.owner
Defined in
boardzilla-core/src/board/element.ts:664
create
▸ create<T
>(className
, name
, attributes?
): T
Create an element inside this element. This can only be called during the game setup (see createGame. Any game elements that are required must be created before the game starts. Elements that only appear later in the game can be created inside the Game#pile or made invisible.
Type parameters
Name | Type |
---|---|
T | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
className | ElementClass <T > | Class to create. This class must be included in the elementClasses in createGame. |
name | string | Sets name |
attributes? | Partial <Pick <T , "name" | "player" | "row" | "column" | "rotation" | { [K in string | number | symbol]: K extends keyof GameElement<BaseGame, BasePlayer> ? never : T[K] extends Function ? never : K }[keyof T ]>> | Sets any attributes of the class that are defined in your own class that extend Space, Piece, or Game. Can also include player. |
Returns
T
Example
deck.create(Card, 'ace-of-hearts', { suit: 'H', value: '1' });
Inherited from
Defined in
boardzilla-core/src/board/element.ts:700
createMany
▸ createMany<T
>(n
, className
, name
, attributes?
): ElementCollection
<T
>
Create n elements inside this element of the same class. This can only be called during the game setup (see createGame. Any game elements that are required must be created before the game starts. Elements that only appear later in the game can be created inside the Game#pile or made invisible.
Type parameters
Name | Type |
---|---|
T | extends GameElement <BaseGame , BasePlayer > |
Parameters
Name | Type | Description |
---|---|---|
n | number | Number to create |
className | ElementClass <T > | Class to create. This class must be included in the elementClasses in createGame. |
name | string | Sets name |
attributes? | Partial <Pick <T , "name" | "player" | "row" | "column" | "rotation" | { [K in string | number | symbol]: K extends keyof GameElement<BaseGame, BasePlayer> ? never : T[K] extends Function ? never : K }[keyof T ]>> | (n : number ) => Partial <Pick <T , "name" | "player" | "row" | "column" | "rotation" | { [K in string | number | symbol]: K extends keyof GameElement<BaseGame, BasePlayer> ? never : T[K] extends Function ? never : K }[keyof T ]>> | Sets any attributes of the class that are defined in your own class that extend Space, Piece, or Game. Can also include player. If a function is supplied here, a single number argument will be passed with the number of the added element, starting with 1. |
Returns
Inherited from
Defined in
boardzilla-core/src/board/element.ts:747
destroy
▸ destroy(): void
Permanently remove an element. This can only be done while defining the game, and is usually only useful when creating groups of elements, such as createMany or createGrid where some of the created elements are not needed.
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:774
rotation
• get
rotation(): number
Rotation of element if set, normalized to 0-359 degrees
Returns
number
Inherited from
Piece.rotation
Defined in
boardzilla-core/src/board/element.ts:784
position
▸ position(): number
Returns the index of this element within its parent, starting at zero
Returns
number
Inherited from
Defined in
boardzilla-core/src/board/element.ts:797
isDescendantOf
▸ isDescendantOf(el
): boolean
Whether this element has the given element in its parent hierarchy
Parameters
Name | Type |
---|---|
el | GameElement <BaseGame , BasePlayer > |
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/element.ts:963
putInto
▸ putInto(to
, options?
): void
Move this piece into another element. This triggers any onEnter callbacks in the destination.
Parameters
Name | Type | Description |
---|---|---|
to | GameElement <BaseGame , BasePlayer > | Destination element |
options? | Object | - |
options.position? | number | Place the piece into a specific numbered position relative to the other elements in this space. Positive numbers count from the beginning. Negative numbers count from the end. |
options.row? | number | - |
options.column? | number | - |
options.fromTop? | number | Place the piece into a specific numbered position counting from the first element |
options.fromBottom? | number | Place the piece into a specific numbered position counting from the last element |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:144
remove
▸ remove(): void
Remove this piece from the playing area and place it into Game#pile
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:192
UI
layout
▸ layout(applyTo
, attributes
): void
Apply a layout to some of the elements directly contained within this element. See also ElementCollection#layout
Parameters
Name | Type | Description |
---|---|---|
applyTo | string | GameElement <BaseGame , BasePlayer > | ElementClass <GameElement <BaseGame , BasePlayer >> | ElementCollection <GameElement <BaseGame , BasePlayer >> | Which elements this layout applies to. Provided value can be: - A specific GameElement - The name of an element - A specific set of elements (ElementCollection) - A class of elements If multiple layout declarations would apply to the same element, only one will be used. The order of specificity is as above. If a class is used and mutiple apply, the more specific class will be used. |
attributes | Partial <LayoutAttributes > | A list of attributes describing the layout. All units of measurement are percentages of this elements width and height from 0-100, unless otherwise noted (See margin and gap ) |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1105
configureLayout
▸ configureLayout(layoutConfiguration
): void
Change the layout attributes for this space's layout.
Parameters
Name | Type |
---|---|
layoutConfiguration | Partial <LayoutAttributes > |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1226
appearance
▸ appearance(appearance
): void
Define the appearance of this element. Any values provided override previous ones. See also ElementCollection#appearance
Parameters
Name | Type | Description |
---|---|---|
appearance | Object | Possible values are: |
appearance.className? | string | A class name to add to the dom element |
appearance.render? | false | (el : D6 <G >) => null | Element | A function that takes this element as its only argument and returns JSX for the element. See ../ui/appearance for more on usage. |
appearance.aspectRatio? | number | The aspect ratio for this element. This value is a ratio of width over height. All layouts defined in layout will respect this aspect ratio. |
appearance.effects? | { trigger : (element : D6 <G >, oldAttributes : Partial <Pick <D6 <G >, undefined | "name" | "current" | "player" | "row" | "column" | "rotation" | "_visible" | "sides" | "rollSequence" >>) => boolean ; name : string }[] | Provides a CSS class that will be applied to this element if its attributes change to match the provided ones. |
appearance.info? | boolean | (el : D6 <G >) => null | boolean | Element | Return JSX for more info on this element. If returning true, an info modal will be available for this element but with only the rendered element and no text |
appearance.connections? | Object | If the elements immediately within this element are connected using Space#connectTo, this makes those connections visible as connecting lines. Providing a label will place a label over top of this line by calling the provided function with the distance of the connection specified in Space#connectTo and using the retured JSX. If labelScale is provided, the label is scaled by this amount. |
appearance.connections.thickness? | number | - |
appearance.connections.style? | "double" | "solid" | - |
appearance.connections.color? | string | - |
appearance.connections.fill? | string | - |
appearance.connections.label? | (__namedParameters : { distance : number ; to : Space <Game <BaseGame , BasePlayer >, BasePlayer > ; from : Space <Game <BaseGame , BasePlayer >, BasePlayer > }) => ReactNode | - |
appearance.connections.labelScale? | number | - |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/element.ts:1267
Visibility
showToAll
▸ showToAll(): void
Show this piece to all players
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:31
showOnlyTo
▸ showOnlyTo(player
): void
Show this piece only to the given player
Parameters
Name | Type |
---|---|
player | number | Player <BaseGame , BasePlayer > |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:39
showTo
▸ showTo(...player
): void
Show this piece to the given players without changing it's visibility to any other players.
Parameters
Name | Type |
---|---|
...player | number [] | Player <BaseGame , BasePlayer >[] |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:52
hideFromAll
▸ hideFromAll(): void
Hide this piece from all players
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:67
hideFrom
▸ hideFrom(...player
): void
Hide this piece from the given players without changing it's visibility to any other players.
Parameters
Name | Type |
---|---|
...player | number [] | Player <BaseGame , BasePlayer >[] |
Returns
void
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:76
isVisibleTo
▸ isVisibleTo(player
): boolean
Returns whether this piece is visible to the given player
Parameters
Name | Type |
---|---|
player | number | Player <BaseGame , BasePlayer > |
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:94
isVisible
▸ isVisible(): boolean
Returns whether this piece is visible to all players, or to the current player if called when in a player context (during an action taken by a player or while the game is viewed by a given player.)
Returns
boolean
Inherited from
Defined in
boardzilla-core/src/board/piece.ts:110
revealWhenHidden
▸ revealWhenHidden<T
>(this
, ...attrs
): void
Provide list of attributes that remain visible even when these pieces are
not visible to players. E.g. In a game with multiple card decks with
different backs, identified by Card#deck, the identity of the card when
face-down is hidden, but the deck it belongs to is not, since the card art
on the back would identify the deck. In this case calling
Card.revealWhenHidden('deck')
will cause all attributes other than 'deck'
to be hidden when the card is face down, while still revealing which deck
it is.
Type parameters
Name | Type |
---|---|
T | extends Piece <BaseGame , BasePlayer > |
Parameters
Name | Type |
---|---|
this | ElementClass <T > |
...attrs | string & keyof T [] |
Returns
void