Add: RankingRecordManager
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
class RankingRecord {
|
||||
|
||||
constructor(rank, userName, score) {
|
||||
this.rank = rank;
|
||||
this.userName = userName;
|
||||
this.score = score;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class RankingRecordManager {
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
push(RankingRecord) {
|
||||
this.rankingRecords.push(RankingRecord);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.rankingRecords = [];
|
||||
|
||||
this.minValueOfRecord = 0;
|
||||
this.maxValueOfRecord = 0;
|
||||
}
|
||||
|
||||
get count() {
|
||||
return this.rankingRecords.length;
|
||||
}
|
||||
|
||||
getAt(index) {
|
||||
return this.rankingRecords[index];
|
||||
}
|
||||
|
||||
getRankAt(index) {
|
||||
return this.rankingRecords[index].rank;
|
||||
}
|
||||
|
||||
getUserNameAt(index) {
|
||||
return this.rankingRecords[index].userName;
|
||||
}
|
||||
|
||||
getScoreAt(index) {
|
||||
return this.rankingRecords[index].score;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user