Inheritance: MonoBehaviour
Beispiel #1
1
        public void GetPlayerScores_Default_ReturnsScoresForAllGameRaces()
        {
            var game = Substitute.For<IGame>();

            var race1 = Substitute.For<IRace>();
            var race2 = Substitute.For<IRace>();

            var player1 = Substitute.For<IRacePlayer>();
            var player2 = Substitute.For<IRacePlayer>();

            player1.Position.Returns(1);
            player2.Position.Returns(2);

            var players = new Dictionary<Character, IRacePlayer>();
            players.Add(Character.Mario, player1);
            players.Add(Character.Luigi, player2);

            race1.Players.Returns(players);
            race2.Players.Returns(players);

            var races = new List<IRace>() { race1, race2 };
            game.Races.Returns(races);

            var leaderboard = new Leaderboard();
            var expectedScores = new Dictionary<Character, int>();

            expectedScores.Add(Character.Mario, Constants.FirstPlacePoints * 2);
            expectedScores.Add(Character.Luigi, Constants.SecondPlacePoints * 2);

            leaderboard.GetPlayerScores(game).ShouldBeEquivalentTo(expectedScores);
        }
		private void OnReceivingScores(string _loadedScoresJsonStr, Leaderboard.LoadScoreCompletion _callback)
		{
			
			IList _scoresJsonList				= JSONUtility.FromJSON(_loadedScoresJsonStr) as IList;

			Score[] _scores = null;
			Score	_localUserScore = null;

			if(_scoresJsonList != null)
			{
				int _count = _scoresJsonList.Count;
				if(_count > 0)
				{
					_localUserScore = AndroidScore.ConvertScore(_scoresJsonList[_count - 1] as IDictionary);

					//Now remove the last element. As we stored user score in the last entry.
					_scoresJsonList.RemoveAt(_count - 1);

					_scores = AndroidScore.ConvertScoreList(_scoresJsonList);


					if(_localUserScore.User == null)//Empty entry
					{
						_localUserScore = null;
					}
				}
			}

			// Send callback
			if (_callback != null)
			{
				_callback(_scores, _localUserScore);
			}

		}
 public void FetchRankings(Leaderboard leaderboard, int page)
 {
     isFetching = true;
     activeLeaderboard = leaderboard;
     leaderboard.ranking.Page = page;
     leaderboard.ranking.Fetch(OnRoarFetchRankingsComplete);
 }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     //Ask for name
     //Insert score into database when game ends.
     lboard = GetComponent<Leaderboard>();
     Debug.Log("In GameOver scene");
 }
Beispiel #5
0
 public ActionResult Leaderboard()
 {
     IDAL DAL = new DBDataAL();
     IEnumerable<User> users = DAL.GetAllUsers();
     Leaderboard board = new Leaderboard();
     board.IsGlobal = true;
     board.Users = users;
     return View(board);
 }
        public void Setup()
        {
            _leaderboard = JsonConvert.DeserializeObject<Leaderboard>(File.ReadAllText(Config.LeaderboardJsonPath));

            var mock = new Mock<IHaloSession>();
            mock.Setup(m => m.Get<Leaderboard>(It.IsAny<string>()))
                .ReturnsAsync(_leaderboard);

            _mockSession = mock.Object;
        }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        dispScores = new ArrayList();
        lboard = GetComponent<Leaderboard>();

        lboard_entry = new GUIStyle();
        lboard_entry.fontSize = 60;
        lboard_entry.fontStyle = FontStyle.Bold;
        lboard_entry.normal.textColor = Color.white;
    }
        internal LeaderboardAndRank(IDictionary<string, object> dict)
        {
            object value;

              dict.TryGetValue ("rank", out value);
              Rank = new Rank ((IDictionary<string,object>)value);

              dict.TryGetValue ("leaderboard", out value);
              Leaderboard = new Leaderboard ((IDictionary<string,object>)value);
        }
        public void ShouldKeepAllDriversWhenSamePoints()
        {
            var winDriver1 = new Race("Australian Grand Prix", TestData.Driver1, TestData.Driver2, TestData.Driver3);
            var winDriver2 = new Race("Malaysian Grand Prix", TestData.Driver2, TestData.Driver1, TestData.Driver3);
            var exEquoLeaderBoard = new Leaderboard(winDriver1, winDriver2);

            var rankings = exEquoLeaderBoard.DriverRankings();

            CollectionAssert.AreEqual(
                new List<string> {TestData.Driver2.Name, TestData.Driver1.Name, TestData.Driver3.Name},
                rankings);
        }
Beispiel #10
0
 void Awake()
 {
     // If this is the first instance, make it the singleton. If a singleton already exists and another reference is found, destroy it
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != instance)
             Destroy(this.gameObject);
     }
 }
Beispiel #11
0
    void Start()
    {
        leaderboards = new Leaderboard[number_of_leaderboards];
        individual_boards = new LeaderboardIndv[number_of_leaderboards];
        GameObject temp;
        for (int i = 0; i < number_of_leaderboards; i++)
        {
            leaderboards[i] = new Leaderboard();
            leaderboards[i].load_data(i+1);

            temp = (GameObject)Instantiate(sample_board, leaderboard_positions[i].transform.position, leaderboard_positions[i].transform.rotation);
            individual_boards[i] = temp.GetComponent<LeaderboardIndv>();
            individual_boards[i].boardname = leaderboards[i].get_name();
            individual_boards[i].entries = leaderboards[i].get_all_boards();
        }
    }
Beispiel #12
0
        public void setLeaderboardScoreForCurrentUser(Leaderboard leaderboard, int score)
        {
            // updates the score for the current user for this leaderboard
            leaderboard.setUserScore(score).async(delegate(ActionLeaderboardSetScore action) {

                if (action.getCode () == StatusCodes.SUCCESS) {
                    getLeaderboardMembers(leaderboard, 0, 10);
                    Kumakore.LOGD(TAG, "Leaderboard:" + leaderboard.getName() + " set to " + score + " for UserId:" + app.getUser().getId());
                    return;
                } else if (handleErrorCodes(action)) {
                    //...
                }

                Kumakore.LOGE(TAG, action.getStatusMessage());
            });
        }
