32using System.Collections.Generic;
33using System.ComponentModel;
44 [EditorBrowsable(EditorBrowsableState.Never)]
70 System.Collections.IEnumerator
System.Collections.IEnumerable.GetEnumerator()
86 get {
return _scores[position - 1]; }
89 for (
int i =
_scores.Length - 1; i > position - 1; i-- )
93 for (
int i = 0; i <
_scores.Length; i++ )
120 : this( 10, false, 0 )
131 public ScoreList(
int length,
bool reverse,
double baseScore,
string defaultName )
133 if ( length < 0 )
throw new ArgumentException(
"List length must be more than zero!" );
138 for (
int i = 0; i < length; i++ )
151 public ScoreList(
int length,
bool reverse,
double baseScore)
152 : this(length, reverse, baseScore,
"-")
166 public override bool Equals(
object obj )
169 if ( other ==
null || this.
Count != other.Count )
return false;
171 for (
int i = 0; i <
_scores.Length; i++ )
197 public int Add(
string name,
double score )
204 for (
int i = 1; i <=
Count; i++ )
206 if ( !
Reverse && score >
this[i].Score ||
Reverse && score <
this[i].Score )
213 throw new InvalidOperationException(
"Internal error in HighScoreList!" );
254 public override bool Equals(
object obj )
260 return this.Name == other.Name && Math.Abs( this.Score - other.Score ) <=
float.Epsilon;
269 return Name.GetHashCode() +
Score.GetHashCode();
Parhaiden pisteiden lista.
ScoreList(int length, bool reverse, double baseScore)
Luo uuden, tyhjän top-listan.
Action Changed
Tapahtuu kun listan sisältö muuttuu.
string LastEnteredName
Viimeksi kirjoitettu nimi
IEnumerator< ScoreItem > GetEnumerator()
bool Reverse
Käänteinen järjestys, ts. pienempi tulos on parempi.
ScoreList()
Luo tyhjän, 10 sijan top-listan.
int Add(string name, double score)
Lisää nimen ja pisteet listalle, jos tulos on tarpeeksi hyvä.
bool Qualifies(double score)
Tarkistaa, kelpaako tulos listalle.
int Count
Kuinka monta nimeä listalle mahtuu.
override bool Equals(object obj)
Tarkistaa, onko kaksi listaa yhtäsuuret.
ScoreList(int length, bool reverse, double baseScore, string defaultName)
Luo uuden, tyhjän top-listan.
override int GetHashCode()
Lista, joka ilmoittaa muutoksistaan.
override int GetHashCode()
Hajautuskoodi
override bool Equals(object obj)
Onko tämä piste-olio sama kuin toinen.
ScoreItem(string name, double score)
Luo uuden sijoituksen listalle.
double Score
Pistemäärä