×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2012.821 | Released: 23 May 2012, 2:01am | What's New | Download Now

gameNetwork.show()

Description:

Shows (displays) information from game network provider on the screen.

For OpenFeint provider, launches the OpenFeint dashboard in one of the following configurations: leaderboards, challenges, achievements, friends, playing or high score.

For Papaya provider, launches the Papaya dashboard in one of the following configurations: leaderboards, challenges, achievements, friends, avatar, chat, circles, or invites.

Syntax:

gameNetwork.show( name [, data]  )

Example:

local gameNetwork = require "gameNetwork"
 
--For OpenFeint:
gameNetwork.init( "openfeint", "product-key", "secret", "display name", "appId" )
gameNetwork.show( "leaderboards" )
gameNetwork.show( "highscore", "abc123" )

local gameNetwork = require "gameNetwork"
 
--For Papaya (Android-only):
gameNetwork.init( "papaya", "papayaSocialKey" )
 
gameNetwork.show( "leaderboards", " Level1" ) 
gameNetwork.show( "leaderboards" )      -- Displays default leaderboard
gameNetwork.show( "achievements" )
gameNetwork.show( "avatar" )
gameNetwork.show( "challenges" )
gameNetwork.show( "chat" )
gameNetwork.show( "circles" )
gameNetwork.show( "friends" )
gameNetwork.show( "invites" )

local gameNetwork = require "gameNetwork"
 
--For GameCenter (iOS-only):
gameNetwork.init( "gamecenter", {listener=initCallback} )
 
gameNetwork.show( "leaderboards", { leaderboard = {timeScope="Week"}, listener=dismissCallback } )
 
gameNetwork.show( "achievements", { listener=dismissCallback } )
 
gameNetwork.show( "friendRequest", { message="By my friend please", playerIDs={ "G:194669300", "G:1435127232" }, emailAddresses={ "me@me.com" },  listener=dismissCallback} )

Parameters:

name
Strings supported by the OpenFeint provider:

  • "leaderboards"
  • "challenges" (Not supported in Android).
  • "achievements"
  • "friends" (Not supported in Android).
  • "playing" (Not supported in Android).
  • "highscore" NOTE: in this case an additional data string is required (see below). (Not supported in Android).

For OpenFeint, calling gameNetwork.show without this parameter displays the OpenFeint Dashboard.

Note: The items listed above that are not available on Android can still be viewed by going to the OpenFeint Dashboard.

data
String (if Game Center: table): When the OpenFeint dashboard view is "highscore", the string should contain the "leaderboardID" property whose value is the corresponding OpenFeint leaderboard id. Please see example above for data table format for Game Center network.

Strings supported by the Papaya provider:

  • "leaderboards"
  • "leaderboards", "level"
  • "challenges"
  • "achievements"
  • "friends"
  • "avatar"
  • "chat"
  • "circles"
  • "invites"

Strings supported by the Game Center provider:

  • "leaderboards"
  • "achievements"
  • "friendRequest"

All APIs for Game Center support a table as an optional second parameter.
"listener" is an optional key for all the APIs which you may assign a callback function.

For "leaderboards", "leaderboard" is an optional key in the table parameter which takes a table. The table has key/value pairs that mimic the GKLeaderboard (and GKLeaderboardViewController) objects. The key "timeScope" may take one of the following strings:
"Today"
"Week"
"AllTime"

For "friendRequest", optional keys in the table parameter are:
"message" which takes a string which allows you to prepopulate the message field with your own custom text.
"playerIDs" takes an array of strings of Game Center playerIDs to players you want to send a friend request to (which can be retrieved from gameNetwork.request() APIs).
"emailAddresses" takes an array of strings which are email addresses of players you want to send friend requests to.
Note: The total number of playerIDs and emailAddresses must not exceed the Game Center maximum limit or the OS will throw an exception. gameNetwork.request("loadFriendRequestMaxNumberOfRecipients" returns this number. As of this writing, the limit is 3.

Returns:

Nothing.

Remarks:

Note: This replaces the depreciated openfeint.launchDashboard API.

Do the following to close the OpenFeint Dashboard:
On Android the Menu button shows a "Exit Feint" button that will exit back to the Corona App. You can also use the Back button to exit (this will go through all the navigated OpenFeint screens and finally exit OpenFeint).

On iOS, there is an "x" in the upper right coroner of the OpenFeint screen that closes the Dashboard.

Papaya available starting with build 2011.591.
Papaya support removed as of build 2012.819.

Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    --
  • Windows:
    --
  • iOS:
    Build 2011.556, Game Center: Build 2012.725
  • Android:
    Build 2011.557, Papaya: Build 2011.591

Replies

aisaksen
User offline. Last seen 4 days 19 hours ago. Offline
Joined: 29 Jan 2012

when using GameCenter you can add a "category" key/value parameter to the "leaderboard" table to select a specific category. The category value is the Leaderboard ID you assign in itunesconnect.