Skip to content

Commit

Permalink
Merge pull request freshplanet#27 from freshplanet/feature/get-leader…
Browse files Browse the repository at this point in the history
…board

Feature/get leaderboard
  • Loading branch information
FreshTiti committed Oct 3, 2014
2 parents 7717eb8 + 92e5507 commit 7cf33c0
Show file tree
Hide file tree
Showing 298 changed files with 3,902 additions and 747 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.freshplanet.ane.AirGooglePlayGames
{
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.StatusEvent;
import flash.external.ExtensionContext;
Expand Down Expand Up @@ -120,6 +121,12 @@ package com.freshplanet.ane.AirGooglePlayGames
return name;
}

public function getLeaderboard( leaderboardId:String ):void
{
if (AirGooglePlayGames.isSupported)
_context.call("getLeaderboard", leaderboardId );
}


// --------------------------------------------------------------------------------------//
// //
Expand All @@ -136,7 +143,7 @@ package com.freshplanet.ane.AirGooglePlayGames
private function onStatus( event : StatusEvent ) : void
{
trace("[AirGooglePlayGames]", event);
var e:AirGooglePlayGamesEvent;
var e:Event;
if (event.code == "ON_SIGN_IN_SUCCESS")
{
e = new AirGooglePlayGamesEvent(AirGooglePlayGamesEvent.ON_SIGN_IN_SUCCESS);
Expand All @@ -146,10 +153,20 @@ package com.freshplanet.ane.AirGooglePlayGames
} else if (event.code == "ON_SIGN_OUT_SUCCESS")
{
e = new AirGooglePlayGamesEvent(AirGooglePlayGamesEvent.ON_SIGN_OUT_SUCCESS);
} else if (event.code == "ON_LEADERBOARD_LOADED")
{
var jsonArray:Array = JSON.parse( event.level ) as Array;
if( jsonArray ) {
var leaderboard:GSLeaderboard = GSLeaderboard.fromJSONObject( jsonArray );
if( leaderboard )
e = new AirGooglePlayGamesLeaderboardEvent(AirGooglePlayGamesLeaderboardEvent.LEADERBOARD_LOADED, leaderboard);
}
} else if (event.code == "ON_LEADERBOARD_FAILED")
{
e = new Event(AirGooglePlayGamesLeaderboardEvent.LEADERBOARD_LOADING_FAILED );
}

if (e)
{
if (e) {
this.dispatchEvent(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.freshplanet.ane.AirGooglePlayGames
{
import flash.events.Event;

public class AirGooglePlayGamesLeaderboardEvent extends Event
{

public static const LEADERBOARD_LOADED:String = "AirGooglePlayGamesLeaderboardEvent.leaderboard_loaded";
public static const LEADERBOARD_LOADING_FAILED:String = "AirGooglePlayGamesLeaderboardEvent.leaderboard_loading_failed";

public var leaderboard:GSLeaderboard;

public function AirGooglePlayGamesLeaderboardEvent( type:String, leaderboard:GSLeaderboard )
{

super( type );

this.leaderboard = leaderboard;

}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.freshplanet.ane.AirGooglePlayGames
{
public class GSLeaderboard
{

private var _scores:Vector.<GSScore>;
public function get scores():Vector.<GSScore> { return _scores.slice(); }

public function GSLeaderboard()
{

_scores = new <GSScore>[];

}

public static function fromJSONObject( jsonArray:Array ):GSLeaderboard {

var leaderboard:GSLeaderboard = new GSLeaderboard();

for each ( var scoreObject:Object in jsonArray ) {
leaderboard._scores.push( GSScore.fromJSONObject( scoreObject ) );
}

return leaderboard;

}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.freshplanet.ane.AirGooglePlayGames
{
public class GSPlayer
{

private var _id:String;
public function get id():String { return _id; }
private var _displayName:String;
public function get displayName():String { return _displayName; }
private var _picture:String;
public function get picture():String { return _picture; }

public function GSPlayer( id:String, displayName:String, picture:String = null )
{

_id = id;
_displayName = displayName;
_picture = picture;

}

public static function fromJSONObject( jsonObject:Object ):GSPlayer {

if( jsonObject.id == null ) return null;

return new GSPlayer( jsonObject.id, jsonObject.displayName, jsonObject.picture );

}

}
}
33 changes: 33 additions & 0 deletions actionscript/src/com/freshplanet/ane/AirGooglePlayGames/GSScore.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.freshplanet.ane.AirGooglePlayGames
{
public class GSScore
{

private var _value:int;
public function get value():int { return _value; }
private var _rank:int;
public function get rank():int { return _rank; }
private var _player:GSPlayer;
public function get player():GSPlayer { return _player; }

public function GSScore( value:int, rank:int, player:GSPlayer )
{

_value = value;
_rank = rank;
_player = player;

}

public static function fromJSONObject( jsonObject:Object ):GSScore {

var player:GSPlayer = GSPlayer.fromJSONObject( jsonObject.player );

if( player == null ) return null;

return new GSScore( jsonObject.value, jsonObject.rank, player );

}

}
}
9 changes: 9 additions & 0 deletions android/google-play-services_lib/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4242030"
android:versionName="4.2.42 (1018832-030)" >

<uses-sdk android:minSdkVersion="9"/>

</manifest>
17 changes: 17 additions & 0 deletions android/google-play-services_lib/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Library Project including Google Play services client jar.

This can be used by an Android project to use the API's provided
by Google Play services.

There is technically no source, but the src folder is necessary
to ensure that the build system works. The content is actually
located in the libs/ directory.


USAGE:

Make sure you import this Android library project into your IDE
and set this project as a dependency.

Note that if you use proguard, you will want to include the
options from proguard.txt in your configuration.
9 changes: 9 additions & 0 deletions android/google-play-services_lib/bin/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4242030"
android:versionName="4.2.42 (1018832-030)" >

<uses-sdk android:minSdkVersion="9"/>

</manifest>
108 changes: 108 additions & 0 deletions android/google-play-services_lib/bin/R.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
int attr adSize 0x7f010000
int attr adSizes 0x7f010001
int attr adUnitId 0x7f010002
int attr cameraBearing 0x7f010004
int attr cameraTargetLat 0x7f010005
int attr cameraTargetLng 0x7f010006
int attr cameraTilt 0x7f010007
int attr cameraZoom 0x7f010008
int attr mapType 0x7f010003
int attr uiCompass 0x7f010009
int attr uiRotateGestures 0x7f01000a
int attr uiScrollGestures 0x7f01000b
int attr uiTiltGestures 0x7f01000c
int attr uiZoomControls 0x7f01000d
int attr uiZoomGestures 0x7f01000e
int attr useViewLifecycle 0x7f01000f
int attr zOrderOnTop 0x7f010010
int color common_action_bar_splitter 0x7f030009
int color common_signin_btn_dark_text_default 0x7f030000
int color common_signin_btn_dark_text_disabled 0x7f030002
int color common_signin_btn_dark_text_focused 0x7f030003
int color common_signin_btn_dark_text_pressed 0x7f030001
int color common_signin_btn_default_background 0x7f030008
int color common_signin_btn_light_text_default 0x7f030004
int color common_signin_btn_light_text_disabled 0x7f030006
int color common_signin_btn_light_text_focused 0x7f030007
int color common_signin_btn_light_text_pressed 0x7f030005
int color common_signin_btn_text_dark 0x7f03000a
int color common_signin_btn_text_light 0x7f03000b
int drawable common_signin_btn_icon_dark 0x7f020000
int drawable common_signin_btn_icon_disabled_dark 0x7f020001
int drawable common_signin_btn_icon_disabled_focus_dark 0x7f020002
int drawable common_signin_btn_icon_disabled_focus_light 0x7f020003
int drawable common_signin_btn_icon_disabled_light 0x7f020004
int drawable common_signin_btn_icon_focus_dark 0x7f020005
int drawable common_signin_btn_icon_focus_light 0x7f020006
int drawable common_signin_btn_icon_light 0x7f020007
int drawable common_signin_btn_icon_normal_dark 0x7f020008
int drawable common_signin_btn_icon_normal_light 0x7f020009
int drawable common_signin_btn_icon_pressed_dark 0x7f02000a
int drawable common_signin_btn_icon_pressed_light 0x7f02000b
int drawable common_signin_btn_text_dark 0x7f02000c
int drawable common_signin_btn_text_disabled_dark 0x7f02000d
int drawable common_signin_btn_text_disabled_focus_dark 0x7f02000e
int drawable common_signin_btn_text_disabled_focus_light 0x7f02000f
int drawable common_signin_btn_text_disabled_light 0x7f020010
int drawable common_signin_btn_text_focus_dark 0x7f020011
int drawable common_signin_btn_text_focus_light 0x7f020012
int drawable common_signin_btn_text_light 0x7f020013
int drawable common_signin_btn_text_normal_dark 0x7f020014
int drawable common_signin_btn_text_normal_light 0x7f020015
int drawable common_signin_btn_text_pressed_dark 0x7f020016
int drawable common_signin_btn_text_pressed_light 0x7f020017
int drawable ic_plusone_medium_off_client 0x7f020018
int drawable ic_plusone_small_off_client 0x7f020019
int drawable ic_plusone_standard_off_client 0x7f02001a
int drawable ic_plusone_tall_off_client 0x7f02001b
int id hybrid 0x7f040004
int id none 0x7f040000
int id normal 0x7f040001
int id satellite 0x7f040002
int id terrain 0x7f040003
int integer google_play_services_version 0x7f060000
int string auth_client_needs_enabling_title 0x7f050015
int string auth_client_needs_installation_title 0x7f050016
int string auth_client_needs_update_title 0x7f050017
int string auth_client_play_services_err_notification_msg 0x7f050018
int string auth_client_requested_by_msg 0x7f050019
int string auth_client_using_bad_version_title 0x7f050014
int string common_google_play_services_enable_button 0x7f050006
int string common_google_play_services_enable_text 0x7f050005
int string common_google_play_services_enable_title 0x7f050004
int string common_google_play_services_install_button 0x7f050003
int string common_google_play_services_install_text_phone 0x7f050001
int string common_google_play_services_install_text_tablet 0x7f050002
int string common_google_play_services_install_title 0x7f050000
int string common_google_play_services_invalid_account_text 0x7f05000c
int string common_google_play_services_invalid_account_title 0x7f05000b
int string common_google_play_services_network_error_text 0x7f05000a
int string common_google_play_services_network_error_title 0x7f050009
int string common_google_play_services_unknown_issue 0x7f05000d
int string common_google_play_services_unsupported_date_text 0x7f050010
int string common_google_play_services_unsupported_text 0x7f05000f
int string common_google_play_services_unsupported_title 0x7f05000e
int string common_google_play_services_update_button 0x7f050011
int string common_google_play_services_update_text 0x7f050008
int string common_google_play_services_update_title 0x7f050007
int string common_signin_button_text 0x7f050012
int string common_signin_button_text_long 0x7f050013
int[] styleable AdsAttrs { 0x7f010000, 0x7f010001, 0x7f010002 }
int styleable AdsAttrs_adSize 0
int styleable AdsAttrs_adSizes 1
int styleable AdsAttrs_adUnitId 2
int[] styleable MapAttrs { 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010 }
int styleable MapAttrs_cameraBearing 1
int styleable MapAttrs_cameraTargetLat 2
int styleable MapAttrs_cameraTargetLng 3
int styleable MapAttrs_cameraTilt 4
int styleable MapAttrs_cameraZoom 5
int styleable MapAttrs_mapType 0
int styleable MapAttrs_uiCompass 6
int styleable MapAttrs_uiRotateGestures 7
int styleable MapAttrs_uiScrollGestures 8
int styleable MapAttrs_uiTiltGestures 9
int styleable MapAttrs_uiZoomControls 10
int styleable MapAttrs_uiZoomGestures 11
int styleable MapAttrs_useViewLifecycle 12
int styleable MapAttrs_zOrderOnTop 13
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions android/google-play-services_lib/bin/jarlist.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** Automatically generated file. DO NOT MODIFY */
package com.google.android.gms;

public final class BuildConfig {
public final static boolean DEBUG = true;
}

0 comments on commit 7cf33c0

Please sign in to comment.