question

BusyMom avatar image
BusyMom asked

Game Circle initialization

I cant seem to get the sample code to work what am I doing wrong? void InitGameCircle() { //reference to the agsClient AmazonGamesClient agsClient; AmazonGamesCallback callback = new AmazonGamesCallback() { @Override public void onServiceNotReady(AmazonGamesStatus status) { //unable to use service } @Override public void onServiceReady(AmazonGamesClient amazonGamesClient) { agsClient = amazonGamesClient; //ready to use GameCircle } }; //list of features your game uses (in this example, achievements and leaderboards) EnumSet myGameFeatures = EnumSet.of( AmazonGamesFeature.Achievements, AmazonGamesFeature.Leaderboards); @Override public void onResume() { super.onResume(); AmazonGamesClient.initialize(this, callback, myGameFeatures); Debug.Log("InitGameCirlce"); }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi BusyMom, Thank you for writing to us. I just sent you a working sample code to your registered email address. In order to integrate GameCircle in your app, you have do couple of things than writing the initializing the sdk. Please follow the guide lines in the below link and use the sample code (that I sent you) as a reference. https://developer.amazon.com/sdk/gamecircle.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
Thanks for the reply. I am using Unity and I have imported the game circle package. I am having trouble getting Game Circle to initialize. I can't even get the test scene to pull the leadboards or achievements I have set up. I have look at the documentation online as it releates to unity but I don't know what I am doing wrong. Thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Can you please check that you have gone through Section 2 in below page? https://developer.amazon.com/sdk/gamecircle/documentation/unity-gamecircle-setup.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
Yes I have done that
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
I am having trouble initializing Game Circle in c#. This is what I got so far using UnityEngine; using System.Collections; public class JsHelperAmazon : MonoBehaviour { private string leaderBoardId = "Ultimate_Golf_Tour"; private string TEST_ACHIEVEMENT_1_ID = "Eagle"; private string TEST_ACHIEVEMENT_2_ID = "Birdie"; private string TEST_ACHIEVEMENT_3_ID = "Par"; private string TEST_ACHIEVEMENT_4_ID = "Bogey"; private string TEST_ACHIEVEMENT_5_ID = "Double_Bogey"; private string TEST_ACHIEVEMENT_6_ID = "Triple_Bogey"; //reference to the agsClient AmazonGamesClient AGSClient; //-------------------------------------- // INITIALIZE //-------------------------------------- bool isServiceReady = AGSClient.IsServiceReady(); AGSClient.ServiceReadyEvent += serviceReadyHandler; AGSClient.ServiceNotReadyEvent += serviceNotReadyHandler; bool usesLeaderboards = true; bool usesAchievements = true; bool usesWhispersync = true; AGSClient.Init (usesLeaderboards, usesAchievements, usesWhispersync); private void serviceNotReadyHandler (string error) { Debug.Log("Service is not ready"); } private void serviceReadyHandler () { Debug.Log("Service is ready"); } //list of features your game uses (in this example, achievements and leaderboards) EnumSet myGameFeatures = EnumSet.of( AmazonGamesFeature.Achievements, AmazonGamesFeature.Leaderboards); private void SubmitScore(int val) { Debug.Log("SubmitScore"); LeaderboardsClient lbClient = agsClient.getLeaderboardsClient(); AGResponseHandle handle = lbClient.submitScore(leaderBoardId, longScoreValue); } private void SubmitAchievement(string data) { string[] arr; arr = data.Split("|" [0]); float percent = System.Convert.ToSingle(arr[0]); string achievementId = arr[1]; Debug.Log("SubmitAchievement: " + achievementId + " " + percent.ToString()); AchievementsClient acClient = agsClient.getAchievementsClient(); AGResponseHandle handle = acClient.updateProgress(achievementId, percent); } }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
The device log can be viewed by using the logcat console. Use the adb application found in Android SDK/platform-tools directory with a trailing logcat parameter: $ adb logcat Another way to inspect the LogCat is to use the Dalvik Debug Monitor Server (DDMS). DDMS can be started either from Eclipse or from inside the Android SDK/tools. DDMS also provides a number of other debug related tools. and also cross check for api key In Unity, click Assets, click Plugins, click Android, and then select assets. Open api_key.txt and replace the text with your API key. Can you give the error displayed in logcat for not initializing.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
The errors I am getting are related to code referenced above. Assets/Scripts/JsHelperAmazon.cs(28,46): error CS1519: Unexpected symbol `+=' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(28,67): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(29,41): error CS1519: Unexpected symbol `+=' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(29,65): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(34,20): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(34,37): error CS1519: Unexpected symbol `,' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(34,55): error CS1519: Unexpected symbol `,' in class, struct, or interface member declaration Assets/Scripts/JsHelperAmazon.cs(34,72): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration Yes I have edited the api_key.txt I think everything is set up right my problem is with the code to initialize Game Circle in c#
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
You need to wrap initialization part of the code in some method, e.g. Awake or Start. void Start () { Debug.Log("XX Lets Start Game Circle"); AGSClient.ServiceReadyEvent += serviceReadyHandler; AGSClient.ServiceNotReadyEvent += serviceNotReadyHandler; bool usesLeaderboards = true; bool usesAchievements = true; bool usesWhispersync = true; AGSClient.Init (usesLeaderboards, usesAchievements, usesWhispersync); }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
I tried that and I Get the following errors Assets/Scripts/JSHelperAmazon.cs(25,32): error CS0103: The name `serviceReadyHandler' does not exist in the current context Assets/Scripts/JSHelperAmazon.cs(26,35): error CS0103: The name `serviceNotReadyHandler' does not exist in the current context Assets/Scripts/JSHelperAmazon.cs(31,1): error CS0103: The name `AGSClient' does not exist in the current context Assets/Scripts/JSHelperAmazon.cs(38,9): error CS0103: The name `super' does not exist in the current context Assets/Scripts/JSHelperAmazon.cs(39,9): error CS0103: The name `AmazonGamesClient' does not exist in the current context Assets/Scripts/JSHelperAmazon.cs(49,9): error CS0246: The type or namespace name `LeaderboardsClient' could not be found. Are you missing a using directive or an assembly reference? Assets/Scripts/JSHelperAmazon.cs(50,9): error CS0246: The type or namespace name `AGResponseHandle`1' could not be found. Are you missing a using directive or an assembly reference? Assets/Scripts/JSHelperAmazon.cs(61,9): error CS0246: The type or namespace name `AchievementsClient' could not be found. Are you missing a using directive or an assembly reference? Assets/Scripts/JSHelperAmazon.cs(62,9): error CS0246: The type or namespace name `AGResponseHandle`1' could not be found. Are you missing a using directive or an assembly reference? Thanks for your help I have been trying for weeks to get game circle to initialize with no luck. I was able to get game center on ios working in about a hour. My game is all finished except for the initializing game circle, so please help me finish this off.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

BusyMom avatar image
BusyMom answered
Ok I added the following line //reference to the agsClient AmazonGamesClient agsClient; Now I only get one error Assets/Scripts/JSHelperAmazon.cs(23,1): error CS0246: The type or namespace name `AmazonGamesClient' could not be found. Are you missing a using directive or an assembly reference? How do I reference AmazonGamesClient Should I reference the GameCircle Unity Prefab? Thanks Message was edited by: BusyMom
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.