Example #1
0
        public bool Initialise()
        {
            // Get top ten
            var topTen = _leaderboardManager.GetTopTenScores();

            // Default placements
            var yOffset     = 20;
            var xOffset     = 30;
            var ySeperation = 40;

            // Go through each and generate the text
            for (int i = 0; i < 10; i++)
            {
                // Get the score
                var score = i < topTen.Count ? topTen[i] : new Score()
                {
                    Name = "", PlayerScore = -1
                };

                // Build the strings
                var stringBuilder = new StringBuilder();
                stringBuilder.Append($"{i + 1}. {score.Name}".PadRight(20));

                if (score.PlayerScore > -1)
                {
                    stringBuilder.Append($"{score.PlayerScore} Points");
                }

                _text.Add(_textFactory.GenerateText(stringBuilder.ToString(), xOffset, yOffset + (ySeperation * i)));
            }

            return(true);
        }