string[] GetScores() { scoreBoardService = sp.BuildScoreBoardService(); // Initializing scoreBoardService. string[] score_table = new string[max_players_returned * 3]; try { //Getting Top Scorers , By Using App42 Scoreboard Service. //Method Name->GetTopNRankers(game_name, max); //Param->game_name(Name Of The Game, Which Is Created By You In AppHQ.) //Param->max(Provide Max Number "N" Of Scorers.) Game top_rankers = scoreBoardService.GetTopNRankers(game_name, max_players_returned); for (int i = 0; i < top_rankers.GetScoreList().Count; i++) { // player_rank, player_name, player_score score_table [(0 + i * 3)] = (i + 1).ToString(); score_table [(1 + i * 3)] = top_rankers.GetScoreList() [i].userName; score_table [(2 + i * 3)] = top_rankers.GetScoreList() [i].value.ToString(); } } catch (App42Exception e) { error = errors.get_error_code(e); } return score_table; }
public void reloadbt() { scoreboardserv.GetTopNRankers(gamename, maxplayers, new toprankMenu()); reload.SetActive(false); render.sprite = error [0]; mudardecena.soundClick(); }
// Use this for initialization void Start() { goRank = false; ranks = new List <Text>(); names = new List <Text>(); score = new List <Text>(); texts = new List <GameObject>(); reload = relo; scorenew = false; otherMetaHeaders.Add("orderByDescending", "score"); App42API.Initialize(key, secretkey); App42Log.SetDebug(true); gameserv = App42API.BuildGameService(); scoreboardserv = App42API.BuildScoreBoardService(); scoreboardserv.SetOtherMetaHeaders(otherMetaHeaders); scoreboardserv.GetTopNRankers(gamename, maxplayers, new toprankMenu()); if (texts.Count < 20) { 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> ()); } //Debug.Log ("veioaquiDENOVO"); } render = GameObject.Find("hsImg").GetComponent <Image> (); error [0] = bla [0]; error [1] = bla [1]; }
public void GetTopNRankers(string pGameName, int pMax, App42Response.OnSuccessDelegate pSuccess, App42Response.OnExceptionDelegate pException) { App42Response response = new App42Response(pSuccess, pException); scoreBoardService.GetTopNRankers(pGameName, pMax, response); }
// Update is called once per frame void Update() { if (salvouhs) { scoreboardserv.SetOtherMetaHeaders(otherMetaHeaders); scoreboardserv.GetTopNRankers(gamename, maxplayers, new toprank()); salvouhs = false; Debug.Log("vai pegar HS"); } }
// 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 GlobalLeaderBoard() { errorMessage = false; LeaderBoardCallBack.fList.Clear (); FriendsLeaderBoardCallBack.friendList.Clear (); LeaderBoardCallBack.fromLeaderBoard = true; scoreBoardService = App42API.BuildScoreBoardService (); Query q = QueryBuilder.Build ("userId","",Operator.LIKE); scoreBoardService.SetQuery (AppConstants.collectionName,q); scoreBoardService.GetTopNRankers(AppConstants.gameName, 10, new LeaderBoardCallBack ()); }
public static void GlobalLeaderBoard() { errorMessage = false; LeaderBoardCallBack.fList.Clear(); FriendsLeaderBoardCallBack.friendList.Clear(); LeaderBoardCallBack.fromLeaderBoard = true; scoreBoardService = App42API.BuildScoreBoardService(); Query q = QueryBuilder.Build("userId", "", Operator.LIKE); scoreBoardService.SetQuery(AppConstants.collectionName, q); scoreBoardService.GetTopNRankers(AppConstants.gameName, 10, new LeaderBoardCallBack()); }
public static void GetTopNGlobalScores(int count, App42Sample.App42ApiCallback.App42ApiResultCallback callBack) { try { App42ApiCallback _sCallback = new App42ApiCallback(callBack); if (mScoreBoardService == null) { mScoreBoardService = App42API.BuildScoreBoardService(); } mScoreBoardService.GetTopNRankers(Constants.gameName, count, _sCallback); } catch (Exception e) { MessageBox.Show(e.Message); } }
// Constructor public MainPage() { InitializeComponent(); App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY); GameService gameService = App42API.BuildGameService(); ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService(); ScoreService scoreService = App42API.BuildScoreService(); RewardService rewardService = App42API.BuildRewardService(); UserService userService = App42API.BuildUserService(); // Set the data context of the listbox control to the sample data DataContext = App.ViewModel; username.Text = Global.localUsername.ToUpper(); email.Text = Global.email; // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); scoreBoardService.GetTopNRankers("xp_game", 15, this); userService.GetUser(Global.localUsername, this); }
public void GetTopScorers() { leaderBoardButton = true; SocialService socialService = App42API.BuildSocialService(); var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; scoreBoardService = App42API.BuildScoreBoardService(); //For FACEBOOK scoreBoardService.GetTopNRankers(FBgameName, 20, new LeaderboardController()); }
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(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); } }
public void getTopNRankings() { scoreBoardService = sp.BuildScoreBoardService(); // Initializing ScoreBoard Service. scoreBoardService.GetTopNRankers("mordenelf", 100, topNRankCall); }
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); } }