Files
chocomae/src/game/lib/ranking_record_manager.js
T
2018-07-04 22:04:24 +09:00

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;
}
}