/// <summary> /// Gets or creates a high score table for the current game /// settings. /// </summary> public HighScoreTable GetTable(Config config) { // Go through the list foreach (HighScoreTable table in Tables) { // See if it matches if (config.SelectionType == table.SelectionType && config.BoardSize == table.BoardSize && config.LanguageName == table.LanguageName) { // This is it return(table); } } // Create a new one HighScoreTable hst = new HighScoreTable(); hst.SelectionType = config.SelectionType; hst.BoardSize = config.BoardSize; hst.LanguageName = config.LanguageName; // Add and return it Tables.Add(hst); return(hst); }
/// <summary> /// Adds the game over screen sprites. /// </summary> private void AddGameOver() { // TODO should be a sprite scene builder IDrawable drawable = Game.Theme.DrawableFactory.Create("game-over"); DrawableSprite ds = new DrawableSprite(drawable); ds.X = ds.Y = 0; ds.Width = viewport.Width; ds.Height = viewport.Height; sprites.Add(ds); // Queue the redraw QueueDraw(); // Do the high score processing HighScoreTable hst = Game.HighScores.GetTable(Game.Config); if (hst.IsHighScore(Game.Score)) { // We need to get the username UserNameDialog dialog = new UserNameDialog(); dialog.Run(); dialog.Destroy(); // Register it hst.RegisterScores(Game.Config.UserName, Game.Score); } // Show the high score HighScoreWindow hsw = new HighScoreWindow(); hsw.ShowAll(); }