Add: RankingRecordManager

This commit is contained in:
2018-05-17 12:05:21 +09:00
parent 0f623e954c
commit 2c1b928554
11 changed files with 224 additions and 80 deletions
+49
View File
@@ -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;
}
}