Beispiel #13
0
        public void GetStandings_Default_ReturnsScoresInOrder()
        {
            var leaderBoard = new Leaderboard();
            var scores = new Dictionary<Character, int>();
            scores.Add(Character.Mario, 0);
            scores.Add(Character.Luigi, Constants.FirstPlacePoints);
            scores.Add(Character.Bowser, Constants.ThirdPlacePoints);

            var expectedStandings = new SortedDictionary<int, IPlayerScore>();
            expectedStandings.Add(1, new PlayerScore(Character.Luigi, Constants.FirstPlacePoints));
            expectedStandings.Add(2, new PlayerScore(Character.Bowser, Constants.ThirdPlacePoints));
            expectedStandings.Add(3, new PlayerScore(Character.Mario, 0));

            leaderBoard.CalculateStandings(scores);

            leaderBoard.Standings.ShouldBeEquivalentTo(expectedStandings);
        }
Beispiel #14
0
        public void getLeaderboardMembers(Leaderboard leaderboard, int start, int end)
        {
            leaderboard.getMembsGivenRange(start, end).async(delegate(ActionLeaderboardGetMembers action) {

                if (action.getCode () == StatusCodes.SUCCESS) {

                    foreach(LeaderboardMember member in leaderboard.getMembers()) {
                        Kumakore.LOGD(TAG, "LeaderboardMember:" + member.getUserName());
                    }

                    return;
                } else if (handleErrorCodes(action)) {
                    //...
                }

                Kumakore.LOGE(TAG, action.getStatusMessage());
            });
        }
Beispiel #15
0
        static TestData()
        {
            Driver1 = new Driver("Nico Rosberg", "DE");
            Driver2 = new Driver("Lewis Hamilton", "UK");
            Driver3 = new Driver("Sebastian Vettel", "DE");
            Driver4 = new SelfDrivingCar("1.2", "Acme");

            Race1 = new Race("Australian Grand Prix", Driver1, Driver2, Driver3);
            Race2 = new Race("Malaysian Grand Prix", Driver3, Driver2, Driver1);
            Race3 = new Race("Chinese Grand Prix", Driver2, Driver1, Driver3);
            Race4 = new Race("Fictional Grand Prix 1", Driver1, Driver2, Driver4);
            Race5 = new Race("Fictional Grand Prix 2", Driver4, Driver2, Driver1);
            Driver4.AlgorithmVersion = "1.3";
            Race6 = new Race("Fictional Grand Prix 3", Driver2, Driver1, Driver4);

            SampleLeaderboard1 = new Leaderboard(Race1, Race2, Race3);
            SampleLeaderboard2 = new Leaderboard(Race4, Race5, Race6);
        }
        public ActionResult SortByDefenseAscending(bool isGlobal)
        {
            IDAL DAL = new DBDataAL();
            Leaderboard board = new Leaderboard();
            board.IsGlobal = isGlobal;
            IEnumerable<User> users;
            if (isGlobal)
            {
                users = DAL.GetAllUsers().OrderBy(x => x.HighDefense);
            }
            else
            {
                string userName = User.Identity.Name;
                User currentUser = DAL.GetUser(userName);
                IEnumerable<string> friends = DAL.GetFriends(currentUser);
                users = DAL.GetAllUsers().Where(x => friends.Contains(x.UserName)).OrderBy(x => x.HighDefense);

            }
            board.Users = users;
            return View("~/Views/Web/Leaderboard.cshtml", board);
        }
    /// <summary>
    /// Initializes the game.
    /// Finds the policar instances and adds those to an array.
    /// </summary>
    void Awake()
    {
        Time.timeScale = 1;
        gameOver = false;
        restart = false;
        restartText.text = "";
        gameOverText.text = "";

        leaderboard = GameObject.FindGameObjectWithTag("Leaderboard").GetComponent<Leaderboard>();
		gameOverMenu = GameObject.FindGameObjectWithTag ("GameOverMenu");

		//Hide initially
		gameOverMenu.SetActive (false);

        popupSpawner = GameObject.FindGameObjectWithTag("PopupSpawner").GetComponent<PopupSpawner>();

        if (popupSpawner == null)
        {
            Debug.Log("popupSpawner could not be found!");
        }

        var pcars = GameObject.FindGameObjectsWithTag("Seeker");
        if (pcars == null)
        {
            Debug.Log("Can't find any Police Car game objects!!!");
        }
        else
        {
            foreach (var item in pcars)
            {
                policeCars.Add(item);
            }
        }

        score = 0;
        UpdateScore();
    }
        void ISocialPlatform.LoadScores(ILeaderboard board, Action <bool> callback)
        {
            if (!this.VerifyUser())
            {
                return;
            }
            Leaderboard leaderboard = (Leaderboard)board;

            foreach (Leaderboard current in this._leaderboards)
            {
                if (current.id == leaderboard.id)
                {
                    leaderboard.SetTitle(current.title);
                    leaderboard.SetScores(current.scores);
                    leaderboard.SetMaxRange((uint)current.scores.Length);
                }
            }
            this.SortScores(leaderboard);
            this.SetLocalPlayerScore(leaderboard);
            if (callback != null)
            {
                callback(true);
            }
        }
Beispiel #19
0
    IEnumerator GameOver()
    {
        PlayerPrefs.SetInt("EditLeaderboardEntryIndex", -1);

        var leaderBoard = Leaderboard.GetLeaderboard();

        string[] names  = leaderBoard.Item1;
        int[]    scores = leaderBoard.Item2;

        //Place the player's score on the leaderboard
        for (int i = 9; i >= 0; i--)
        {
            //If there is a higher score and that score is lower than the currently iterated score, bump this score down one
            if (i >= 1 && scores[i - 1] < Score)
            {
                names[i]  = names[i - 1];
                scores[i] = scores[i - 1];
            }
            else if (scores[i] < Score)
            {
                names[i]  = " ";
                scores[i] = (int)Score;
                PlayerPrefs.SetInt("EditLeaderboardEntryIndex", i);
            }
        }

        Leaderboard.SetLeaderboard(names, scores);

        //Turn of the model to show the player has died
        Model.gameObject.SetActive(false);

        //Wait for a few seconds before switching scenes so the player can see they died
        yield return(new WaitForSeconds(1.5f));

        SceneManager.LoadScene("ScoreScreen");
    }
