Exemplo n.º 1
0
        /// <summary>
        /// Add item to the list.
        /// </summary>
        /// <param name="item"></param>
        /// <returns>True if item made it in the top 5, False in not.</returns>
        public bool add(HighScoreItem item)
        {
            highScores.Add(item);
            highScores.Sort();

            if (highScores.Count > 5)
            {
                bool madeit = false;

                HighScores temp = new HighScores();
                for (int i = 0; i < 5; i++)
                {
                    temp.highScores[i] = this.highScores[i];
                    if (temp.highScores[i].Equals(item))
                    {
                        madeit = true;
                    }
                }
                this.highScores = temp.highScores;

                return(madeit);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This is used to generate a new HighScoreItem object, that needs to be added to the highScores lists.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="ticks"></param>
        /// <param name="type"></param>
        /// <param name="diff"></param>
        public void submitHighScore(string name, int ticks, gameType type, Difficulty diff)
        {
            HighScoreItem item = new HighScoreItem();

            item.player = name;
            item.time   = ticks;
            HS.add(item, type, diff);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds an entry to the map, according to the gameType and Difficulty parameters
        /// </summary>
        /// <param name="item">HighScoreItem to be added.</param>
        /// <param name="type">Standard or Squiggly</param>
        /// <param name="diff">Easy, Medium or Hard</param>
        /// <returns></returns>
        public bool add(HighScoreItem item, gameType type, Difficulty diff)
        {
            int d = diff == Difficulty.Easy ? 0 : (diff == Difficulty.Medium ? 1 : 2);

            return(HS[type][d].add(item));
        }