Class AirshipLeaderboardService

This service provides access to leaderboard information as well as methods for updating existing leaderboards. Leaderboards must be created using the https://create.airship.gg website. Once a leaderboard is created, it can be accessed using the name provided during setup.

Methods

  • Deletes a set of entries from the leaderboard if they exist.

    Parameters

    • leaderboardName: string
    • ids: string[]

    Returns Promise<void>

  • Deletes an entry on the leaderboard if it exists.

    Parameters

    • leaderboardName: string
    • id: string

    Returns Promise<void>

  • Gets the rank of a given id.

    Parameters

    • leaderboardName: string

      The name of the leaderboard

    • id: string

      The id

    Returns Promise<undefined | Ranking>

  • Gets a section of the leaderboard. This function is helpful for displaying leaderboards in your game. By default, this function returns the top 100 entries.

    This function returns a subsection of the top 1000 entries. Rankings are tracked for users below the top 1000, but they can only be accessed using the GetRank function.

    Parameters

    • leaderboardName: string

      The leaderboard name

    • startIndex: number = 0

      The start index of the selection. Defaults to 0, which is the top of the leaderboard.

    • count: number = 100

      The number of entries to retrieve. Defaults to 100.

    Returns Promise<Ranking[]>

  • This function is restricted to only in-editor use.

    Used to create an ephemeral leaderboard within the editor to test functions and views when using a leaderboard.

    Parameters

    • options: {
          id: string;
          operator: "SET" | "ADD" | "SUB" | "USE_LATEST";
          sortOrder: "ASC" | "DESC";
      }
      • id: string
      • operator: "SET" | "ADD" | "SUB" | "USE_LATEST"
      • sortOrder: "ASC" | "DESC"

    Returns void

  • Clears all entries from the leaderboard. You can also reset a leaderboard using the https://create.airship.gg website.

    Parameters

    • leaderboardName: string

    Returns Promise<void>

  • Sends an update to the provided leaderboard. The scores provided are added to, subtracted from, or replace the existing scores based on the leaderboard configuration.

    Parameters

    • leaderboardName: string

      The name of the leaderboard that should be updated with the given scores

    • update: PushStatsType

      An object containing a map of ids and scores.

    Returns Promise<void>