Beispiel #20
0
        public async Task <IActionResult> OnGetAsync()
        {
            var user = await _context.Users
                       .Include(u => u.Questions)
                       .Include(u => u.Answers)
                       .ThenInclude(a => a.Question)
                       .SingleAsync(u => u.UserName.Equals(User.Identity.Name));

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{User.Identity.Name}'.");
            }

            Questions = user.Questions.ToList();
            Answers   = user.Answers.ToList();
            Points    = user.Points;
            Rank      = Leaderboard.Calculate(_context)
                        .IndexOf(new Competitor {
                Points = user.Points, Name = user.UserName
            }) + 1;
            UsersCount = _context.Users.Count();

            return(Page());
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            Player      = new Player(new Vector2(EntityWidth * (float)PlayerStartColumn, EntityHeight * (float)(PlayerStartRow + 1)));
            m_DebugText = Content.Load <SpriteFont>("Fonts/Joystix_12");
            MapManager.LoadMaps(); //Maps must be loaded before levels - H.E.
            LevelManager.LoadLevels();
            MainMenu.LoadContent();
            LevelTransition.LoadContent();
            HUD.LoadContent();
            GameOverMenu.LoadContent();
            GameWinMenu.LoadContent();
            LevelTransition.LoadContent();
            Leaderboard.LoadContent();
            GetLeaderBoardResultsAsync();
            m_DebugPixel = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            m_DebugPixel.SetData(new[] { Color.White });

            ScanLines = Content.Load <Texture2D>("UI/ScanLines");
            Border    = Content.Load <Texture2D>("UI/Border");

            MenuMusic = Content.Load <SoundEffect>("Sounds/Menu");
            GameMusic = Content.Load <SoundEffect>("Sounds/Main"); //Sounds/Last_slice_hiphop
        }
        private IEnumerator DownloadHighscores()
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                FindObjectOfType <HighscoreDisplayHelper>().DisplayError("No internet connection.");
                yield break;
            }

            UnityWebRequest request = UnityWebRequest.Get(Constants.DREAMLO_URL + Constants.DREAMLO_PUBLIC_CODE + "/json/0/10");

            yield return(request.SendWebRequest());

            if (!request.downloadHandler.text.StartsWith("ERROR"))
            {
                string      json        = JsonHelper.StripParentFromJson(request.downloadHandler.text, 2);
                Leaderboard leaderboard = JsonUtility.FromJson <Leaderboard>(json);
                FindObjectOfType <HighscoreDisplayHelper>().DisplayHighscores(leaderboard);
            }
            else
            {
                Debug.Log("Error downloading: " + request.downloadHandler.text);
                FindObjectOfType <HighscoreDisplayHelper>().DisplayError("Could not download highscores. Please try again later.\n\n" + request.downloadHandler.text);
            }
        }
Beispiel #23
0
        public void GetPlayerScores_Default_ReturnsScoresForAllGameRaces()
        {
            var game = Substitute.For <IGame>();

            var race1 = Substitute.For <IRace>();
            var race2 = Substitute.For <IRace>();

            var player1 = Substitute.For <IRacePlayer>();
            var player2 = Substitute.For <IRacePlayer>();

            player1.Position.Returns(1);
            player2.Position.Returns(2);

            var players = new Dictionary <Character, IRacePlayer>();

            players.Add(Character.Mario, player1);
            players.Add(Character.Luigi, player2);

            race1.Players.Returns(players);
            race2.Players.Returns(players);

            var races = new List <IRace>()
            {
                race1, race2
            };

            game.Races.Returns(races);

            var leaderboard    = new Leaderboard();
            var expectedScores = new Dictionary <Character, int>();

            expectedScores.Add(Character.Mario, Constants.FirstPlacePoints * 2);
            expectedScores.Add(Character.Luigi, Constants.SecondPlacePoints * 2);

            leaderboard.GetPlayerScores(game).ShouldBeEquivalentTo(expectedScores);
        }
        protected Leaderboard CreateLeaderboard()
        {
            // Create instance
            Leaderboard _newLeaderboard = null;

            if (isGlobalIdentifier.Value)
            {
                _newLeaderboard = NPBinding.GameServices.CreateLeaderboardWithGlobalID(identifier.Value);
            }
            else
            {
                _newLeaderboard = NPBinding.GameServices.CreateLeaderboardWithID(identifier.Value);
            }

            // Set properties
            _newLeaderboard.UserScope  = userScope;
            _newLeaderboard.TimeScope  = timeScope;
            _newLeaderboard.MaxResults = maxResults.Value;

            // Add new instance to the collection
            GameServicesUtils.AddLeaderboardToCollection(_newLeaderboard);

            return(_newLeaderboard);
        }
Beispiel #25
0
        public Leaderboard GetLeaderboard(LeaderboardFilter filter)
        {
            var data = _repo.GetLeaderboards();

            var result = new Leaderboard();

            if (data.Any())
            {
                if (filter.LeaderboardId > 0)
                {
                    result = data
                             .Where(l => l.LeaderboardId == filter.LeaderboardId).SingleOrDefault();
                }
                if (result != null)
                {
                    if (result.Entries != null)
                    {
                        result.Entries = GetLeaderboardEntries(filter, result);
                    }
                }
            }

            return(result);
        }
Beispiel #26
0
        public async Task InitializeLeaderboard()
        {
            using (Context.Channel.EnterTypingState())
            {
                try
                {
                    _logger.LogInformation("Executing init");
                    if (Context.Guild?.Id == null)
                    {
                        await ReplyAsync("Doesn't seem like this is written inside a server.");

                        return;
                    }

                    var leaderboard = await _leaderboardService.GetForServer(Context.Guild.Id.ToString());

                    if (leaderboard != null)
                    {
                        await ReplyAsync("Seems like a leaderboard is already setup on this server");

                        return;
                    }

                    leaderboard = new Leaderboard {
                        ServerId  = Context.Guild.Id.ToString(),
                        ChannelId = Context.Channel.Id.ToString()
                    };
                    await _leaderboardService.Create(leaderboard);
                    await ReplyAsync("Initialized leaderboard for this server. Users can join by using the `join` command.");
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "init failed");
                }
            }
        }
        public Leaderboard GetLeaderboard(long start, long end, int?page)
        {
            IQueryable <Pilgrimage> pilgrimages = context.Pilgrimages;
            var length = 35;

            //pilgrimages = pilgrimages.Where(d => d.StartTime >= start && d.StartTime <= end);
            pilgrimages = pilgrimages.OrderBy(d => d.Time);
            pilgrimages.Include(d => d.Locations);
            var Pages = Math.Ceiling((double)pilgrimages.Count() / length);

            if (page.HasValue)
            {
                pilgrimages.Skip(page.Value * length);
            }
            pilgrimages = pilgrimages.Take(length);
            var         pilgrimagesList = pilgrimages.ToList();
            Leaderboard leaderboard     = new Leaderboard()
            {
                pilgrimages = pilgrimagesList,
                pages       = 5
            };

            return(leaderboard);
        }
