/// <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 reloadbt() { scoreboardserv.SaveUserScore(gamename, name, highscore, new savehigh()); reload.SetActive(false); render.sprite = error [0]; mudardecena.soundClick(); }
public void SaveUserScore(string pLeaderBoardName, string pUserName, double pScore, App42Response.OnSuccessDelegate pSuccess, App42Response.OnExceptionDelegate pException) { App42Response response = new App42Response(pSuccess, pException); scoreBoardService.SaveUserScore(pLeaderBoardName, pUserName, pScore, response); }
public void registerPlayer() { userUsername = uName.text; userEmail = eMail.text; userPass = password.text; userPassConfirm = passConfirm.text; //clearAll(); if (userUsername != "" && userUsername.Length < 10) { if (userEmail != "") { if (userPass != "" && userPassConfirm != "") { if (userPass == userPassConfirm) { if (ValidateEmail(userEmail) == true) { App42API.Initialize("47675efb1d62deab9e46b9d43795e45c381c341bec9033abb9622fa1a88e5720", "256e86ad5fe1038aaf20334d51c894f1dfa9839996dbaa2e92376141761a07f0"); UserService userService = App42API.BuildUserService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SaveUserScore(gameName, userUsername, gameScore, new UnityCallBack()); userService.CreateUser(userUsername, userPass, userEmail, new UnityCallBack()); passwordCheck.text = ""; } else { clearLabels(); eMailCheck.text = "Invalid Email"; } } else { clearLabels(); passwordCheck.text = "Password do not match"; } } else { clearLabels(); passwordCheck.text = "Enter password"; } } else { clearLabels(); eMailCheck.text = "Enter your email"; } } else { clearLabels(); uNameCheck.text = "Enter username"; } }
// Update is called once per frame void Update() { if (createUser) { createUser = false; UserService userService = App42API.BuildUserService(); userService.CreateUser(userName, "passwordboka", userName + "@gmail.com", new UnityCallBackCreateUser()); } if (saveScore) { saveScore = false; if (PlayerPrefs.HasKey("user") && PlayerPrefs.HasKey("score")) { ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.SaveUserScore("mordenSenta", PlayerPrefs.GetString("user"), PlayerPrefs.GetInt("score"), new UnityCallBackSaveScore()); } } if (getUserRank) { Debug.Log("user klicem"); getUserRank = false; if (PlayerPrefs.HasKey("user")) { ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetUserRanking("mordenSenta", PlayerPrefs.GetString("user"), new UnityCallBackGetUserRank()); Debug.Log("user klicem"); } } if (getTopNRanks) { getTopNRanks = false; ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); scoreBoardService.GetTopNRankers("mordenSenta", 10, new UnityCallBackGetTopRanks()); } if (recivedUser != null) { saveScore = true; PlayerPrefs.SetString("user", userName); recivedUser = null; signIn.SetActive(false); //leaderTabela.SetActive(true); menuSkripta.userVpisan = true; } if (recivedScore != null) { recivedScore = null; getUserRank = true; } }
public static void SaveScore() { LeaderBoardCallBack.fromSaveScore = true; scoreBoardService = App42API.BuildScoreBoardService (); Dictionary<string,object> playerFBProfile = new Dictionary<string, object> (); playerFBProfile.Add ("userId",LeaderBoardCallBack.fbUserId); playerFBProfile.Add ("name",LeaderBoardCallBack.fbUserName); playerFBProfile.Add ("profilePic",LeaderBoardCallBack.fbUserProfilePic); scoreBoardService.AddJSONObject (AppConstants.collectionName,playerFBProfile); scoreBoardService.SaveUserScore(AppConstants.gameName, LeaderBoardCallBack.fbUserId, MyGame.scoreValue,new LeaderBoardCallBack ()); }
public static void SaveScore() { LeaderBoardCallBack.fromSaveScore = true; scoreBoardService = App42API.BuildScoreBoardService(); Dictionary <string, object> playerFBProfile = new Dictionary <string, object> (); playerFBProfile.Add("userId", LeaderBoardCallBack.fbUserId); playerFBProfile.Add("name", LeaderBoardCallBack.fbUserName); playerFBProfile.Add("profilePic", LeaderBoardCallBack.fbUserProfilePic); scoreBoardService.AddJSONObject(AppConstants.collectionName, playerFBProfile); scoreBoardService.SaveUserScore(AppConstants.gameName, LeaderBoardCallBack.fbUserId, MyGame.scoreValue, new LeaderBoardCallBack()); }
public void saveScore() { if (playerName != null && LeveliManeger._instance.getIdScore() == null) { Debug.Log(name); App42Log.SetDebug(true); scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. Debug.Log(LeveliManeger._instance.getSkupniCas() + "skupni cassss"); scoreBoardService.SaveUserScore(gameName, playerName, Mathf.Floor(LeveliManeger._instance.getSkupniCas() * 10), saveScoreCall); } else if (LeveliManeger._instance.getIdScore() != null) { scoreBoardService = sp.BuildScoreBoardService(); scoreBoardService.EditScoreValueById(LeveliManeger._instance.getIdScore(), Mathf.Floor(LeveliManeger._instance.getSkupniCas() * 10), saveScoreCall); } }
public transition() { InitializeComponent(); App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY); dbConn = new SQLiteConnection(DB_PATH); Task task = new Task() { Username = Global.localUsername, Password = Global.password, Email = Global.email, XP = "0", }; // Insert the new task in the Task table. dbConn.Insert(task); scoreBoardService.SaveUserScore("xp_game", Global.localUsername, 0, this); }
void Start() { ranks = new List <Text>(); names = new List <Text>(); score = new List <Text>(); texts = new List <GameObject>(); reload = relo; App42API.Initialize(key, secretkey); gameserv = App42API.BuildGameService(); scoreboardserv = App42API.BuildScoreBoardService(); App42Log.SetDebug(true); gameserv.GetGameByName(gamename, new gameCallback()); if (PlayerPrefs.HasKey("highscore")) { highscore = PlayerPrefs.GetInt("highscore"); } if (PlayerPrefs.HasKey("nome")) { name = PlayerPrefs.GetString("nome"); scoreboardserv.SaveUserScore(gamename, name, highscore, new savehigh()); Debug.Log("salva ai com nome " + name + " e com score " + highscore); } render = GameObject.Find("hsImg").GetComponent <Image>(); error[0] = bla[0]; error[1] = bla[1]; for (int i = 0; i < 20; i++) { texts.Add(GameObject.Find("Text" + (i + 1))); } for (int i = 0; i < texts.Count; i++) { ranks.Add(texts[i].transform.FindChild("ran").GetComponent <Text>()); names.Add(texts[i].transform.FindChild("nome").GetComponent <Text>()); score.Add(texts[i].transform.FindChild("pt").GetComponent <Text>()); } }
public void SaveScore() { FacebookLoginController FBLC = new FacebookLoginController(); FBLC.CheckFacebookLogin(); var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; if(aToken.UserId!=null) userName = PlayerPrefs.GetString("FirstName") + " " + aToken.UserId + ""; // // userName = aToken.UserId + ""; // Name Of The USER Who Wants To Save Score. //FACEBOOK USERNAME OF THE PLAYER int score = PlayerPrefs.GetInt("Highscore"); scoreBoardService = App42API.BuildScoreBoardService (); // Initializing scoreBoardService. scoreBoardService.SaveUserScore (FBgameName, userName, score, this); saveButton = true; Debug.Log("Posted High score"); // } }
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 OnGUI() { // For Setting Up ResponseBox. GUI.Box (new Rect (450, 40, 250, 175), box); GUI.Label (new Rect (470, 50, 200, 200), columnName); GUI.Label (new Rect (470, 70, 200, 200), success); GUI.Label (new Rect (470, 70, 200, 200), playerRank); GUI.Label (new Rect (540, 70, 200, 200), playerName); GUI.Label (new Rect (620, 70, 200, 200), playerScore); if (GUI.Button (new Rect (470, 250, 200, 50), "QUIT")) { Application.Quit(); } // Label For EXCEPTION Message . GUI.Label (new Rect (250, 250, 700, 400), errorLable); //====================================================================================== //---------------------------- Saving User Score.--------------------------------------- //====================================================================================== GUI.Label (new Rect (20, 40, 200, 20), "User Name"); txt_user = GUI.TextField (new Rect (100, 40, 200, 20), txt_user); GUI.Label (new Rect (20, 70, 200, 20), "Score"); txt_score = GUI.TextField (new Rect (100, 70, 200, 20), txt_score, 4); txt_score = Regex.Replace (txt_score, @"[^0-9]", ""); if (GUI.Button (new Rect (100, 100, 200, 50), "Save User Score")) { // Clearing Data From Response Box. success = ""; box = ""; playerRank = ""; playerName = ""; playerScore = ""; columnName = ""; errorLable = ""; if (txt_user == null || txt_user.Equals ("")) { box = "User Name Can Not Be Blank: "; return; } string userName = txt_user; // Name Of The USER Who Wants To Save Score. if (txt_score == null || txt_score.Equals ("")) { box = "Score Value Can Not Be Blank: "; return; } double score = double.Parse (txt_score); // Value Of The Score. scoreBoardService = App42API.BuildScoreBoardService (); // Initializing scoreBoardService. //Saving User Score , By Using App42 Scoreboard Service. //Method Name->SaveUserScore(gameName, userName, score); //Param->gameName(Name Of The Game, Which Is Created By You In AppHQ.) //Param->userName(Name Of The User For Which You Want To Save Score.) //Param->score( Data Type "double" Value Of Score.) //Param->Callback(callback for success/exception.); scoreBoardService.SaveUserScore (cons.gameName, userName, score, this); saveButton = true; } //======================================================================================= //---------------------------Getting Top N Rankers.-------------------------------------- //======================================================================================= GUI.Label (new Rect (850, 40, 200, 20), "Game Name Is :"); GUI.Label (new Rect (950, 41, 200, 20), cons.gameName); GUI.Label (new Rect (850, 70, 200, 20), "Select Max No."); txt_max = (int)GUI.HorizontalSlider (new Rect (945, 75, 100, 30), txt_max, 0, 9); GUI.Label (new Rect (1050, 70, 200, 20), txt_max.ToString ()); if (GUI.Button (new Rect (860, 100, 200, 50), "GetTop N Rankers")) { // Clearing Data From Response Box. success = ""; playerRank = ""; playerName = ""; playerScore = ""; box = ""; errorLable = ""; if (txt_max == 0) { box = "Max Must Be Greater Than Zero: "; return; } scoreBoardService = App42API.BuildScoreBoardService (); // Initializing scoreBoardService. int max = txt_max; // Maximum Number Of TOP RANKERS. //Getting Top Scorers , By Using App42 Scoreboard Service. //Method Name->GetTopNRankers(gameName, max); //Param->gameName(Name Of The Game, Which Is Created By You In AppHQ.) //Param->max(Provide Max Number "N" Of Scorers.) //Param->Callback(callback for success/exception.); scoreBoardService.GetTopNRankers (cons.gameName, max, this); leaderBoardButton = true; } }
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); } }
public Results() { InitializeComponent(); App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY); string gameName; if ((int)settings["trigger"] == 0) { gameName = "Bollywood_game"; } else { gameName = "Hollywood_game"; } new_xp = Global.findxp(Global.p1Score, Global.p2Score); dbConn = new SQLiteConnection(DB_PATH); var tpdata = dbConn.Query <Task>("select * from task where id='" + 1 + "'").FirstOrDefault(); // Check result is empty or not if (tpdata == null) { MessageBox.Show("Title Not Present in DataBase"); } else { scoreId = tpdata.ScoreId; prev_xp = Convert.ToDouble(tpdata.XP); pres_xp = new_xp + prev_xp; var tp = dbConn.Query <Task>("update task set XP='" + pres_xp + "' where Username = '******'").FirstOrDefault(); // Update Database dbConn.Update(tp); level = Global.levelFromXP(pres_xp); switch (level) { case 1: achievementName = "level_1"; break; case 2: achievementName = "level_2"; break; case 3: achievementName = "level_3"; break; case 4: achievementName = "level_4"; break; } } scoreBoardService.SaveUserScore(gameName, Global.localUsername, Global.p1Score, this); scoreBoardService.EditScoreValueById(scoreId, pres_xp, this); achievementService.EarnAchievement(Global.localUsername, achievementName, "xp_game", "", this); }
private void SaveUserScore_Click(object sender, RoutedEventArgs e) { scoreBoardService.SaveUserScore(Constants.gameName, Constants.gameUserName, 100000, this); }
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(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 SubmitScore(int score, string name) { scoreBoardService = sp.BuildScoreBoardService(); // Initializing scoreBoardService. try { //Saving User Score , By Using App42 Scoreboard Service. //Method Name->SaveUserScore(game_name, userName, score); //Param->game_name(Name Of The Game, Which Is Created By You In AppHQ.) //Param->userName(Name Of The User For Which You Want To Save Score.) //Param->score( Data Type "double" Value Of Score.) Game savedScore = scoreBoardService.SaveUserScore(game_name, name, score); } catch (App42Exception e) { error = errors.get_error_code(e); } }
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); } }