Gamecenter plugin

This plugins allows you to access apple gamecenter

Platforms:

iOS, tvOS, macOS(out of beta :) )

Limitations:

tvOS does not support getting friends and also leaderboard.show will show achievements(I recommend making your own interface).

Functions:

gc.init(listener)

handles sign in and connection status

  • type(string)--"login"
    • status(string)-- "signed in", "could not login", "showing login", or "could not access gamecenter"
  • type(string)--"error"
    • status(string)-- "error" or "other error"
    • error(string)-- "feature not available", "unable to access gamecenter", "unknown error", "internet not available", or if "other error" you will get a description of error

gc.isAvailable() -- returns(boolean) true is gamecenter is available and false if not available

Nodes:

  • gc.leaderboards -- handles gamecenter leaderboards
    • gc.leaderboards.show("leaderboardId") --returns "showing"
    • leaderboardId (string)(optional) If this is nil or blank, it will show all leaderboards. If it is a string, it will show that leaderboard based on the id
    • gc.leaderboards.loadScores("leaderboardId", listener,{params}) --returns "showing"
    • leaderboardId (string) the id of leaderboard that you want to get scores from
    • listener (function)
      • status(string)-- can be "success" or "error"
      • error(string)-- explains the error
      • scores(array) each array contains table:
        • date(string)-- returns date of score ("HH:mm yyyy/MMM/d")(timezone GMT)
        • leaderboardIdentifier(string)-- leaderboardId of the leaderboard requested
        • rank(integer)-- how high the person is ranked on the the leaderboard
        • playerId(string)-- id of player who got the score
        • value(integer)-- the actual score
        • playerAlias(string)--username of player
        • formattedValue(string)--A player’s score as a localized string. You determine how your scores are formatted when you define the leaderboard on iTunes Connect.
    • params (table)(optional)
    • insert these values in table:
      • timeScope(string)-- possible values are "today", "week", or "all"(all is default)
      • playerScope(string)-- possible values are "friends" or "global"(global is default)
      • rangeMin(integer)-- the starting number to start getting scores from a leaderboard(requires rangeMax and only can get up to 100 values)
      • rangeMax(integer)-- the ending number to stop getting scores from a leaderboard(requires rangeMin and only can get up to 100 values)
      • rangeMax(integer)-- the ending number to stop getting scores from a leaderboard(requires rangeMin and only can get up to 100 values)
    • gc.leaderboards.loadScore("leaderboardId", listener) --returns (integer) your score from a leaderboard
    • leaderboardId (string) the id of leaderboard that you want to get the signed users score from
    • listener (function)
      • status(string)-- can be "success" or "error"
      • error(string)-- explains the error
      • score(integer) score of player
    • gc.leaderboards.submit("leaderboardId", score.0, listener)
    • leaderboardId (string) the id of leaderboard that you want to get the signed users scores from
    • score(integer) the score to be sent
    • listener(function)
      • status(string)-- either "score sent" or "error"
      • error(string)-- explains the error

  • gc.achievements -- handles gamecenter achievements
    • gc.achievements.show() --returns "showing"
    • show the achievement gamecenter popup
    • gc.achievements.loadAll(listener)
    • returns all the achievements
    • listener (function)
      • status(string)-- can be "success" or "error"
      • error(string)-- explains the error
      • achievements(array) each array contains table:
        • lastReportedDate(string)-- The last time that progress on the achievement was successfully reported to Game Center.("HH:mm yyyy/MMM/d")(timezone GMT)
        • percentComplete(interger)-- leaderboardId of the leaderboard requested (1-100)
        • identifier(string)-- the id of the achievement
        • unachievedDescription(string)-- A localized description of the achievement to be used when the local player has not completed the achievement.
        • title(string)-- title of achievement
        • achievedDescription(string)--A localized description to be used after the local player has completed the achievement.
        • status(string)-- either "hidden" or "visible"
        • replayable(string)-- either "replayable" or "not replayable"
    • gc.achievements.submit("achievementId", progress.0, listener)
    • achievementId (string) the id of achievement that you want to send the signed users progress on
    • progress(integer) the progress to be sent should be between 1-100
    • listener(function)
      • status(string)-- either "achievement set" or "error"
      • error(string)-- explains the error
    • gc.achievements.reset(listener)
    • resets all achievements immediately
    • listener(function)
      • status(string)-- either "success" or "error"
      • error(string)-- explains the error
  • gc.challenges -- handles gamecenter challenges
    • gc.challenges.show() --returns "showing"
    • show the challenges gamecenter popup
    • gc.challenges.load(listener)
    • returns all the challenges
    • listener (function)
      • status(string)-- can be "success" or "error"
      • error(string)-- explains the error
      • challenges(array) each array contains table:
        • issuingPlayerId(string)-- the playerid of the who sent the challenge
        • issuingPlayerAlias(string)-- the player name of the who sent the challenge
        • receivingPlayerId(string)-- the id of the player who received
        • receivingPlayerAlias(string)-- the name of the player who received
        • state(string)-- state of challenge: "declined", "complete", "pending", or "invalid"
        • message(string)--the message sent with a challenge
        • issueDate(string)-- the date the challenge was sent ("HH:mm yyyy/MMM/d")(timezone GMT)
        • completionDate(string)-- The date the challenge was completed ("HH:mm yyyy/MMM/d")(timezone GMT)

  • gc.player -- handles player data
    • gc.player.id() (string) --returns the gamecenter id
    • gc.player.name() (string) --returns the gamecenter username
    • gc.player.friends(listener)
    • listener(function)
      • status(string)-- can be "success" or "error"
      • error(string)-- explains the error
      • friends(array) -- return array of friends gamecenter id

    Build Settings:

    Helpful links:

    Get Plugin

    Example

    Support