Created
February 5, 2015 01:53
-
-
Save marchbold/5ef6eccbcf49d426a331 to your computer and use it in GitHub Desktop.
Demonstrates the basic sign in functionality for the Game Services ANE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialisation etc goes here but we add the following event listeners | |
GameServices.service.addEventListener( GameServicesEvent.SIGN_IN_SUCCESS, signInSuccessHandler ); | |
GameServices.service.addEventListener( GameServicesEvent.SIGN_IN_FAILED, signInFailedHandler ); | |
GameServices.service.addEventListener( GameServicesEvent.SIGN_OUT_SUCCESS, signOutSuccessHandler ); | |
... | |
public function signIn():void | |
{ | |
if (!GameServices.service.isSignedIn()) | |
{ | |
GameServices.service.signIn(); | |
} | |
} | |
private function signInSuccessHandler( event:GameServicesEvent ):void | |
{ | |
var player:Player = GameServices.service.getPlayer(); | |
if (player != null) | |
{ | |
trace( "player :: "+ "["+player.id+"]" +player.displayName + "(" + player.alias + ")" ); | |
} | |
// | |
// If you are using multiplayer functionality then this | |
// is the best time to register for notifications from | |
// multiplayer game invitations and match updates. | |
GameServices.service.register(); | |
} | |
private function signInFailedHandler( event:GameServicesEvent ):void | |
{ | |
} | |
private function signOutSuccessHandler( event:GameServicesEvent ):void | |
{ | |
} | |
// com.distriqt.GameServices |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment