Пример #1
0
        public override void Draw(GraphicsDevice graphics, SpriteBatch spriteBatch)
        {
            if (scores == null)
            {
                serverHandler.BeginFetchHighScores();
            }
            spriteFont = Stuff.Content.Load<SpriteFont>("Fonts\\loadingfont");
            spriteFont2 = Stuff.Content.Load<SpriteFont>("Fonts\\highscores");
            position = new Vector2(100, 30);
            graphics.Clear(Color.Black);
            spriteBatch.Begin();
            spriteBatch.DrawString(
                spriteFont,
                "High Scores",
                position,
                fontColor);
            if (serverHandler.ScoresFetched)
            {
                scores = serverHandler.HighScores();
                int i = 0;
                foreach (string entry in scores.players)
                {
                    spriteBatch.DrawString(
                                spriteFont2,
                                entry + " " + scores.scores[i],
                                new Vector2(100, 100 + i * 25),
                                fontColor);
                    i++;
                }
            }
            else
            {
                int x = 0;
                string loading = "Loading";
                while (x < dots) {
                    loading += ".";
                    x++;
                }
                spriteBatch.DrawString(
                    spriteFont,
                    loading,
                    new Vector2(400, 100),
                    fontColor);
                dots++;
                if (dots > 5)
                {
                    dots = 0;
                }
            }

            btnBack.Draw(spriteBatch);
            //btnUpdate.Draw(spriteBatch);
            spriteBatch.End();
        }
Пример #2
0
 public ScoreTable HighScores()
 {
     ScoreTable scoreTable = new ScoreTable();
     string[] splitResponse = responseString.Split(' ');
     if (responseString != "Could not get high scores.")
     {
         foreach (string x in splitResponse)
         {
             string[] split = x.Split('_');
             scoreTable.Add(split[1], split[2]);
         }
     }
     return scoreTable;
 }
Пример #3
0
 private void Controls()
 {
     if (btnBack.active)
     {
         Sound.PlayMenuTapSound();
         screenManager.CurrentMenu = -1;
         scores = null;
     }
     //if (btnUpdate.active)
     //{
     //    screenManager.Server.BeginFetchHighScores();
     //}
 }