/// <summary> /// 特定のデータに着目したランキング上位10名のデータを取得 /// </summary> /// <param name="orderType">どのデータのランキングを取得するか</param> /// <param name="onGet">データ取得時の処理</param> /// <returns></returns> public IEnumerator GetRanking(E_UserData orderType, Action <List <NetworkUserData> > onGet) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("User"); List <NCMBObject> result = null; NCMBException error = null; switch (orderType) { case E_UserData.HighScore: query.OrderByDescending("HighScore"); //降順 break; case E_UserData.TotalGoalToEnemyCount: query.OrderByDescending("TotalGoalToEnemyCount"); //降順 break; case E_UserData.TotalPlayCount: query.OrderByDescending("TotalPlayCount"); //降順 break; case E_UserData.TotalScore: query.OrderByDescending("TotalScore"); //降順 break; } query.Limit = 10; query.FindAsync((List <NCMBObject> _result, NCMBException _error) => { result = _result; error = _error; }); //resultもしくはerrorが入るまで待機 yield return(new WaitWhile(() => result == null && error == null)); if (error == null) { List <NetworkUserData> userData = new List <NetworkUserData>(); foreach (NCMBObject res in result) { userData.Add(new NetworkUserData(res)); } onGet(userData); } else { Debug.Log(error); } }
// サーバーからトップ5を取得 --------------- public void fetchTopRankers() { // データストアの「HighScore」クラスから検索 NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject> ("HighScore"); query.OrderByDescending ("Score"); query.Limit = 5; query.FindAsync ((List<NCMBObject> objList ,NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List<NCMB.HighScore> list = new List<NCMB.HighScore>(); // 取得したレコードをHighScoreクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["Score"]); string n = System.Convert.ToString(obj["Name"]); string u = System.Convert.ToString(obj["Uuid"]); list.Add( new HighScore( s, n, u) ); } topRankers = list; } }); }
void Start() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("test"); query.OrderByDescending("Score"); query.Limit = 4; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { Debug.Log(e.ToString()); return; } else { foreach (NCMBObject ncbObject in objList) { Ranking_text[count].text = ncbObject["Score"].ToString(); Debug.Log("message : " + ncbObject ["Score"]); count += 1; } } }); }
void loadImages() { InitNowImageIndex(); InitImages(); //DoodleRecordを検索するクラスを作成 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("DoodleRecord"); query.WhereEqualTo("date", DateTime.Now.Date); query.WhereEqualTo("type", "doodle"); query.OrderByDescending("likes"); //取得件数の指定 query.Limit = maxCount; //取得開始位置の指定 query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { foreach (NCMBObject obj in objList) { Debug.Log("--------------------------------------------------------------"); NextImageIndex(); loadOneImageTo(obj["filename"].ToString(), nowImageIndex); } } }); }
public IEnumerator SetRecentClearTextFromClearResult() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>(SceneManager.GetActiveScene().name); List <NCMBObject> result = null; NCMBException error = null; query.OrderByDescending("createDate"); query.Limit = 9; query.FindAsync((List <NCMBObject> _result, NCMBException _error) => { result = _result; error = _error; }); //resultもしくはerrorが入るまで待機 yield return(new WaitWhile(() => result == null && error == null)); //後続処理 if (error == null) { this.SetRecentClearTextFromClearResult(result); } else { Debug.Log(error); } }
public IEnumerator SetHighRankingTexts(int missionIndex) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("Mission" + (missionIndex + 1).ToString()); List <NCMBObject> result = null; NCMBException error = null; if (missionIndex != 3) { query.OrderByAscending("ClearTime"); //昇順 } else { query.OrderByDescending("ClearTime"); //降順 } query.Limit = 10; query.FindAsync((List <NCMBObject> _result, NCMBException _error) => { result = _result; error = _error; }); //resultもしくはerrorが入るまで待機 yield return(new WaitWhile(() => result == null && error == null)); //後続処理 if (error == null) { this.SetHighRankingTexts(result, missionIndex); } }
// Use this for initialization void Start() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("Score"); query.OrderByDescending("score"); query.Limit = 1; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 //取得したレコードをscoreクラスとして保存 if (objList.Count > 0) { Debug.Log("GhostData"); readyGhost = true; foreach (NCMBObject obj in objList) { posObj = obj; } } } }); }
/* Weekly Pt Start*/ public void GetTop10Pt(int todayNCMB) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("pvpTmp"); query.WhereGreaterThanOrEqualTo("endDate", todayNCMB); query.OrderByDescending("totalPt"); query.AddDescendingOrder("totalWinNo"); query.Limit = 10; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { } else { foreach (NCMBObject obj in objList) { //PvP Detail string userId = System.Convert.ToString(obj["userId"]); Top10PtWeeklyWinList.Add(System.Convert.ToInt32(obj["totalWinNo"])); int atkNo = System.Convert.ToInt32(obj["atkNo"]); int dfcNo = System.Convert.ToInt32(obj["dfcNo"]); Top10PtWeeklyBattleList.Add(atkNo + dfcNo); Top10PtWeeklyQtyList.Add(System.Convert.ToInt32(obj["totalPt"])); Top10PtWeeklyUserIdList.Add(userId); Top10PtWeeklyNameList.Add(System.Convert.ToString(obj["userName"])); Top10PtWeeklyRankList.Add(System.Convert.ToInt32(obj["kuniLv"])); Top10PtWeeklyBusyoList.Add(System.Convert.ToInt32(obj["soudaisyo"])); Top10PtWeeklyHeiList.Add(System.Convert.ToInt32(obj["jinkeiHeiryoku"])); } } }); }
void LoadFile() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("SummerTask"); query.OrderByDescending("Score"); query.Limit = 10; // 上位10件のみ取得 query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e == null) { //検索成功したら nameList = new List <string>(); // 名前のリスト scoreList = new List <int>(); // スコアのリスト GameObject tmpObj; Text tmpText; for (int i = 0; i < objList.Count; i++) { string s = System.Convert.ToString(objList[i]["Name"]); // 名前を取得 int n = System.Convert.ToInt32(objList[i]["Score"]); // スコアを取得 nameList.Add(s); // リストに突っ込む scoreList.Add(n); tmpObj = GameObject.Find("No" + (i + 1)); // ランキング表示用のオブジェクト取得 // テキストに代入 tmpText = tmpObj.GetComponent <Text>(); tmpText.text = "No." + (i + 1) + " " + s + " " + n; } } }); }
public void FetchFriendDataFromNCMB(UnityAction <List <FriendData> > callback) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("FriendData"); query.OrderByDescending("createDate"); query.Limit = 20; query.FindAsync((List <NCMBObject> childObjList, NCMBException error) => { if (error != null) { //エラー処理 } else { //成功時の処理 List <FriendData> friendDataList = new List <FriendData>(); foreach (NCMBObject obj in childObjList) { string name = (string)obj["Name"]; string message = (string)obj["Message"]; ArrayList doubleArrayPosition = (ArrayList)obj["Position"]; Vector3 position = doubleArrayPosition.ToVector3(); friendDataList.Add(new FriendData(name, message, position)); } callback(friendDataList); } }); }
// サーバーからトップ10を取得 public void FetchTopRankers() { // データストアのHiScoreクラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("HiScore"); query.OrderByDescending("score"); query.Limit = 10; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List <LeaderBoardSet> list = new List <LeaderBoardSet>(); // 取得したレコードをリーダーボードクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["score"]); string n = System.Convert.ToString(obj["name"]); list.Add(new LeaderBoardSet(n, s)); } m_TopRankers = list; ShowLeaderBoard(); } }); }
// ランキングデータ読み込み public void DBRankingLoad() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>(Define.DATASTORENAME); // Scoreの値で降順にソート query.OrderByDescending("Score"); // 取得数の設定 query.Limit = Define.DRAWLIST_MAX; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { // 検索失敗時の処理 IsRankingDataValid = false; } else { rankingDataList.Clear(); foreach (NCMBObject obj in objList) { rankingDataList.Add(new RankingData( name: obj["Name"] as string, time: obj["Time"] as string, score: Convert.ToInt32(obj["Score"]) )); } IsRankingDataValid = true; } }); }
/// <summary> /// ランキングボード用取得関数 /// </summary> public void FetchTopRankers() { // データストアの「ScoreRanking」クラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("ScoreRanking"); query.OrderByDescending("Score"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 Debug.LogError("ランキング取得失敗しました。" + e.ErrorMessage); } else { //検索成功時の処理 List <ScoreRanking> list = new List <ScoreRanking>(); // 取得したレコードをScoreRankingクラスとして保存 foreach (NCMBObject obj in objList) { string n = System.Convert.ToString(obj["Name"]); int s = System.Convert.ToInt32(obj["Score"]); list.Add(new ScoreRanking(n, s)); } rankingList = list; } }); }
public void UpdatePvPWeekly(string userId, string userName, int todayNCMB, int kuniLv, int soudaisyo, int jinkeiHeiryoku) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("pvpTmp"); query.WhereEqualTo("userId", userId); query.WhereGreaterThanOrEqualTo("endDate", todayNCMB); query.OrderByDescending("endDate"); query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e == null) { if (objList.Count != 0) { objList[0]["userName"] = userName; objList[0]["kuniLv"] = kuniLv; if (soudaisyo != 0) { objList[0]["soudaisyo"] = soudaisyo; } objList[0]["jinkeiHeiryoku"] = jinkeiHeiryoku; objList[0].SaveAsync(); } } }); }
// サーバーからトップ5を取得 --------------- public void fetchTopRankers() { // データストアの「Score」クラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("Score"); query.OrderByDescending("score"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List <NCMB.Rankers> list = new List <NCMB.Rankers>(); // 取得したレコードをscoreクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["score"]); string n = System.Convert.ToString(obj["name"]); list.Add(new Rankers(s, n)); } topRankers = list; } }); }
//--------------------------------------------------- // GetResultRecord //--------------------------------------------------- public void GetResultRecord() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("ResultRecord"); query.OrderByDescending("VictoryNum"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { } else { int i = 0; foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["VictoryNum"]); string n = System.Convert.ToString(obj["Name"]); if (n == BattleSystem.IGNORE_SAVE_SCORE_TEAM_NAME) { _ateamAIText.text = this.MakeResultRecordTextFormat(n, s); } else { _otherAIText.text = this.MakeResultRecordTextFormat(n, s); } i++; } } }); }
public IEnumerator SetHighRankingTextFromFailedResult() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>(SceneManager.GetActiveScene().name); List <NCMBObject> result = null; NCMBException error = null; if (TimeManager.Instance.CountTimeType == E_CountTimeType.CountUp) { query.OrderByAscending("ClearTime"); //昇順 } else { query.OrderByDescending("ClearTime"); //降順 } query.Limit = 10; query.FindAsync((List <NCMBObject> _result, NCMBException _error) => { result = _result; error = _error; }); //resultもしくはerrorが入るまで待機 yield return(new WaitWhile(() => result == null && error == null)); //後続処理 if (error == null) { this.SetHighRankingTextFromFailedResult(result); } }
public void GetScoreRankings(string gameDifficulty) { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("ScoreRanking"); query.WhereEqualTo("GameDifficulty", gameDifficulty); query.OrderByDescending("Score"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null)//検索失敗時の処理 { Debug.Log("ランキングの情報がありません" + e.ErrorMessage); } else //成功時 { if (objList.Count > 0) { foreach (NCMBObject obj in objList) { string n = System.Convert.ToString(obj["Name"]); int s = System.Convert.ToInt32(obj["Score"]); rankingList.Add(new ScoreRanking(n, s)); } } else { return; } } }); }
/// <summary> /// サーバーからTOP5までのスコアを取得 /// </summary> public void FetchRankerScores() { AsyncState = ASYNC_DOING; NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>(CLASS_NAME); query.OrderByDescending(KEY_SCORE); query.Limit = 5; query.FindAsync((List <NCMBObject> records, NCMBException e) => { if (e == null) { int count = records.Count; mRankerScoreArray = new int[count]; for (int i = 0; i < count; i++) { mRankerScoreArray[i] = System.Convert.ToInt32(records[i][KEY_SCORE]); } } else { Debug.LogError(e); // エラーが出た場合はデフォルトのスコアを設定してしまう mRankerScoreArray = new int[5]; mRankerScoreArray[0] = 3000; mRankerScoreArray[1] = 2000; mRankerScoreArray[2] = 1500; mRankerScoreArray[3] = 1000; mRankerScoreArray[4] = 500; HasAsyncError = true; } AsyncState = ASYNC_DONE; }); }
// サーバーからハイスコアを取得 ----------------- public void getHighScore(ScoreDataV1 param, bool myScore) { // データストアの「ScoreDataV1」クラスから、Nameをキーにして検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("ScoreDataV1"); query.WhereEqualTo("ScoreKindValue", param.ScoreKindValue); if (myScore) { query.WhereEqualTo("Id", param.Id); myHighScore[param.ScoreKindValue] = 0; } else { allHighScore[param.ScoreKindValue] = 0; } query.WhereEqualTo("Row", param.Row); query.WhereEqualTo("Col", param.Col); query.WhereEqualTo("Color", param.Color); query.WhereEqualTo("Link", param.Link); query.WhereEqualTo("Direction", param.Direction); query.WhereEqualTo("Time", param.Time); query.WhereEqualTo("Stop", param.Stop); query.WhereEqualTo("CountDisp", param.CountDisp); query.WhereEqualTo("Garbage", param.Garbage); query.WhereGreaterThan("Version", 1); query.WhereEqualTo("ScoreCategoryValue", param.ScoreCategoryValue); query.OrderByDescending("Score"); query.FindAsync((List <NCMBObject> objList, NCMBException e) => { //検索成功したら if (e == null) { // ハイスコアが未登録だったら if (objList.Count == 0) { if (myScore) { myHighScore[param.ScoreKindValue] = 0; } else { allHighScore[param.ScoreKindValue] = 0; } } // ハイスコアが登録済みだったら else { if (myScore) { myHighScore[param.ScoreKindValue] = System.Convert.ToInt32(objList[0]["Score"]); } else { allHighScore[param.ScoreKindValue] = System.Convert.ToInt32(objList[0]["Score"]); } } } }); }
public void FetchTopRankingData() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("HighScore"); //ここでqueryに色々条件を与える query.OrderByDescending("score"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 // 取得したレコードをHighScoreクラスとして保存 foreach (var obj in objList) { int s = System.Convert.ToInt32(obj ["score"]); string n = System.Convert.ToString(obj ["name"]); HighScore highScore = new HighScore(); highScore.name = n; highScore.score = s; // Debug.Log("score"+s,"name"+n); highScoreList.Add(highScore); } } }); }
public void getScoreRanking() { Debug.Log("getScoreRanking"); NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("Ranking"); query.OrderByDescending("score"); // スコアを降順に並び替える query.Limit = 10; // 上位10件のみ取得 List <string> nameList = new List <string>(); // 名前のリスト List <int> scoreList = new List <int>(); // スコアのリスト query.FindAsync((List <NCMBObject> objList, NCMBException e) => { //ラムダ式同時処理 if (e == null) //検索成功したら { for (int i = 0; i < objList.Count; i++) { string s = System.Convert.ToString(objList[i]["playername"]); // 名前を取得 int n = System.Convert.ToInt32(objList[i]["score"]); // スコアを取得 nameList.Add(s); // リストに突っ込む scoreList.Add(n); Debug.Log("name is" + nameList[i] + "score is" + scoreList[i]); nameandscore[i].text = nameList[i] + " " + scoreList[i]; } } DisplayRunking(); }); }
public void LoadOneImage(int index, Image go) { NCMBQuery <NCMBFile> query = NCMBFile.GetQuery(); query.Skip = index; query.Limit = 1; query.OrderByDescending("createDate"); query.FindAsync((List <NCMBFile> objList, NCMBException error) => { if (error != null) { // 検索失敗 } else { // 検索成功 foreach (NCMBFile file in objList) { file.FetchAsync((byte[] fileData, NCMBException e) => { if (e != null) { // 取得失敗 } else { // 取得成功 SaveBytes(fileData, go); } }); } } }); }
void Start() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("MusicData"); query.OrderByDescending("PlayCount"); query.Limit = 100; query.FindAsync((List <NCMBObject> MusicList, NCMBException e) => { if (e != null) { Debug.Log("検索失敗時の処理"); //検索失敗時の処理 } else { foreach (NCMBObject Data in MusicList) { // Debug.Log(Data["Title"]); // Debug.Log(Data["Comment"]); // Debug.Log(Data["PlayCount"]); GameObject MusicNode = Instantiate(prefab, transform.position, transform.rotation) as GameObject; MusicNode.transform.SetParent(NodeParent.transform); NodeMaster node = MusicNode.GetComponent <NodeMaster>(); node.ViewData((Data["Title"]).ToString(), (Data["Comment"]).ToString(), System.Convert.ToInt32(Data["PlayCount"]), (Data["ID"]).ToString()); // Node.ViewData(Data["Title"].ToString(),Data["Comment"].ToString(),(int)Data["PlayCount"]); } } }); }
void Fetch() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("HighScore"); //ここでqueryに色々条件を与える query.WhereGreaterThan("score", 5000); query.OrderByDescending("score"); query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 // 取得したレコードをHighScoreクラスとして保存 foreach (var obj in objList) { int s = System.Convert.ToInt32(obj ["score"]); string n = System.Convert.ToString(obj ["name"]); Debug.Log(n + ":" + s); } } }); }
// ランキングをサーバーから取得 public void GetRanking() { Init(); NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("Ranking"); query.OrderByDescending("Score"); query.Limit = 30; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { ShowToast("エラーが発生しました。"); } else { // ランカーを適用 Transform rankerParent = GameObject.Find("UIs/Ranking/Panel/LeaderBoard/Viewport/Content").transform; int r = 0; foreach (NCMBObject obj in objList) { r++; int s = System.Convert.ToInt32(obj["Score"]); string n = System.Convert.ToString(obj["Name"]); GameObject ranker = Instantiate(rankerPrefab, rankerParent); ranker.transform.GetChild(0).GetComponent <Text> ().text = r.ToString(); ranker.transform.GetChild(1).GetComponent <Text> ().text = n; ranker.transform.GetChild(2).GetComponent <Text> ().text = s.ToString(); } } }); }
public void fetchTopRankers() { NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject>("Score"); query.OrderByDescending("score"); query.Limit = 3; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { } else { //検索成功時 List <NCMB.Rankers> list = new List <NCMB.Rankers>(); foreach (NCMBObject obj in objList) { int i = System.Convert.ToInt32(obj["score"]); list.Add(new Rankers(i)); } topRanker = list; endflag = true; } }); }
//--------------------------------------------------- // GetHighScoreRanking //--------------------------------------------------- public void GetHighScoreRanking() { // データストアの「HighScore」クラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("HighScore"); query.OrderByDescending("Score"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 // 取得したレコードをHighScoreクラスとして保存 int i = 1; foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["Score"]); string n = System.Convert.ToString(obj["Name"]); Debug.Log("RANK : " + i + " | NAME : " + n + " | SCORE : " + s.ToString()); i++; } } }); }
void MakeTopRanking() { NCMBQuery <NCMBObject> topquery = new NCMBQuery <NCMBObject>("OnlineRanking"); topquery.OrderByDescending("Score"); topquery.Limit = 5; topquery.FindAsync((List <NCMBObject> objectlist, NCMBException e) => { if (e != null) { Debug.Log("Miss"); } else { for (int i = 0; i < 5; i++) { nametext[i].text = System.Convert.ToString(objectlist[i]["UserName"]); scoretext[i].text = System.Convert.ToString(objectlist[i]["Score"]); set1[i].sprite = item[System.Convert.ToInt32(objectlist[i]["Item1"])]; set2[i].sprite = item[System.Convert.ToInt32(objectlist[i]["Item2"])]; set3[i].sprite = item[System.Convert.ToInt32(objectlist[i]["Item3"])]; } } }); }
// サーバーからrankの前後2件を取得 --------------- public void fetchNeighbors() { neighbors = new List<NCMB.HighScore>(); // スキップする数を決める(ただし自分が1位か2位のときは調整する) int numSkip = currentRank - 3; if(numSkip < 0) numSkip = 0; // データストアの「HighScore」クラスから検索 NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject> ("HighScore"); query.OrderByDescending ("Score"); query.Skip = numSkip; query.Limit = 5; query.FindAsync ((List<NCMBObject> objList ,NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List<NCMB.HighScore> list = new List<NCMB.HighScore>(); // 取得したレコードをHighScoreクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["Score"]); string n = System.Convert.ToString(obj["Name"]); string u = System.Convert.ToString(obj["Uuid"]); list.Add( new HighScore( s, n, u ) ); } neighbors = list; } }); }
public void FetchTopRankingData() { // データストアの「HighScore」クラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("OnlineRanking"); query.OrderByDescending("HighScore"); query.Limit = 5; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List <HighScore> list = new List <HighScore>(); // 取得したレコードをHighScoreクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["HighScore"]); string n = System.Convert.ToString(obj["UserName"]); list.Add(new HighScore(s, n)); } highScoreList = list; for (int i = 0; i < highScoreList.Count; i++) { GameObject.Find("TopRank" + (i + 1)).GetComponent <Text>().text = highScoreList[i].name; GameObject.Find("TopRankScore" + (i + 1)).GetComponent <Text>().text = highScoreList[i].score.ToString(); Debug.Log(highScoreList[i].name); Debug.Log(highScoreList[i].score.ToString()); } } }); }
public void FetchTopRankingData(System.Action onSuccess) { // データストアの「HighScore」クラスから検索 NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("OnlineRanking"); query.OrderByDescending("HighScore"); query.Limit = 100; query.FindAsync((List <NCMBObject> objList, NCMBException e) => { if (e != null) { //検索失敗時の処理 } else { //検索成功時の処理 List <HighScore> list = new List <HighScore>(); // 取得したレコードをHighScoreクラスとして保存 foreach (NCMBObject obj in objList) { int s = System.Convert.ToInt32(obj["HighScore"]); string n = System.Convert.ToString(obj["UserName"]); list.Add(new HighScore(s, n)); } highScoreList = list; onSuccess(); } }); }
/// <summary> /// ランキングの取得. /// </summary> void HighScoreGetter() { NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject> ("HighScore"); // Scoreフィールドの降順でデータを取得. query.OrderByDescending("Score"); // 検索件数を設定. query.Limit = listLimit; // データストアで検索を行う. query.FindAsync (( List<NCMBObject> objList, NCMBException e) => { if ( e != null) { // 検索失敗時の処理. } else { // 検索成功時の処理. } }); }
// Use this for initialization void Start() { NCMBQuery<NCMBObject> query = new NCMBQuery<NCMBObject> ("Score"); query.OrderByDescending ("score"); query.Limit = 1; query.FindAsync ((List<NCMBObject> objList,NCMBException e)=>{ if(e !=null){ //検索失敗時の処理 }else{ //検索成功時の処理 //取得したレコードをscoreクラスとして保存 if(objList.Count > 0){ Debug.Log("GhostData"); readyGhost = true; foreach(NCMBObject obj in objList){ posObj = obj; } } } }); }