51 lines
788 B
JavaScript
51 lines
788 B
JavaScript
class RankingRecord {
|
|
|
|
constructor(rank, playerID, playerName, bestRecord) {
|
|
this.rank = rank;
|
|
this.playerID = playerID;
|
|
this.playerName = playerName;
|
|
this.bestRecord = bestRecord;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class RankingRecordManager {
|
|
|
|
constructor() {
|
|
this.clear();
|
|
}
|
|
|
|
push(RankingRecord) {
|
|
this.rankingRecords.push(RankingRecord);
|
|
}
|
|
|
|
clear() {
|
|
this.rankingRecords = [];
|
|
}
|
|
|
|
get count() {
|
|
return this.rankingRecords.length;
|
|
}
|
|
|
|
getAt(index) {
|
|
return this.rankingRecords[index];
|
|
}
|
|
|
|
getRankAt(index) {
|
|
return this.rankingRecords[index].rank;
|
|
}
|
|
|
|
getPlayerIDAt(index) {
|
|
return this.rankingRecords[index].playerID;
|
|
}
|
|
|
|
getPlayerNameAt(index) {
|
|
return this.rankingRecords[index].playerName;
|
|
}
|
|
|
|
getBestRecordAt(index) {
|
|
return this.rankingRecords[index].bestRecord;
|
|
}
|
|
|
|
} |