Exemplo n.º 1
0
        protected void UpdatePercentage(LeaderboardScore score)
        {
            // find new percentage
            LeaderboardPercentage percentage = null;

            foreach (var item in cachedPercentages)
            {
                if (percentage.lowerBorder < score.score)
                {
                    score.percentage = item;
                }
            }
        }
Exemplo n.º 2
0
        public void SubmitScore(Reference <CoflnetUser> user, int score)
        {
            if (!scores.ContainsKey(user))
            {
                scores[user] = new LeaderboardScore(user);
            }

            scores[user].score = score;
            // check if next percentage is reached
            if (scores[user].percentage.upperBorder < score)
            {
                UpdatePercentage(scores[user]);
            }
        }
Exemplo n.º 3
0
 public void AddScoreForFriend(LeaderboardScore score)
 {
     scores.Add(score);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Points remaining the till next percentage mark is reached.
        /// </summary>
        /// <returns>The points till next percentage.</returns>
        /// <param name="user">User.</param>
        public int PointsTillNextPercentage(Reference <CoflnetUser> user)
        {
            LeaderboardScore score = scores[user];

            return(score.percentage.upperBorder - score.score);
        }