private void Initialize() { if (scoreBoardService == null) { scoreBoardService = serviceAPI.BuildScoreBoardService(); } }
/// <summary> /// Test Method for saving the user score in App42 Cloud. /// </summary> public static void SaveUserScore() { /// Enter your Public Key and Private Key Here in Constructor. You can /// get it once you will create a app in app42 console. ServiceAPI sp = new ServiceAPI("<Your_API_Key>", "<Your_Secret_Key>"); String gameName = "PokerGame"; String userName = "******"; double gameScore = 3500; String description = "description"; /// Create Instance of ScoreBoard Service ScoreBoardService scoreBoardService = sp.BuildScoreBoardService(); GameService gameService = sp.BuildGameService(); try { Game saveScore = scoreBoardService.SaveUserScore(gameName,userName,gameScore); Console.WriteLine("gameName is " + saveScore.GetName()); for (int i = 0; i < saveScore.GetScoreList().Count; i++) { Console.WriteLine("userName is : " + saveScore.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + saveScore.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + saveScore.GetScoreList()[i].GetScoreId()); } } catch (App42Exception ex) { /// Exception Caught /// Do exception Handling of Score Board Service functions. if (ex.GetAppErrorCode() == 3002) { Game createGame = gameService.CreateGame(gameName, description); Console.WriteLine("gameName is " + createGame.GetName()); Game game = scoreBoardService.SaveUserScore(gameName, userName, gameScore); Console.WriteLine("gameName is " + game.GetName()); for (int i = 0; i < game.GetScoreList().Count; i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } else if (ex.GetAppErrorCode() == 1401) { Console.WriteLine("Please verify your API_KEY and SECRET_KEY From AppHq Console (Apphq.shephertz.com)."); } else { Console.WriteLine("Exception is : " + ex.ToString()); } } Console.ReadKey(); }
/// <summary> /// Test Method for saving the user score in App42 Cloud. /// </summary> public static void SaveUserScore() { /// Enter your Public Key and Private Key Here in Constructor. You can /// get it once you will create a app in app42 console. ServiceAPI sp = new ServiceAPI("<Your_API_Key>", "<Your_Secret_Key>"); String gameName = "PokerGame"; String userName = "******"; double gameScore = 3500; String description = "description"; /// Create Instance of ScoreBoard Service ScoreBoardService scoreBoardService = sp.BuildScoreBoardService(); GameService gameService = sp.BuildGameService(); try { Game saveScore = scoreBoardService.SaveUserScore(gameName, userName, gameScore); Console.WriteLine("gameName is " + saveScore.GetName()); for (int i = 0; i < saveScore.GetScoreList().Count; i++) { Console.WriteLine("userName is : " + saveScore.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + saveScore.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + saveScore.GetScoreList()[i].GetScoreId()); } } catch (App42Exception ex) { /// Exception Caught /// Do exception Handling of Score Board Service functions. if (ex.GetAppErrorCode() == 3002) { Game createGame = gameService.CreateGame(gameName, description); Console.WriteLine("gameName is " + createGame.GetName()); Game game = scoreBoardService.SaveUserScore(gameName, userName, gameScore); Console.WriteLine("gameName is " + game.GetName()); for (int i = 0; i < game.GetScoreList().Count; i++) { Console.WriteLine("userName is : " + game.GetScoreList()[i].GetUserName()); Console.WriteLine("score is : " + game.GetScoreList()[i].GetValue()); Console.WriteLine("scoreId is : " + game.GetScoreList()[i].GetScoreId()); } } else if (ex.GetAppErrorCode() == 1401) { Console.WriteLine("Please verify your API_KEY and SECRET_KEY From AppHq Console (Apphq.shephertz.com)."); } else { Console.WriteLine("Exception is : " + ex.ToString()); } } Console.ReadKey(); }
public void SaveScore(string userName, double score) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.SaveUserScore("CubeRunner", userName, score, callBack); }
void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1300, 175), success); //======================================{{{{************}}}}================================ if (GUI.Button(new Rect(470, 160, 200, 30), "CreateGame")) { App42Log.SetDebug(true); gameService = sp.BuildGameService(); // Initializing ScoreBoard Service. gameService.CreateGame(cons.gameName, cons.description, callBack); } //======================================{{{{************}}}}================================ if (GUI.Button(new Rect(50, 200, 200, 30), "SaveUserScore")) { App42Log.SetDebug(true); scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.SaveUserScore(cons.gameName, cons.userName, userScore, callBack); } //======================================{{{{************}}}}================================= if (GUI.Button(new Rect(260, 200, 200, 30), "GetScoresByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetScoresByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(470, 200, 200, 30), "GetHighestScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetHighestScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(680, 200, 200, 30), "GetLowestScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetLowestScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(890, 200, 200, 30), "GetTopRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopRankings(cons.gameName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(50, 250, 200, 30), "GetAverageScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetAverageScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(260, 250, 200, 30), "GetLastScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetLastScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(470, 250, 200, 30), "GetTopRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopRankings(cons.gameName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(680, 250, 200, 30), "GetTopNRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankings(cons.gameName, max, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(890, 250, 200, 30), "GetTopNRankers")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankers(cons.gameName, max, callBack); } }
void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1300, 175), success); //========================================================================= if (GUI.Button(new Rect(50, 200, 200, 30), "All Games")) { string gameName = "3DSnake"; ScoreBoardService scoreBoardService = sp.BuildScoreBoardService(); //scoreBoardService.GetTopRankings(gameName, gameCallback); scoreBoardService.SaveUserScore(gameName, "raita", 1, gameCallback); //userService = sp.BuildUserService (); // Initializing UserService. //userService.CreateUser (cons.userName, password, cons.emailId, callBack); } //========================================================================= if (GUI.Button(new Rect(260, 200, 200, 30), "Get User")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetUser(cons.userName, callBack); } //========================================================================= if (GUI.Button(new Rect(470, 200, 200, 30), "Get All Users")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetAllUsers(callBack); } //========================================================================= if (GUI.Button(new Rect(680, 200, 200, 30), "Update Email")) { userService = sp.BuildUserService(); // Initializing UserService. userService.UpdateEmail(cons.userName, cons.emailId, callBack); } //========================================================================= if (GUI.Button(new Rect(890, 200, 200, 30), "Delete User")) { userService = sp.BuildUserService(); // Initializing UserService. userService.DeleteUser(cons.userName, callBack); } //========================================================================= if (GUI.Button(new Rect(50, 250, 200, 30), "Authenticate User")) { userService = sp.BuildUserService(); // Initializing UserService. userService.Authenticate(cons.userName, password, callBack); } //========================================================================= if (GUI.Button(new Rect(260, 250, 200, 30), "Change UserPassword")) { userService = sp.BuildUserService(); // Initializing UserService. userService.ChangeUserPassword(cons.userName, password, "newPassWord", callBack); } //===================================###################========================================= if (GUI.Button(new Rect(470, 250, 200, 30), "Lock User")) { userService = sp.BuildUserService(); // Initializing UserService. userService.LockUser(cons.userName, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(680, 250, 200, 30), "Unlock User")) { userService = sp.BuildUserService(); // Initializing UserService. userService.UnlockUser(cons.userName, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(890, 250, 200, 30), "Get LockedUsers")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetLockedUsers(callBack); } //===================================###################========================================= if (GUI.Button(new Rect(50, 300, 200, 30), "GetAllUsersByPaging")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetAllUsers(max, offSet, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(260, 300, 200, 30), "GetAllUsersCount")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetAllUsersCount(callBack); } //===================================###################========================================= if (GUI.Button(new Rect(680, 300, 200, 30), "ResetUserPassword")) { userService = sp.BuildUserService(); // Initializing UserService. userService.ResetUserPassword(cons.userName, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(890, 300, 200, 30), "Log out")) { userService = sp.BuildUserService(); // Initializing UserService. userService.Logout(cons.sessionId, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(50, 350, 200, 30), "GetLockedUsersCount")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetLockedUsersCount(callBack); } //===================================###################========================================= if (GUI.Button(new Rect(260, 350, 200, 30), "GetUserByEmailId")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetUserByEmailId(cons.updateEmailId, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(470, 350, 200, 30), "GetLockedUsersByPaging")) { userService = sp.BuildUserService(); // Initializing UserService. userService.GetLockedUsers(max, offSet, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(680, 350, 200, 30), "CreateOrUpdateProfile")) { userService = sp.BuildUserService(); // Initializing UserService. User.Profile profileObj = new User.Profile(createUserObj); profileObj.SetCountry("India"); profileObj.SetCity("GGN"); profileObj.SetFirstName("Akshay"); profileObj.SetLastName("Mishra"); profileObj.SetHomeLandLine("1234567890"); profileObj.SetMobile("12345678900987654321"); profileObj.SetOfficeLandLine("0987654321"); profileObj.SetSex(UserGender.MALE); profileObj.SetState("UP"); userService.CreateOrUpdateProfile(createUserObj, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(890, 350, 200, 30), "CreateUserWithRole")) { userService = sp.BuildUserService(); // Initializing UserService. IList <string> roleList = new List <string>(); roleList.Add("Admin"); roleList.Add("Manager"); roleList.Add("Programmer"); roleList.Add("Tester"); userService.CreateUser(cons.userName, password, cons.emailId, roleList, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(50, 400, 200, 30), "AssignRoles")) { userService = sp.BuildUserService(); // Initializing UserService. IList <string> roleList = new List <string>(); roleList.Add("Designer"); roleList.Add("Architect"); userService.AssignRoles(cons.userName, roleList, callBack); } }
void Start () { api = new ServiceAPI(API_KEY, SECRET_KEY); scoreBoardService = api.BuildScoreBoardService(); }
void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1300, 175), success); //======================================{{{{************}}}}================================ if (GUI.Button(new Rect(50, 200, 200, 30), "SaveUserScore")) { App42Log.SetDebug(true); scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.SaveUserScore(cons.gameName, cons.userName, userScore, callBack); } //======================================{{{{************}}}}================================= if (GUI.Button(new Rect(260, 200, 200, 30), "GetScoresByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetScoresByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(470, 200, 200, 30), "GetHighestScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetHighestScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(680, 200, 200, 30), "GetLowestScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetLowestScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(890, 200, 200, 30), "GetTopRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopRankings(cons.gameName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(50, 250, 200, 30), "GetAverageScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetAverageScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(260, 250, 200, 30), "GetLastScoreByUser")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetLastScoreByUser(cons.gameName, cons.userName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(470, 250, 200, 30), "GetTopRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopRankings(cons.gameName, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(680, 250, 200, 30), "GetTopNRankings")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankings(cons.gameName, max, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(890, 250, 200, 30), "GetTopNRankers")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankers(cons.gameName, max, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(50, 300, 200, 30), "GetTopRankingsByGroup")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. IList <string> userList = new List <string> (); userList.Add(cons.userName); userList.Add(cons.userName1); scoreBoardService.GetTopRankingsByGroup(cons.gameName, userList, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(260, 300, 200, 30), "GetTopNRankersByGroup")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. IList <string> userList = new List <string> (); userList.Add(cons.userName); userList.Add(cons.userName1); scoreBoardService.GetTopNRankersByGroup(cons.gameName, userList, callBack); } //======================================{{{{************}}}}========================================== if (GUI.Button(new Rect(470, 300, 200, 30), "EditScoreValueById")) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. IList <string> userList = new List <string> (); userList.Add(cons.userName); userList.Add(cons.userName1); scoreBoardService.EditScoreValueById(cons.scoreId, userScore, callBack); } }
void RetrieveScores() { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankings("CubeRunner", 10, callBack); }
public static ScoreBoardService GetScoreService(ServiceAPI sp) { return sp.BuildScoreBoardService(); }
// Use this for initialization void Start() { serviceAPI = new ServiceAPI("fe6cc83f6e00dd566a8244a8fbf88e90e63fd57095c22202f0acbee30f3c8cdc", "c093765482582b568d052b3be7abfa515326dfe371654fd7f9a6693d94565478"); scoreBoardService = serviceAPI.BuildScoreBoardService(); }
void Start() { api = new ServiceAPI(API_KEY, SECRET_KEY); scoreBoardService = api.BuildScoreBoardService(); }