At ShepHertz our focus is to help the App Developers by providing a complete Ecosystem for App and Game developers. With AppWarp Unity SDK being launched and widely accepted next logical step was launching complete backend APIs with Unity. Now using App42 Cloud API, developers can now add social leaderboard, buddy management and you can also save your JSON data on the cloud. These APIs will support iOS, Android and Unity Web Player.
We have created a sample project that illustrates how to integrate App42 APIs and get started. Here is the link to Sample.
Below mentioned are the steps to get started with App42 :
1. Register with App42 platform
2. Create an app once you are on the Quick-start page after registration.
3. If you are already registered, login to AppHQ console and create an app from App Manager–>App Create link.
4. Once the App is created, you will get an ApiKey/SecretKey that you will use in your app for initialization of SDK.
5. Create the game with App42 from Business Service-> Game Service -> Game -> AddGame link.
6. Download the App42 Unity3D SDK.
7. To initialize the App42_Unity3D_SDK. You need to pass in your Api key and Secret key Which you have received in above steps.
1 |
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");
|
8. Initialize the service. To give you an example we have used scoreboard service & buddy service. We will perform some operations with these services.
1 2 |
ScoreBoardService scoreBoardService = api.BuildScoreBoardService(); BuddyService buddyService = api.BuildBuddyService(); |
9. Save the score of the game in cloud in few lines of code and get the response in JSON format :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
String gameName = "Enter the game name"; String userName = "Nick"; double gameScore = 3500; App42Log.SetDebug (true); scoreBoardService.SaveUserScore (gameName, userName, gameScore, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game)response; App42Log.Console ("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console ("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console ("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console ("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException (Exception e) { App42Log.Console("Exception : " + e); } } |
10. Getting the rank of the user :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
String gameName = "Enter the game name"; String userName = "Nick"; App42Log.SetDebug (true); scoreBoardService.GetUserRanking (gameName, userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Game game = (Game)response; App42Log.Console ("gameName is " + game.GetName()); for(int i = 0;i<game.GetScoreList().Count;i++) { App42Log.Console ("userName is : " + game.GetScoreList()[i].GetUserName()); App42Log.Console ("rank is : " + game.GetScoreList()[i].GetRank()); App42Log.Console ("score is : " + game.GetScoreList()[i].GetValue()); App42Log.Console ("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } public void OnException (Exception e) { App42Log.Console("Exception : " + e); } } |
11. Send Request to your Buddy Friends :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
String userName = "Nick"; String buddyName = "John" String message = "Welcome to Shephertz"; buddyService.SendFriendRequest(userName, buddyName, message, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Buddy buddy = (Buddy)response; App42Log.Console("username is : " + buddy.GetUserName()); App42Log.Console("buddyName is : " + buddy.GetBuddyName()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } } |
You can check the complete Documentation and other resources at App42 Cloud API Dev Centre. Do share your feedback with us at support@shephertz.com
Leave A Reply