예제 #1
0
파일: Game1.cs 프로젝트: burbruee/ta-cs
        private void DrawHighscores()
        {
            spriteBatch.Draw(levelChangeTexture, new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), Color.White);
            Vector2 hsPos = new Vector2(250, 150);

            spriteBatch.DrawString(title, "TROLLArena Highscores TOP10", new Vector2(450, 50), Color.Yellow);

            try
            {
                List <string[]> ls = new List <string[]>();
                ls = Highscores.HttpGet("http://highscore.ettfyratre.se/api.php", "?ModeID=1&Format=TOP10");

                Color colNick;

                for (int i = 0; i < 10; i++)
                {
                    if (ls[i][1] == text)
                    {
                        colNick = new Color(255, 255, 0);
                    }
                    else
                    {
                        colNick = new Color(255, 255, 255);
                    }

                    spriteBatch.DrawString(title, ls[i][0], hsPos, colNick);
                    spriteBatch.DrawString(title, ls[i][1], new Vector2(500, hsPos.Y), colNick);
                    spriteBatch.DrawString(title, ls[i][2], new Vector2(1000, hsPos.Y), colNick);
                    hsPos.Y += 50;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                spriteBatch.DrawString(title, "Could not connect to server! Highscore not posted online.", hsPos, Color.White);
            }
        }