/// <summary> /// Draws all of the items in the leaderboard /// </summary> private void DrawListAllItemsBtn() { GUILayout.BeginVertical(GUILayout.Width(_columnWidth)); GUILayout.Label("Connect to Azure, hit these buttons, then WAIT a few moments for results to return"); // Draw the button to get ALL of the items in the leaderboard if (!GUILayout.Button("List ALL Items In Leaderboard")) { return; } // Remove everything currently in the list _leadersList.Clear(); // Get all of the items currently stored on the leaderboard Azure.where < LeaderBoard > (i => i.username != null, itemsInTheLeaderboard => { Debug.Log("queried ALL scores, completed with _leadersList count:" + " " + itemsInTheLeaderboard.Count); _leadersList = itemsInTheLeaderboard; // Loop through each item in the leaderboard list, and draw it to the log foreach (var item in itemsInTheLeaderboard) { Debug.Log("Item in the leaderboard:" + " " + item); } }); // All items returned from the leaderboard are drawn in this list container GUILayout.BeginScrollView(_scrollPosition, false, true, GUILayout.Height(_columnWidth)); ColumnForLeaderboardList(); GUILayout.EndScrollView(); GUILayout.EndVertical(); }
/// <summary> /// Grabs all of the scores in the database, based on the search results you enter /// </summary> private void DrawQueryScoresBtn() { GUILayout.BeginVertical(GUILayout.Width(_columnWidth)); if (GUILayout.Button("Query All Scores <= 200")) { // Remove everything from the current log _leadersList.Clear(); // Grab all scores in our leaderboard which are <= _minScoreToReturn Azure.where < LeaderBoard > (i => i.score <= _minScoreToReturn, itemsInTheLeaderboard => { Debug.Log("queried all scores <= 100 has completed with _leadersList count: " + " " + itemsInTheLeaderboard.Count); _leadersList = itemsInTheLeaderboard; // Loop through each item in the leaderboard list, and draw it to the log foreach (var item in itemsInTheLeaderboard) { GUILayout.Label(string.Format("Name: {0} Score: {1}", item.username, item.score)); } }); } GUILayout.EndVertical(); }