|
AmazonGameCircle Native Extension for Adobe Air This AmazonGameCircle ANE add supprt to using Amazon Game Circle with Adobe Air. Supports Android only. About Amazon Game Circle?https://developer.amazon.com/public/apis/engage/gamecircle Changelog1.1.0 add methods for request leaderboards data. add methods for request achievements data. add showGameCircle(), showSignInPage()
1.0.1 - add serviceReady to indicate the service is ready.
Install the libraryAdd the AmazonGameCircle-ANE library to your project. In Flash Professional CS6: - Create a new mobile project
- Choose File > PublishSettings...
- Select the wrench icon next to 'Script' for 'ActionScriptSettings'
- Select the Library Path tab.
- Click 'Browse for Native Extension(ANE) File' and select the Mopub.ane file.
In Flash Builder 4.6: - Goto Project Properties
- Select Native Extensions under Actionscript Build Path
- Choose Add ANE... and navigate to the Mopub.ane file
- Select Actionscript Build Packaging > Google Android or Apple IOS
- Select the Native Extensions tab, and click the 'Package' check box next to the extension
In Flash Professional CS5.5 or Lower: - Select File>PublishSettings>Flash>ActionScript 3.0 Settings
- Select External Library Path
- Click Browseto SWC File
- Select the Mopub.swc
In Flash Builder 4.5: - Goto Project Properties
- Select Action Script Build Path
- Select Add Swc
- Navigate to Mopub.swc and choose External Library type
In FlashDevelop: - Copy the Mopub.swc file to your project folder.
- In the explorer panel, right click the .swc and select Add to Library.
- Right-click the swc file in the explorer, choose Options, and select External Library
Add the ActionscriptImport the library
- import digicrafts.extensions.AmazonGameCircle;
- import digicrafts.extensions.events.AmazonGameCircleEvent;
复制代码 Initialize.
- AmazonGameCircle.getInstance().addEventListener(AmazonGameCircleEvent.SERVICE_READY, handleAmazonGameCircleEvent);
- AmazonGameCircle.getInstance().addEventListener(AmazonGameCircleEvent.SERVICE_NOT_READY, handleAmazonGameCircleEvent);
- AmazonGameCircle.initialize();
- private function handleAmazonGameCircleEvent(e:AmazonGameCircleEvent):void
- {
- switch (e.type){
- case AmazonGameCircleEvent.SERVICE_READY:
- // Game circle ready
- break;
- case AmazonGameCircleEvent.SERVICE_NOT_READY:
- // Game circle not ready
- break;
- }
- }
复制代码 Submit Score.
- AmazonGameCircle.submitScore(leaderboard_id, value);
- private function handleAmazonGameCircleLeaderboardEvent(e:AmazonGameCircleEvent):void
- {
- switch (e.type){
- case AmazonGameCircleEvent.SUBMIT_SCORE_COMPLETE:
- break;
- case AmazonGameCircleEvent.SUBMIT_SCORE_ERROR:
- break;
- }
- }
复制代码 Show leaderboard.
- AmazonGameCircle.showLeaderboard(leaderboard_id);
复制代码 Update Achievements.
- AmazonGameCircle.updateAchievement(achievementId,progress);
复制代码 Show Achievements.
- AmazonGameCircle.showAchievements();
复制代码 Setup for AndroidUpdate Your Application DescriptorYou'll need to be using the AIR 4.0 SDK or higher, include the extension in your Application Descriptor XML, and update the Android Manifest Additions with some settings.Add the following settings before<application> tag. - <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
复制代码Add the following settings in <application> tag. Remember to replace your "YOUR.APP.PACKAGE.ID". - <activity android:name="com.amazon.ags.html5.overlay.GameCircleUserInterface"
- android:theme="@style/GCOverlay" android:hardwareAccelerated="false"></activity>
- <activity
- android:name="com.amazon.identity.auth.device.authorization.AuthorizationActivity"
- android:theme="@android:style/Theme.NoDisplay"
- android:allowTaskReparenting="true"
- android:launchMode="singleTask">
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.BROWSABLE" />
- <data android:host="YOUR.APP.PACKAGE.ID" android:scheme="amzn" />
- </intent-filter>
- </activity>
- <activity android:name="com.amazon.ags.html5.overlay.GameCircleAlertUserInterface"
- android:theme="@style/GCAlert" android:hardwareAccelerated="false"></activity>
- <receiver
- android:name="com.amazon.identity.auth.device.authorization.PackageIntentReceiver"
- android:enabled="true">
- <intent-filter>
- <action android:name="android.intent.action.PACKAGE_INSTALL" />
- <action android:name="android.intent.action.PACKAGE_ADDED" />
- <data android:scheme="package" />
- </intent-filter>
- </receiver>
复制代码 TODO-Allow initializing with different Games Feature-Supporting Whispersync Game we made using this ANEFlippy DayRecycle RangersDiamond SpeedyDeveloperThe software is developed by Digicrafts. http://www.facebook.com/DigicraftsComponentshttp://www.digicrafts.com.hk/componentshttp://www.html5components.comLicenseThis project is licensed under the BSD license
相关链接:
https://github.com/digicrafts/AmazonGameCircle-ANE
|