| Package | com.milkmangames.nativeextensions.ios |
| Class | public class GameCenter |
| Inheritance | GameCenter flash.events.EventDispatcher |
| Property | Defined By | ||
|---|---|---|---|
| gameCenter : GameCenter [static] [read-only]
The current instance of the GameCenter singelton. | GameCenter | ||
| Method | Defined By | ||
|---|---|---|---|
GameCenter(logCallback:Function = null)
Do not call this directly; use GameCenter.create() to initialize or GameCenter.gameCenter to get current instance. | GameCenter | ||
authenticateLocalUser():void
Sends request to authenticate (log in) the user on GameCenter. | GameCenter | ||
[static]
Initializes the GameCenter Extension. | GameCenter | ||
dispose():void Dispose of Context | GameCenter | ||
getPlayerAlias():String
Gets the Alias (human-readable name) of the current logged in player. | GameCenter | ||
getPlayerID():String
Get the unique identifier of the current logged in player. | GameCenter | ||
isGameCenterAvailable():Boolean
Checks if GameCenter is available on the running device. | GameCenter | ||
isPlayerUnderage():Boolean
Check if the current logged in player is 'underage' in the GameCenter database. | GameCenter | ||
isSupported():Boolean [static]
Checks if the current platform supports GameCenter. | GameCenter | ||
isUserAuthenticated():Boolean
Check if the user is currently logged in and authenticated with GameCenter. | GameCenter | ||
reportAchievement(achievementId:String, completion:Number):void
Report achievement progress to the GameCenter server. | GameCenter | ||
reportScoreForCategory(score:int, category:String):void
Report a score to the GameCenter server. | GameCenter | ||
resetAchievements():void
Sends a request to reset the user's achievements in this game. | GameCenter | ||
showAchievements():void
Shows the iOS Achievements view for the user on GameCenter. | GameCenter | ||
showLeaderboardForCategory(category:String):void
Shows the iOS Leaderboard view for the user on GameCenter. | GameCenter | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when an achievement submission failed after a call to gameCenter.reportAchievement() | GameCenter | |||
| Dispatched when an achievement submission succeeded after a call to gameCenter.reportAchievement() | GameCenter | |||
| Dispatched when an achievement reset failed after a call to gameCenter.resetAchievements() | GameCenter | |||
| Dispatched when an achievement reset succeeded after a call to gameCenter.resetAchievements() | GameCenter | |||
| Dispatched when the default achievement view has been dismissed by the user. | GameCenter | |||
| Dispatched when the default leaderboard view has been displayed, after a call to gameCenter.showAchievements() | GameCenter | |||
| Dispatched when authentication of the local user has failed after a call to gameCenter.authenticateLocalUser() | GameCenter | |||
| Dispatched when the user has been successfully authorized after a call to gameCenter.authenticateLocalUser() | GameCenter | |||
| Dispatched when the default leaderboard view has been dismissed by the user. | GameCenter | |||
| Dispatched when the default leaderboard view has been displayed, after a call to gameCenter.showLeaderboardForCategory() | GameCenter | |||
| Dispatched when a score submission failed after a call to gameCenter.reportScoreForCategory() | GameCenter | |||
| Dispatched when a score submission succeeded after a call to gameCenter.reportScoreForCategory() | GameCenter | |||
| Constant | Defined By | ||
|---|---|---|---|
| VERSION : String = 1.0.0 [static]
Current API Version
| GameCenter | ||
| gameCenter | property |
gameCenter:GameCenter [read-only] The current instance of the GameCenter singelton. You must call GameCenter.create() before this property is available.
public static function get gameCenter():GameCenter| GameCenter | () | Constructor |
public function GameCenter(logCallback:Function = null)Do not call this directly; use GameCenter.create() to initialize or GameCenter.gameCenter to get current instance.
ParameterslogCallback:Function (default = null) |
| authenticateLocalUser | () | method |
public function authenticateLocalUser():voidSends request to authenticate (log in) the user on GameCenter. On completion, either GameCenterEvent.AUTH_SUCCEEDED or GameCenterErrorEvent.AUTH_FAILED will be dispatched.
Error — if the current device does not support GameCenter.
|
See also
| create | () | method |
public static function create():GameCenterInitializes the GameCenter Extension. You should check GameCenter.isSupported first to ensure the platform is iOS. GameCenter is a Singleton and you may have only one instance. After creation, you may access the instance through the static property GameCenter.gameCenter .
ReturnsGameCenter — initialized instance of GameCenter extension interface.
|
Error — if GameCenter has already been initialized.
|
| dispose | () | method |
public function dispose():voidDispose of Context
| getPlayerAlias | () | method |
public function getPlayerAlias():StringGets the Alias (human-readable name) of the current logged in player.
ReturnsString — the alias of the current logged in player.
|
| getPlayerID | () | method |
public function getPlayerID():StringGet the unique identifier of the current logged in player.
ReturnsString — the GameCenter player ID of the current logged in player.
|
| isGameCenterAvailable | () | method |
public function isGameCenterAvailable():BooleanChecks if GameCenter is available on the running device. GameCenter requires at least iOS 4.1; your app will run on iOS 4.0, but will not be able to use GameCenter features.
ReturnsBoolean — true if the current device supports GameCenter (iOS 4.1+)
|
| isPlayerUnderage | () | method |
public function isPlayerUnderage():BooleanCheck if the current logged in player is 'underage' in the GameCenter database. Apple may restrict some features for underage players.
ReturnsBoolean — true if the currently authenticated player is underage.
|
| isSupported | () | method |
public static function isSupported():BooleanChecks if the current platform supports GameCenter. Note that this only determines whether the app is running under iOS (as opposed to Android, Windows, etc.), and will NOT tell you whether the particular device's iOS has GameCenter installed. Use this call before initializing GameCenter in order to confirm that you are on iOS. (So that you can avoid initializing GameCenter on an unsupported platform when building a multi-platform app.) After initialization, you can check if the particular iOS device has GameCenter installed with the call GameCenter.gameCenter.isGameCenterAvailable().
ReturnsBoolean — true if GameCenter is supported; false otherwise.
|
See also
| isUserAuthenticated | () | method |
public function isUserAuthenticated():BooleanCheck if the user is currently logged in and authenticated with GameCenter.
ReturnsBoolean — true if the user is authenticated with GameCenter.
|
Error — if the current device does not support GameCenter.
|
| reportAchievement | () | method |
public function reportAchievement(achievementId:String, completion:Number):voidReport achievement progress to the GameCenter server. Either GameCenterEvent.ACHIEVEMENT_REPORT_SUCCEEDED or GameCenterErrorEvent.ACHIEVEMENT_REPORT_FAILED will be dispatched. Note that iOS will not automatically display a banner when an achievement is earned; you should listen for GameCenterEvent.ACHIEVEMENT_REPORT_SUCCEEDED show a banner there if you wish. It is best practice to store the state of the user's achievements in the case of a failed report, so you may try again later to report the progress. It is best practice be sure the user is logged in (via isUserAuthenticated()) prior to reporting a score.
Parameters
achievementId:String — the id of the achievement you are reporting; this is set in iTunes Connect when you define the achievements. Case-sensitive.
| |
completion:Number — a value from 0.0-100.0, representing the percentage to which this achievement has been completed.
|
Error — if the current device does not support GameCenter.
| |
Error — if completion argument is not in the range of 0 to 100.
|
See also
| reportScoreForCategory | () | method |
public function reportScoreForCategory(score:int, category:String):voidReport a score to the GameCenter server. On completion, either GameCenterEvent.SCORE_REPORT_SUCCEEDED or GameCenterErrorEvent.SCORE_REPORT_FAILED will be dispatched. It is best practice be sure the user is logged in (via isUserAuthenticated()) prior to reporting a score.
Parameters
score:int — the score you would like to report for the current user.
| |
category:String — the id of the leaderboard for which you wish to report score; this is set in iTunes Connect when you define the leaderboard. Case-sensitive.
|
Error — if the current device does not support GameCenter.
|
See also
| resetAchievements | () | method |
public function resetAchievements():voidSends a request to reset the user's achievements in this game. Once complete, either GameCenterEvent.ACHIEVEMENT_RESET_SUCCEEDED or GameCenterErrorEvent.ACHIEVEMENT_RESET_FAILED will be dispatched. Note that iOS will not ask the user to confirm they want to reset their progress; it is up to you to dislay a confirmation modal if you wish.
Error — if the current device does not support GameCenter.
|
See also
| showAchievements | () | method |
public function showAchievements():voidShows the iOS Achievements view for the user on GameCenter. Once the view is displayed, GameCenterEvent.ACHIEVEMENT_VIEW_OPENED will be dispatched; on dismissal, GameCenterEvent.ACHIEVEMENT_VIEW_CLOSED will be dispatched. You may use these events to pause and resume your own game UI interactions as appropriate.
Error — if the current device does not support GameCenter.
|
See also
| showLeaderboardForCategory | () | method |
public function showLeaderboardForCategory(category:String):voidShows the iOS Leaderboard view for the user on GameCenter. Once the view is displayed, GameCenterEvent.LEADERBOARD_VIEW_OPENED will be dispatched; on dismissal, GameCenterEvent.LEADERBOARD_VIEW_CLOSED will be dispatched. You may use these events to pause and resume your own game UI interactions as appropriate.
Parameters
category:String — the category ID of the leaderboard you wish to display; this is set in iTunes Connect when you define the leaderboard. Case-sensitive.
|
Error — if the current device does not support GameCenter.
|
See also
| ACHIEVEMENT_REPORT_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterErrorEventDispatched when an achievement submission failed after a call to gameCenter.reportAchievement()
| ACHIEVEMENT_REPORT_SUCCEEDED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when an achievement submission succeeded after a call to gameCenter.reportAchievement()
| ACHIEVEMENT_RESET_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterErrorEventDispatched when an achievement reset failed after a call to gameCenter.resetAchievements()
| ACHIEVEMENT_RESET_SUCCEEDED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterErrorEventDispatched when an achievement reset succeeded after a call to gameCenter.resetAchievements()
| ACHIEVEMENTS_VIEW_CLOSED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when the default achievement view has been dismissed by the user.
| ACHIEVEMENTS_VIEW_OPENED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when the default leaderboard view has been displayed, after a call to gameCenter.showAchievements()
| AUTH_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterErrorEventDispatched when authentication of the local user has failed after a call to gameCenter.authenticateLocalUser()
| AUTH_SUCCEEDED | Event |
com.milkmangames.nativeextensions.ios.GameCenterEventDispatched when the user has been successfully authorized after a call to gameCenter.authenticateLocalUser()
| LEADERBOARD_VIEW_CLOSED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when the default leaderboard view has been dismissed by the user.
| LEADERBOARD_VIEW_OPENED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when the default leaderboard view has been displayed, after a call to gameCenter.showLeaderboardForCategory()
| SCORE_REPORT_FAILED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterErrorEventDispatched when a score submission failed after a call to gameCenter.reportScoreForCategory()
| SCORE_REPORT_SUCCEEDED | Event |
com.milkmangames.nativeextensions.ios.events.GameCenterEventDispatched when a score submission succeeded after a call to gameCenter.reportScoreForCategory()
| VERSION | Constant |
public static const VERSION:String = 1.0.0Current API Version