Пример #1
0
        public EndComponent(Game game, HighScore result)
            : base(game)
        {
            this.result = result;

            inputField = new InputField(Game, new Vector2(100, 280), new Vector2(350, 50), defealtName);
        }
Пример #2
0
        //===================================================================== INITIALIZE
        public HighScoreScene(Window container, Mode mode, int newLevel, int newScore)
            : base(container)
        {
            _mode = mode;

            LoadScores();

            _newScore = new HighScore(_lastName, newLevel, newScore);
            AddScoreIfGreater(_newScore);

            _rectHighScore = new Rectangle((Container.Rectangle.Width - HIGH_SCORE_WIDTH) / 2, Game.MARGIN * 5, HIGH_SCORE_WIDTH, HIGH_SCORE_HEIGHT);
        }
Пример #3
0
        //===================================================================== FUNCTIONS
        public override void Update()
        {
            if (IsEditing)
            {
                UpdateNameInput();
                if (Input.IsTrigger(Keys.Enter) && _newScore.Name.Length > 0)
                {
                    _newScore.Name = _lastName = _newScore.Name.Replace("_", "");
                    SaveScores();

                    _newScore = null;
                    NewScoreIndex = -1;
                }
            }
            else
            {
                if (_mode == Mode.Marathon && Input.IsTrigger(Keys.Right))
                    _mode = Mode.TimeAttack;
                else if (_mode == Mode.TimeAttack && Input.IsTrigger(Keys.Left))
                    _mode = Mode.Marathon;
                if (Input.IsTrigger(Keys.Enter))
                    Container.Scene = new GameScene(Container, _mode);
            }
        }
Пример #4
0
 private void AddScoreIfGreater(HighScore score)
 {
     if (_newScore.Score > Scores[Scores.Count - 1].Score)
     {
         Scores.RemoveAt(Scores.Count - 1);
         Scores.Add(_newScore);
         Scores.Sort();
     }
 }
Пример #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            HighScore highScore = new HighScore();

            highScore.ShowDialog();
        }
Пример #6
0
 public static void addBest(HighScore newScore)
 {
     scores.Add(newScore);
     HighScore.Save(scores);
 }