bga-cards
    Preparing search index...

    Interface CardManagerSettings<T>

    interface CardManagerSettings<T> {
        animationManager: any;
        autoPlace?: AutoPlaceSettings<T>;
        cardBorderRadius?: string;
        cardClickEventFilter?: CardClickEventFilter;
        cardHeight: number;
        cardWidth: number;
        fakeCardGenerator?: (deckId: string) => T;
        getCardRotation?: (card: T) => number;
        getId?: (card: T) => string | number;
        isCardVisible?: (card: T) => boolean;
        lastPlayedCardStyle?: SelectionStyle;
        selectableCardStyle?: SelectionStyle;
        selectableSlotStyle?: SelectionStyle;
        selectedCardStyle?: SelectionStyle;
        selectedSlotStyle?: SelectionStyle;
        setupBackDiv?: (card: T, element: HTMLDivElement) => void;
        setupDiv?: (card: T, element: HTMLDivElement) => void;
        setupFrontDiv?: (card: T, element: HTMLDivElement) => void;
        type?: string;
        unselectableCardStyle?: SelectionStyle;
        unselectableSlotStyle?: SelectionStyle;
    }

    Type Parameters

    • T
    Index

    Properties

    animationManager: any

    The animation manager used in the game.

    autoPlace?: AutoPlaceSettings<T>

    The settings when using placeCard(s) to automatically place some cards in the matching stock

    cardBorderRadius?: string

    Indicate the width of a card border radius (example : '10px', '50%').

    cardClickEventFilter?: CardClickEventFilter

    The filter on card click event. Default 'selectable'.

    cardHeight: number

    Indicate the height of a card (in px).

    cardWidth: number

    Indicate the width of a card (in px).

    fakeCardGenerator?: (deckId: string) => T

    A generator of fake cards, to generate decks top card automatically. Default is generating an empty card, with only id set.

    Type declaration

      • (deckId: string): T
      • Parameters

        • deckId: string

          the deck id

        Returns T

        the fake card to be generated (usually, only informations to show back side)

    getCardRotation?: (card: T) => number

    Return the card rotation. Use getCardRotation from settings if set, else will return 0

    Type declaration

      • (card: T): number
      • Parameters

        • card: T

          the card informations

        Returns number

        the card rotation

    getId?: (card: T) => string | number

    Define the id that will be set to each card div. It must return a unique id for each different card, so it's often linked to card id.

    Default: the id will be set to card.id.

    Type declaration

      • (card: T): string | number
      • Parameters

        • card: T

          the card informations

        Returns string | number

        the id for a card

    isCardVisible?: (card: T) => boolean

    A function to determine if the card should show front side or back side, based on the informations of the card object. If you only manage visible cards, set it to () => true. Default is card.type is truthy.

    Type declaration

      • (card: T): boolean
      • Parameters

        • card: T

          the card informations

        Returns boolean

        true if front side should be visible

    lastPlayedCardStyle?: SelectionStyle

    The style to apply to the last played card. Default to class 'bga-cards_last-played-card'.

    selectableCardStyle?: SelectionStyle

    The style to apply to selectable cards. Default to class 'bga-cards_selectable-card'.

    selectableSlotStyle?: SelectionStyle

    The style to apply to selectable slots. Default to class 'bga-cards_selectable-slot'.

    selectedCardStyle?: SelectionStyle

    The style to apply to selected cards. Use style from manager is unset. Default to class 'bga-cards_selected-card'.

    selectedSlotStyle?: SelectionStyle

    The style to apply to selected slots. Default to class 'bga-cards_selected-slot'.

    setupBackDiv?: (card: T, element: HTMLDivElement) => void

    Allow to populate the back div of the card. You can set classes or dataset to show the correct card face. You can also add some translated text on the card at this moment.

    Type declaration

      • (card: T, element: HTMLDivElement): void
      • Parameters

        • card: T

          the card informations

        • element: HTMLDivElement

          the card back Div element. You can add a class, change dataset, set background for the back side

        Returns void

        the id for a card

    setupDiv?: (card: T, element: HTMLDivElement) => void

    Allow to populate the main div of the card. You can set classes or dataset, if it's informations shared by both sides.

    Type declaration

      • (card: T, element: HTMLDivElement): void
      • Parameters

        • card: T

          the card informations

        • element: HTMLDivElement

          the card main Div element. You can add a class (to set width/height), change dataset, ... based on the card informations. There should be no visual informations on it, as it will be set on front/back Divs.

        Returns void

        the id for a card

    setupFrontDiv?: (card: T, element: HTMLDivElement) => void

    Allow to populate the front div of the card. You can set classes or dataset to show the correct card face. You can also add some translated text on the card at this moment.

    Type declaration

      • (card: T, element: HTMLDivElement): void
      • Parameters

        • card: T

          the card informations

        • element: HTMLDivElement

          the card front Div element. You can add a class, change dataset, set background for the back side

        Returns void

        the id for a card

    type?: string

    The type of cards, if you game has multiple cards types (each card manager should have a different type). Default ${yourgamename}-card.

    The card element will have this type as a class, and each side will have the class ${type}-${'front'/'back'}.

    unselectableCardStyle?: SelectionStyle

    The style to apply to selectable cards. Use style from manager is unset. Default to class 'bga-cards_unselectable-card'.

    unselectableSlotStyle?: SelectionStyle

    The style to apply to selectable slots. Default to class 'bga-cards_unselectable-slot'.