/// <summary>
 /// Creates a new level saving view
 /// </summary>
 /// <param name="game">The Game instance that will show this view</param>
 public LevelSaver(Game1 game)
     : base(game)
 {
     nameInput = new TextInput("Enter the name of you level", new Vector2(200, 200),
                               game.Content, 400, 50);
     closeButton = new Button("ok", new Vector2(300, 350), game.Content);
     closeButton.ButtonPressed += new Action<Button>(closeButton_ButtonPressed);
 }
Example #2
0
        /// <summary>
        /// Creates a new view for telling that the player has completed the level
        /// </summary>
        /// <param name="game">The Game instance that will show this view</param>
        public WinView(Game1 game)
            : base(game)
        {
            recordHandler = new RecordHandler(game.currentLevelName);
            recordHandler.LoadRecords();
            closeButton = new Button("ok", new Vector2(0, 0), game.Content);
            closeButton.ButtonPressed += new Action<Button>(closeButton_ButtonPressed);

            closeButton.Position = new Vector2(game.getWidth() * 0.5f -
                                                  closeButton.Width * 0.5f,
                                               game.getHeight() * 0.75f);
            textInput = new TextInput("Enter your name here",
                                      new Vector2(game.getWidth() * 0.3f, game.relativeY(200)),
                                      game.Content, (int)(game.getWidth() * 0.4f),
                                      (int)(game.getHeight() * 0.1f));
            font = game.Content.Load<SpriteFont>("SpriteFont2");
            placement = recordHandler.GetPlacement((int)(game.finishTime.TotalMilliseconds));
        }