Beispiel #28
0
    void LateUpdate()
    {
        if (!RaceMonitor.racing)
        {
            canvasGroup.alpha = 0;
            return;
        }

        if (!regoSet)
        {
            carRego = Leaderboard.RegisterCar(playerName.text);
            regoSet = true;
            return;
        }

        if (carRend == null)
        {
            return;
        }

        Plane[] planes    = GeometryUtility.CalculateFrustumPlanes(Camera.main);
        bool    carInView = GeometryUtility.TestPlanesAABB(planes, carRend.bounds);

        canvasGroup.alpha       = carInView ? 1 : 0;
        this.transform.position = Camera.main.WorldToScreenPoint(target.position + Vector3.up * 1.2f);

        if (cpManager == null)
        {
            cpManager = target.GetComponent <CheckpointManager>();
        }

        Leaderboard.SetPosition(carRego, cpManager.lap, cpManager.checkPoint, cpManager.timeEntered);
        string position = Leaderboard.GetPosition(carRego);

        lapDisplay.text = position + " " + cpManager.lap + " (" + cpManager.checkPoint + ")";
    }
Beispiel #29
0
        public static async Task <Leaderboard> GetLeaderboardUserStatsAsync(ulong guildId, ulong userId, RLPlaylist playlist, bool monthly, SqlConnection conn = null)
        {
            Leaderboard rec = null;

            using (SqlCommand cmd = conn.CreateCommand())
            {
                cmd.Parameters.AddWithValue("@GuildID", DbType.Decimal).Value = (decimal)guildId;
                cmd.Parameters.AddWithValue("@Playlist", DbType.Byte).Value   = (byte)playlist;
                cmd.Parameters.AddWithValue("@UserID", DbType.Decimal).Value  = (decimal)userId;
                if (monthly)
                {
                    cmd.CommandText = "SELECT * FROM ( SELECT row_number() OVER (ORDER BY x.Wins DESC, x.TotalGames ASC) AS Rank, x.UserID, x.Wins, x.TotalGames FROM ( SELECT qp.UserID, ISNULL(SUM(CASE WHEN ((qp.Team = 0 AND q.ScoreTeamA > q.ScoreTeamB) OR (qp.Team = 1 AND q.ScoreTeamA < q.ScoreTeamB)) THEN 1 END), 0) AS Wins, COUNT(1) AS TotalGames FROM Queue q INNER JOIN QueuePlayer qp ON qp.GuildID = q.GuildID AND qp.QueueID = q.QueueID WHERE ((q.ScoreTeamA > 0 OR q.ScoreTeamB > 0) OR (DATEDIFF(hour, q.Created, GetDate()) > 24)) AND q.Created >= CAST(DATEADD(dd, -DAY(GETDATE()) + 1, GETDATE()) AS DATE) AND q.Created < CAST(DATEADD(month, DATEDIFF(month, 0, GETDATE()) + 1, 0) AS DATE) AND q.GuildID = @GuildID AND q.Playlist = @Playlist GROUP BY qp.UserID) x ) y WHERE y.UserID = @UserID;";
                }
                else
                {
                    cmd.CommandText = "SELECT * FROM ( SELECT row_number() OVER (ORDER BY x.Wins DESC, x.TotalGames ASC) AS Rank, x.UserID, x.Wins, x.TotalGames FROM ( SELECT qp.UserID, ISNULL(SUM(CASE WHEN ((qp.Team = 0 AND q.ScoreTeamA > q.ScoreTeamB) OR (qp.Team = 1 AND q.ScoreTeamA < q.ScoreTeamB)) THEN 1 END), 0) AS Wins, COUNT(1) AS TotalGames FROM Queue q INNER JOIN QueuePlayer qp ON qp.GuildID = q.GuildID AND qp.QueueID = q.QueueID WHERE ((q.ScoreTeamA > 0 OR q.ScoreTeamB > 0) OR (DATEDIFF(hour, q.Created, GetDate()) > 24)) AND q.GuildID = @GuildID AND q.Playlist = @Playlist GROUP BY qp.UserID) x ) y WHERE y.UserID = @UserID;";
                }
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        await reader.ReadAsync();

                        rec = new Leaderboard()
                        {
                            UserID     = userId,
                            Rank       = (long)reader["Rank"],
                            Wins       = (int)reader["Wins"],
                            TotalGames = (int)reader["TotalGames"]
                        };
                    }
                    reader.Close();
                }
            }
            return(rec);
        }
 void Awake()
 {
     instance = this;
 }
Beispiel #31
0
    /*
     * private void OnGUI() {
     *      GUILayout.BeginArea(new Rect(Screen.width/3, Screen.height/2, Screen.width/2, Screen.height));
     *
     *      // Display high scores!
     * //		for (int i = 0; i < Leaderboard.EntryCount; ++i) {
     * //			var entry = Leaderboard.GetEntry(i);
     * //			GUILayout.Label("Name: " + entry.name + ", Score: " + entry.score);
     * //		}
     *
     *      // Interface for reporting test scores.
     *      GUI.skin.label.fontSize = 40;
     *      GUILayout.Space(10);
     *
     *      _nameInput = GUILayout.TextField(_nameInput);
     * //		_scoreInput = GUILayout.TextField(_scoreInput);
     *
     *      if (GUILayout.Button("Submit")) {
     *              enabled = false;
     * //			int score;
     * //			int.TryParse(_scoreInput, out score);
     * //
     * //			Leaderboard.Record(_nameInput, score);
     * //
     * //			// Reset for next input.
     * //			_nameInput = "";
     * //			_scoreInput = "0";
     *      }
     *
     *      GUILayout.EndArea();
     * }
     */

    public void savescore(int score)
    {
        Leaderboard.Record(_nameInput, score);
    }
		private Leaderboard CreateLeaderboard (string _leaderboardID)
		{
			m_curLeaderboard			= NPBinding.GameServices.CreateLeaderboard(_leaderboardID);
			m_curLeaderboard.MaxResults	= m_maxScoreResults;

			return m_curLeaderboard;
		}
