bga-dice
    Preparing search index...

    Interface DiceManagerSettings<T>

    interface DiceManagerSettings<T> {
        animationManager: any;
        autoPlace?: AutoPlaceSettings<T>;
        borderRadius?: number;
        dieClickEventFilter?: DieClickEventFilter;
        faces?: number;
        getDieFace?: (die: T) => number;
        getId?: (die: T) => string | number;
        perspective?: number;
        selectableDieClass?: string;
        selectedDieClass?: string;
        setupDieDiv?: (die: T, element: HTMLDivElement) => void;
        setupFaceDiv?: (die: T, element: HTMLDivElement, face: number) => void;
        size?: number;
        type?: string;
        unselectableDieClass?: string;
    }

    Type Parameters

    • T
    Index

    Properties

    animationManager: any

    The animation manager used in the game.

    autoPlace?: AutoPlaceSettings<T>

    The settings when using placeDie/placeDice to automatically place some dice in the matching stock

    borderRadius?: number

    The border radius, in % (default 5% for 6-faces, else 0%).

    dieClickEventFilter?: DieClickEventFilter

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

    faces?: number

    The number of faces of the die (default 6).

    getDieFace?: (die: T) => number

    Return the die face. Default: the face will be set to die.face.

    Type declaration

      • (die: T): number
      • Parameters

        • die: T

          the die informations

        Returns number

        the die face

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

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

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

    Type declaration

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

        • die: T

          the die informations

        Returns string | number

        the id for a die

    perspective?: number

    Perspective effect on Stock elements. Default 1000px. Can be overriden on each stock.

    selectableDieClass?: string

    The class to apply to selectable dice. Default 'bga-dice_selectable-die'.

    selectedDieClass?: string

    The class to apply to selected dice. Default 'bga-dice_selected-die'.

    setupDieDiv?: (die: T, element: HTMLDivElement) => void

    Allow to populate the main div of the die. You can set classes or dataset, if it's informations shared by all faces.

    Type declaration

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

        • die: T

          the die informations

        • element: HTMLDivElement

          the die main Div element

        Returns void

    setupFaceDiv?: (die: T, element: HTMLDivElement, face: number) => void

    Allow to populate a face div of the die. You can set classes or dataset to show the correct die face.

    Type declaration

      • (die: T, element: HTMLDivElement, face: number): void
      • Parameters

        • die: T

          the die informations

        • element: HTMLDivElement

          the die face Div element

        • face: number

          the face number (1-indexed)

        Returns void

    size?: number

    The size of the die, in px (default 50).

    type?: string

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

    The die element will have this type as a class, and each face will have the class ${type}-face-${number}.

    unselectableDieClass?: string

    The class to apply to selectable dice. Default 'bga-dice_disabled-die'.