Ejemplo n.º 1
0
        public LevelOverScreen(Level level, HalfCakedGame game)
            : base("Level Complete!", new string[] {"Next Level", "Play Again", "Exit"}, 0)
        {
            IsPopup = true;
            mLevel = level;

            // Hook up menu event handlers.
            Buttons[0].Pressed += NextLevelMenuEntrySelected;
            Buttons[1].Pressed += ResetMenuEntrySelected;
            Buttons[2].Pressed += QuitGameMenuEntrySelected;

            Profile prof = game.CurrentProfile;
            String scoreString = "\n";

            if (prof.CurrentLevel < Level.MAX_LEVELS - 1 && prof.CurrentLevel == level.LevelIdentifier)
                prof.CurrentLevel++;

            if (prof.LevelStatistics[mLevel.LevelIdentifier] == null ||
                prof.LevelStatistics[mLevel.LevelIdentifier].Score > level.LevelStatistics.Score)
            {
                scoreString += "Congratulations! You set a new high score.\n";
                level.LevelStatistics.Date = DateTime.Now;
                prof.LevelStatistics[mLevel.LevelIdentifier] = level.LevelStatistics;
                Profile.SaveProfile(prof, "default.sav", game.Device);
            }
            else
            {
                scoreString += "High Score: " + prof.LevelStatistics[mLevel.LevelIdentifier].Score + "\n";
            }
            scoreString += "Your Score: " + level.LevelStatistics.Score + "\n";

            mMessage += scoreString;
        }
Ejemplo n.º 2
0
        public LevelOverScreen(Level level, HalfCakedGame game)
            : base("Level Complete!", "", new string[] {"Next Level", "Play Again", "Exit"}, 0)
        {
            IsPopup = true;
            mLevel = level;

            // Hook up menu event handlers.
            Buttons[0].Pressed += NextLevelMenuEntrySelected;
            Buttons[1].Pressed += ResetMenuEntrySelected;
            Buttons[2].Pressed += QuitGameMenuEntrySelected;
            Cancelled += QuitGameMenuEntrySelected;

            Profile prof = game.CurrentProfile;

            if (level.LevelIdentifier != -1) //One of the default levels
            {
                if (prof.CurrentLevel < Level.INIT_LID_FOR_WORLD.Last() && prof.CurrentLevel == level.LevelIdentifier)
                    prof.CurrentLevel++;

                if (prof.LevelStatistics[mLevel.LevelIdentifier] == null ||
                    prof.LevelStatistics[mLevel.LevelIdentifier].Score < level.LevelStatistics.Score)
                {
                    mContentLabel.Text = "Congratulations! You set a new High Score: " + level.LevelStatistics.Score;
                    level.LevelStatistics.Date = DateTime.Now;
                    prof.LevelStatistics[mLevel.LevelIdentifier] = level.LevelStatistics;

                    if (prof.GlobalIdentifer != -1)
                        level.LevelStatistics.UploadScore(prof.GlobalIdentifer);
                    else
                        prof.Register();

                    Profile.SaveProfile(prof, "default.sav", game.Device);
                }
                else
                {
                    mContentLabel.Text = "High Score: " + prof.LevelStatistics[mLevel.LevelIdentifier].Score
                                          + "   |   Your Score: " + level.LevelStatistics.Score;
                }
            }
            else //Custom level code
            {
                var entry = prof.CustomLevelStatistics.Find(x => x.Key == level.CustomLevelIdentifier);
                if (entry == null || entry.Value.Score < level.LevelStatistics.Score)
                {
                    mContentLabel.Text = "Congratulations! You set a new High Score: " + level.LevelStatistics.Score;
                    level.LevelStatistics.Date = DateTime.Now;

                    if(entry != null)
                        entry.Value = level.LevelStatistics;
                    else
                        prof.CustomLevelStatistics.Add(new KeyValuePair<Guid,Statistics>(level.CustomLevelIdentifier, level.LevelStatistics));

                    Profile.SaveProfile(prof, "default.sav", game.Device);
                }
                else
                {
                    mContentLabel.Text = "High Score: " + entry.Value.Score + "   |   Your Score: " + level.LevelStatistics.Score;
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     LevelCreator.CreateAndSaveLevel(1);
     using (HalfCakedGame game = new HalfCakedGame())
     {
         game.Run();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (HalfCakedGame game = new HalfCakedGame())
     {
         game.Run();
     }
 }