Beispiel #33
0
        public async Task <bool> AddPoints(Leaderboard leaderboard)
        {
            var result = await _httpClient.PostJsonAsync <HttpResponseMessage>("api/Leaderboard/AddPoints", leaderboard);

            return(result.IsSuccessStatusCode ? true : false);
        }
Beispiel #34
0
 private static string[] ReadTopScoreRawData(Leaderboard leaderboard, TimeScope timeScope, int index)
 {
     return(PlayerPrefs.GetString(PREF_TOP_SCORES + leaderboard + timeScope + index).Split('|'));
 }
    public void OnGUI()
    {
        GUILayout.BeginVertical();
        GUILayout.BeginHorizontal();

        // Column 1
        GUILayout.BeginVertical(GUILayout.Width(colWidth));
        GUILayout.Label("Azure End Point");
        AzureEndPoint = GUILayout.TextField(AzureEndPoint, GUILayout.Width(colWidth));
        GUILayout.Label("Application Key");
        ApplicationKey = GUILayout.TextField(ApplicationKey, GUILayout.Width(colWidth));
        GUILayout.EndVertical();

        // hide rest of GUI if no connection available
        GUI.enabled = ( azure != null );

        // Column 2
        GUILayout.BeginVertical(GUILayout.Width(colWidth));
        GUILayout.Label("Username");
        _leaderboard.Username = GUILayout.TextField(_leaderboard.Username);
        GUILayout.Label("Score");
        _leaderboard.Score = Convert.ToInt32( GUILayout.TextField(""+_leaderboard.Score) );
        if(GUILayout.Button("Add Score", GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            // Note: You don't need to do the following, it's done in the insert method.
            // _leaderboard.Id = null;

            if(_leaderboard.Score > 0)
            {
                // only insert score if greater than 0
                azure.Insert<Leaderboard>(_leaderboard);
            }
            else
            {
                Debug.Log("Score must be > 0 to insert");
            }
        }
        GUILayout.Label("Id: " + _leaderboard.Id); // unique item Id (returned once submitted succesfully)
        GUILayout.EndVertical();

        // Column 3
        GUILayout.BeginVertical(GUILayout.Width(colWidth));
        if (GUILayout.Button("Query User Scores", GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            _leaderboardItems.Clear();
            // get a user's scores
            azure.Where<Leaderboard>( p => p.Username == _leaderboard.Username, ReadHandler);
        }
        if (GUILayout.Button("List All Scores",  GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            GetAllItems();
        }
        if (GUILayout.Button("List Scores 500+",  GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            _leaderboardItems.Clear();
            // get high scores
            azure.Where<Leaderboard>( p => p.Score >= 500, ReadHandler);
        }
        GUILayout.Label("Item count: " + _leaderboardItems.Count);
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Height(300));

        // Column 4
        GUILayout.BeginVertical();
        foreach (var item in _leaderboardItems)
        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(">", GUILayout.Width(width), GUILayout.Height(height) ))
            {
                _selectedItem = item;
            }
            GUILayout.Label(item.Username);
            GUILayout.Label(Convert.ToString(item.Score));
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        GUILayout.EndScrollView();
        GUILayout.EndVertical();

        GUILayout.BeginVertical(GUILayout.Width(colWidth));

        var was = GUI.enabled;

        GUI.enabled = _selectedItem.Id != null;

        GUILayout.Label("Id: " + _selectedItem.Id);
        if(_selectedItem.Score > 0)
        {
            _selectedItem.Score = Convert.ToInt32( GUILayout.TextField(""+_selectedItem.Score) );
        }
        _selectedItem.Username = GUILayout.TextField(_selectedItem.Username);

        if (GUILayout.Button("Update", GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            azure.Update<Leaderboard>(_selectedItem);
        }
        if (GUILayout.Button("Delete", GUILayout.MinWidth(width), GUILayout.Height(height) ))
        {
            azure.Delete<Leaderboard>(_selectedItem);
        }

        GUI.enabled = was;

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUI.enabled = true;
    }
Beispiel #36
0
 void Awake()
 {
     blitz     = LoadOrCreateLeaderboard(Path.Combine(Application.persistentDataPath, "Blitz.lb"), GameMode.blitz);
     word_rush = LoadOrCreateLeaderboard(Path.Combine(Application.persistentDataPath, "WordRush.lb"), GameMode.word_rush);
     standard  = LoadOrCreateLeaderboard(Path.Combine(Application.persistentDataPath, "Standard.lb"), GameMode.standard);
 }
    void Start()
    {
        numberConverter = GetComponent<NumberToNumberTexture>();

        leaderboard = GetComponent<Leaderboard>();
        leaderboard.enabled = false;

        FileMgr = GetComponent<SaveLoadFromFile>();
        LoadRecords();
    }
		private void SetLocalPlayerScore(Leaderboard board){}
		private void SortScores(Leaderboard board){}
Beispiel #40
0
        public void ShowLeaderboard()
        {
            PlayfabTaskLeaderboard task = PlayfabManager.Leaderboard.GetLeaderboard("Highscore", 0, 100);

            task.OnTaskCompleted += (lbTask) =>
            {
                if (lbTask.Success)
                {
                    PlayfabTaskLeaderboard leaderboardTask = (PlayfabTaskLeaderboard)lbTask;
                    Leaderboard            leaderboard     = leaderboardTask.Leaderboard;

                    GameObject[] entries = new GameObject[leaderboard.Entries.Count];

                    for (int i = 0; i < leaderboard.Entries.Count; ++i)
                    {
                        LeaderboardEntry entry = leaderboard.Entries[i];

                        GameObject lbEntryObj = AddGameObject($"Entry{i}");
                        lbEntryObj.Enabled = false;
                        entries[i]         = lbEntryObj;

                        lbEntryObj.Transform.Position = new Vector3(0, -20 * i, -1f);

                        _lowestScroll = -20 * i;

                        Sprite entrySprite = lbEntryObj.AddComponent <Sprite>();
                        entrySprite.Texture = ResourceManager.Load <Texture2D>("Textures/buttons.png");

                        entrySprite.SourceRectangle = new Rectangle(0, 40, 128, 18);

                        if (i == 0)
                        {
                            entrySprite.SourceRectangle = new Rectangle(0, 58, 128, 18);
                        }
                        else if (i == 1)
                        {
                            entrySprite.SourceRectangle = new Rectangle(0, 58 + 18, 128, 18);
                        }
                        else if (i == 2)
                        {
                            entrySprite.SourceRectangle = new Rectangle(0, 58 + 18 * 2, 128, 18);
                        }

                        entrySprite.Offset   = new Vector2(-entrySprite.Texture.Width / 2, -entrySprite.Texture.Height / 2);
                        entrySprite.Priority = 0.1f;

                        TextComponent text = lbEntryObj.AddComponent <TextComponent>();
                        text.Alignment = TextAlignment.Left;
                        text.Offset    = new Vector2(-62, -64);

                        string name = entry.displayName;
                        if (name != null && name.Length > 12)
                        {
                            name  = name.Substring(0, 10);
                            name += "..";
                        }

                        text.DisplayText = $"{entry.position}. {name} - {entry.value.ToString("#,##")}";
                        text.Color       = Color.Black;
                    }

                    CoroutineManager.StartCoroutine(DefaultRoutines.LinearRepeat(1.0f, (x) =>
                    {
                        for (int i = 0; i < entries.Length; ++i)
                        {
                            entries[i].Transform.Rotation2D = JMath.Sin(Time.TotalSeconds + i) * (JMath.PI_OVER_TWO / 32);
                        }
                    }));

                    CoroutineManager.StartCoroutine(RevealLeaderboard(entries));
                }
                else
                {
                    System.Console.WriteLine("Failed to get leaderboards... :(");
                }
            };
        }
    void OnRoarFetchLeaderboardsComplete(Roar.CallbackInfo info)
    {
        whenLastFetched = Time.realtimeSinceStartup;
        isFetching = false;
        leaderboardsRaw = boards.List();

        leaderboards = new List<Leaderboard>(leaderboardsRaw.Count);
        Leaderboard leaderboard;
        foreach (Hashtable data in leaderboardsRaw)
        {
            leaderboard = new Leaderboard();
            leaderboard.id = data["board_id"] as string;
            leaderboard.key = data["ikey"] as string;
            leaderboard.label = data["label"] as string;
            if (leaderboard.label.Length == 0)
                leaderboard.label = string.Format("Leaderboard{0}", leaderboard.id);
            leaderboard.ranking = new Roar.implementation.Components.Ranking(leaderboard.id, roar.DataStore, roar.Logger);

            leaderboards.Add(leaderboard);
        }
    }
Beispiel #42
0
        // Game Center take care of offline score and achievements automatically, Play Games sucks and need to take care of with cache
#if UNITY_ANDROID
        private static long GetCachedHighScore(Leaderboard leaderboard)
        {
            return((long)PlayerPrefs.GetInt(PREF_CACHED_HIGH_SCORE + leaderboard.ToString()));
        }
Beispiel #43
0
    public void Awake()
    {
        DontDestroyOnLoad(this);
        NetworkPlayers = new List<uLink.NetworkPlayer>();

        ServerNotifier = new ExternalServerNotifier();

        Leaderboard = new Leaderboard();
        Leaderboard.Skin = Relay.Instance.BaseSkin;

        StatusMessage = "?";

        BannerMessages = new List<BannerMessage>();

        if (networkView.isMine)
        {
            _CurrentMapName = Application.loadedLevelName;
            IsGameActive = false;
            // Set up hooks for UPnP
            PortMapper = new PortMapper(Relay.Port);
        }
    }
Beispiel #44
0
 private void WriteLeaderBoard(int position = 0)
 {
     var leaderboard = new Leaderboard().CreateHTML(TheScores, position);
     File.WriteAllText(LeaderBoardPath, leaderboard, Encoding.UTF8);
 }
Beispiel #45
0
    private void SetName()
    {
        if (_nameList[_nowSetNameID] == "-")
        {
            _nameList[_nowSetNameID] = "A";
        }
        // デバック
        Debug.Log(_names[_nowCharID].ToString());
        _nameList[_nowSetNameID] = _names[_nowCharID].ToString();

        //// 決定ボタンで次の名前のIDに進む
        //if (_gamePad.GetButtonDown("A"))
        //{
        //    _nowSetNameID++;
        //}
        //// Cancelボタンで前の名前のIDに戻る
        //else if (_gamePad.GetButtonDown("B"))
        //{
        //    _nowSetNameID--;
        //}

        if (Input.GetKeyDown(KeyCode.D))
        {
            _nowSetNameID++;
            if (_nowSetNameID > _nameLength - 1)
            {
                _nowSetNameID = 0;
                var tmpScore = GameObject.Find("Score").GetComponent <Score>();
                tmpScore.PlayerName = _text.text;
                Leaderboard.Record(tmpScore.PlayerName, tmpScore.ScoreSetting);
                _rankingUI.gameObject.SetActive(true);
                gameObject.transform.parent.gameObject.SetActive(false);
            }
        }
        else if (Input.GetKeyDown(KeyCode.B))
        {
            _nowSetNameID--;
            _nowCharID = 0;
        }
        if (_gamePad.GetButtonDown("X"))
        {
            _nowSetNameID++;
            if (_nowSetNameID > _nameLength - 1)
            {
                _nowSetNameID = 0;
                var tmpScore = GameObject.Find("Score").GetComponent <Score>();
                tmpScore.PlayerName = _text.text;
                Leaderboard.Record(tmpScore.PlayerName, tmpScore.ScoreSetting);
                _rankingUI.gameObject.SetActive(true);
                gameObject.transform.parent.gameObject.SetActive(false);
            }
        }

        // ID超え対策
        if (_nowSetNameID > _nameLength - 1)
        {
            _nowSetNameID = _nameLength - 1;
        }
        else if (_nowSetNameID < 0)
        {
            _nowSetNameID = 0;
        }
    }
 public Leaderboard Create()
 {
     Leaderboard lb = new Leaderboard();
     lb.id = id;
     lb.SetTitle(title);
     return lb;
 }
Beispiel #47
0
 public static void Report(Leaderboard leaderboard, int score)
 {
     Report(leaderboard, (long)score);
 }
Beispiel #48
0
 public void CalculatePoints_Default_SetsPointsBasedOnPosition(int position, int expectedPoints)
 {
     var leaderboard = new Leaderboard();
     leaderboard.CalculatePoints(position).Should().Be(expectedPoints);
 }
Beispiel #49
0
 private static void SetMyLeaderboardEntry(Leaderboard leaderboard, LeaderboardEntry leaderboardEntry)
 {
     _myLeaderboardEntries[(int)leaderboard] = leaderboardEntry;
     WriteMyLeaderboardEntry(leaderboard);
 }
Beispiel #50
0
    // Initialization.
    void Awake()
    {
        Debug.Log("Initialisation");
        startTime = Time.realtimeSinceStartup;
        Debug.Log("Awake Time ---> " + startTime);

        GameObject.Find("Main Camera").AddComponent<AudioListener>();
        GameObject cam = GameObject.Find("Main Camera");
        if (cam.GetComponent<AudioListener>() == null) cam.AddComponent<AudioListener>();
        //boardArray keeps track of which positions on the board is occupied.
        boardArray = new bool[nx,ny,nz];
        Array.Clear(boardArray, 0, boardArray.Length);
        blockCtrl = GetComponent<BlockControl>();
        blockCtrl.enterPressed = false;
        //pinsPerShape = blockCtrl.getShapeSize();
        blocksLayer = new GameObject [ny];
        blocksInLayer = new int[ny];
        Array.Clear(blocksInLayer, 0, blocksInLayer.Length);

        //creating the bounding walls in the array
        for(int i=0; i< ny;i++){
            for(int j=0;j < nx;j++){
                boardArray[j,i,0] = true;
                boardArray[j,i,nz-1] = true;
                boardArray[0,i,j] = true;
                boardArray[nx-1,i,j] = true;
                //print (boardArray[j,i,0]);
            }
        }
        for (int i=0; i<ny; i++){
            blocksLayer[i] = new GameObject();
            String layerName = "Layer" + i;
            blocksLayer[i].name = layerName;
            addToScene(blocksLayer[i]);
        }

        //initialise textures for the GUI.
        initTextures();

        //Creates an array to store the 4 images of the lego pieces.
        //Number of pieces that are suggested and number of total pieces
        //  are currently hard-coded.
        lego = new Texture2D[4];

        lego[0] = Resources.Load("L2x1lit") as Texture2D;
        lego[1] = Resources.Load("L2x2lit") as Texture2D;
        lego[2] = Resources.Load("L3x2lit") as Texture2D;
        lego[3] = Resources.Load("L4x2lit") as Texture2D;

        legoSuggestions = new int[3];

        //shadow layer
        GameObject slayer = new GameObject();
        String lName = "ShadowLayer";
        slayer.name = lName;
        addToScene(slayer);

        flashPass = 0;

        grid = Resources.LoadAssetAtPath("Assets/Resources/grid_square.prefab", typeof(GameObject));
        DrawBoard();

        createTopCamera();
        //first = true;
        audio_source = GameObject.Find("Main Camera").GetComponent<AudioSource>();
        wrong_piece_sound = GameObject.Find("Main Camera").AddComponent<AudioSource>();
        wrong_piece_sound.clip = (AudioClip) Resources.LoadAssetAtPath("Assets/Music/error.wav", typeof(AudioClip));

        // Only uncomment if you want to *change* the music
        //		startMusic("Theme1");

        //start gameplay

        gOver = GetComponent<GameOver>();
        lboard = GetComponent<Leaderboard>();

        blockCtrl.assignTimeGap(timeGap);
    }
Beispiel #51
0
        // Compares the player score with the leaderboard, and do update if neccessary, for offline only
        // If online and connected to Game Center / Play Games, this is not neccessary and new downloaded leaderboard will override this
        private static void CompareScoreToLeaderboard(Leaderboard leaderboard = (Leaderboard)0, TimeScope timeScope = TimeScope.AllTime)
        {
            if (!instanceExists)
            {
                return;
            }

            if (instance.debugMode)
            {
                Debug.LogFormat("LeaderboardManager:CompareScoreToLeaderboard({0},{1})", leaderboard, timeScope);
            }

            List <LeaderboardEntry> topScores          = GetTopScores(leaderboard, timeScope);
            LeaderboardEntry        myLeaderboardEntry = GetMyLeaderboardEntry(leaderboard);

            int loadTopScoreCount = topScores.Count;
            int myRank            = GetMyLeaderboardRank(leaderboard, timeScope);

            bool topScoresChanged = myRank <= loadTopScoreCount;

            if (topScoresChanged)             // Update my rank row first
            {
                topScores[myRank - 1] = new LeaderboardEntry(GetMyLeaderboardEntry(leaderboard), myRank);
            }

            for (int i = Mathf.Min(loadTopScoreCount, myRank - 1) - 1; i >= 0; i--)               // From either my upper rank, or top scores bottom, check toward top

            {
                LeaderboardEntry le = topScores[i];                 // This top score entry

                if (GetMyLeaderboardScore(leaderboard) <= le.score) // Not better than this top score, just break
                {
                    break;
                }

                topScoresChanged = true;

                int newRank = i + 1;                 // i >= 0 but rank >= 1, so +1
                if (timeScope == TimeScope.AllTime)
                {
                    SetMyLeaderboardRank(leaderboard, newRank);
                }

                topScores[i] = new LeaderboardEntry(myLeaderboardEntry, newRank);
                Debug.Log(i + "|" + topScores[i]);
                // Move the ranks down
                if (i == loadTopScoreCount - 1)                 // Skip if the bottom
                {
                    continue;
                }
                topScores[i + 1] = new LeaderboardEntry(le, newRank + 1);
            }

            if (instance.debugMode)
            {
                Debug.LogFormat("LeaderboardManager:CompareScoreToLeaderboard - topScoresChanged={0}", topScoresChanged);
            }

            if (topScoresChanged)
            {
                SetTopScores(leaderboard, timeScope, topScores);
                // Do a update too, the online score may also get changed
                DownloadLeaderboardTopScores(leaderboard, timeScope);
            }
        }
Beispiel #52
0
 internal bool Contains(Leaderboard board)
 {
     return(this.m_GenericLeaderboard == board);
 }
Beispiel #53
0
 public void act_savePlayerName()
 {
     Leaderboard.Record(_inputField.text, score_from_the_game);
     ProceedToShowScore();
 }
Beispiel #54
0
        public void Update(Leaderboard leaderboard)
        {
            using (var context = ContextFactory.Create())
            {
                var existing = context.Leaderboards.Find(leaderboard.Token, leaderboard.GameId);

                if (existing != null)
                {
                    context.Entry(existing).State = EntityState.Modified;

                    var hasConflicts = context.Leaderboards.Where(l => (l.Name == leaderboard.Name && l.GameId == leaderboard.GameId));

                    if (hasConflicts.Any())
                    {
                        if (hasConflicts.Any(a => a.Token != leaderboard.Token))
                        {
                            throw new DuplicateRecordException($"A leaderboard with the name {leaderboard.Name} for this game already exists.");
                        }
                    }
                    else
                    {
                        var hasTypeConflicts = ((int)leaderboard.LeaderboardType < 3 && ((int)leaderboard.EvaluationDataType == 1 || (int)leaderboard.EvaluationDataType == 2)) ||
                                               ((int)leaderboard.LeaderboardType > 2 && ((int)leaderboard.EvaluationDataType == 0 || (int)leaderboard.EvaluationDataType == 3)) ? false : true;

                        if (hasTypeConflicts)
                        {
                            throw new System.ArgumentException($"A leaderboard cannot be updated to use LeaderboardType {leaderboard.LeaderboardType} and EvaluationDataType {leaderboard.EvaluationDataType}, as it would always return zero results.");
                        }

                        var hasScopeConflicts = leaderboard.CriteriaScope > 0 && (int)leaderboard.LeaderboardType != 2 && (int)leaderboard.LeaderboardType != 3;

                        if (hasScopeConflicts)
                        {
                            throw new System.ArgumentException($"A leaderboard cannot be updated with LeaderboardType {leaderboard.LeaderboardType} and CriteriaScope {leaderboard.CriteriaScope}.");
                        }

                        var hasActorConflicts = ((int)leaderboard.CriteriaScope == 1 && (int)leaderboard.ActorType == 0) ||
                                                ((int)leaderboard.CriteriaScope > 1 && (int)leaderboard.ActorType != 2);

                        if (hasActorConflicts)
                        {
                            throw new System.ArgumentException($"A leaderboard cannot be created with ActorType {leaderboard.ActorType} and CriteriaScope {leaderboard.CriteriaScope}.");
                        }
                    }

                    existing.Name = leaderboard.Name;
                    existing.EvaluationDataKey  = leaderboard.EvaluationDataKey;
                    existing.ActorType          = leaderboard.ActorType;
                    existing.CriteriaScope      = leaderboard.CriteriaScope;
                    existing.EvaluationDataType = leaderboard.EvaluationDataType;
                    existing.GameId             = leaderboard.GameId;
                    existing.LeaderboardType    = leaderboard.LeaderboardType;
                    existing.Token = leaderboard.Token;

                    context.SaveChanges();
                }
                else
                {
                    throw new MissingRecordException($"The existing leaderboard with token {leaderboard.Token} and game ID {leaderboard.GameId} could not be found.");
                }
            }
        }
Beispiel #55
0
 /// <summary>
 /// Returns a page from the Leaderboard with the request parameters, by default 25 entries are 
 /// are returned per page. 
 /// </summary>
 public static void LeaderboardPage(UInt32 pageNumber, Leaderboard.SortBy sortBy, UInt32 pageSize)
 {
     /*
     RequestHeader.Builder hdr_request = RequestHeader.CreateBuilder ();
     hdr_request.SetAccessToken (SenseixSession.GetAccessToken());
     Leaderboard.PageRequest.Builder lbPage = Leaderboard.PageRequest.CreateBuilder ();
     lbPage.SetPage (pageNumber);
     lbPage.SetSortBy (sortBy);
     lbPage.SetPageSize (pageSize);
     hdr_request.SetPage (lbPage);
     //Debug.Log ("Leaderboard page request going off to " + GET_Leaderboard_PAGE_URL);
     SyncronousPostRequest (ref hdr_request, Constant.MessageType.LeaderboardPage, GET_LEADERBOARD_PAGE_URL);
     */
 }
 protected override void CallDispose(HandleRef selfPointer)
 {
     Leaderboard.Leaderboard_Dispose(selfPointer);
 }
Beispiel #57
0
 public void Reset()
 {
     Leaderboard.ResetScore();
 }
 internal string Title()
 {
     return(PInvokeUtilities.OutParamsToString(delegate(StringBuilder out_string, UIntPtr out_size) {
         return Leaderboard.Leaderboard_Name(base.SelfPtr(), out_string, out_size);
     }));
 }
Beispiel #59
0
        public void ShowLeaderboard()
        {
            Leaderboard form = new Leaderboard();

            form.Show();
        }
		public async Task<Leaderboard> GetLeaderboard()
		{
			Leaderboard result = new Leaderboard();
			result.Id = Guid.Empty;
			result.Date = DateTime.Today;

			using (var context = _contextFactory.Invoke())
			{
				var singleLeader = await context.Query<GameResult>().Where(x => x.GameType == GameType.SinglePlayerGame).OrderByDescending(x => x.TotalScore).FirstOrDefaultAsync();
				var teamLeader = await context.Query<GameResult>().Where(x => x.GameType == GameType.TeamGame).OrderByDescending(x => x.TotalScore).FirstOrDefaultAsync();
				var childLeader = await context.Query<GameResult>().Where(x => x.GameType == GameType.ChildGame).OrderByDescending(x => x.TotalScore).FirstOrDefaultAsync();
				var womenLeader = await context.Query<GameResult>().Where(x => x.GameType == GameType.WomenGame).OrderByDescending(x => x.TotalScore).FirstOrDefaultAsync();

				result.SinglePlayerContestLeader = FromGameResult(singleLeader);
				result.TeamContestLeader = FromGameResult(teamLeader);
				result.ChildrenContestLeader = FromGameResult(childLeader);
				result.WomenContestLeader = FromGameResult(womenLeader);
			}

			return result;			
		}