PokéRogue
    Preparing search index...

    A basic abstract class to act as a holder and processor for UI elements.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    active: boolean = false
    arrowDown: Sprite
    arrowUp: Sprite
    cursor: number = 0
    exitCallback?: AnyFn

    A callback invoked when clear is called

    gameData: GameData

    The game data to display

    gameStatsContainer: Container
    headerText: Text

    Logged in username

    mode: null | number
    statLabels: Text[] = []
    statsContainer: Container
    statValues: Text[] = []
    ROWS_PER_PAGE: 9

    The number of rows enabled per page.

    Accessors

    Methods

    • Calculate the y position of the stat label/text based on its index.

      Parameters

      • index: number

        The index of the stat label

      Returns number

      The y position for the stat label

    • Calculate the x position of the stat label based on its index.

      Parameters

      • index: number

        The index of the stat label

      Returns number

      The x position for the stat label

      Should be used for stat labels (e.g. stat name, not its value). For stat value, use calcTextX.

    • Calculate the x position of the stat value based on its index.

      Parameters

      • index: number

        The index of the stat value

      Returns number

      The calculated x position

    • Returns the username of logged in user. If the username is hidden, the trainer name based on gender will be displayed.

      Returns string

      The username of logged in user

    • Set the cursor to the specified position, if able and update the stats display.

      Parameters

      • newCursor: number

        The position to set the cursor to.

      Returns boolean

      Whether the cursor successfully moved to a new position

      If newCursor is not between 0 and maxCursorPos, or if it is the same as newCursor then no updates happen and false is returned.

      Otherwise, updates the up/down arrow visibility and calls updateStats

    • Update the stat labels and values to reflect the current cursor position.

      Returns void

      Invokes each stat's DisplayStat.sourceFunc | sourceFunc to obtain its value. Stat labels are shown as ??? if the stat is marked as hidden and its value is zero.