Fix: restructing session manager, ES6 -> ES5
This commit is contained in:
@@ -1,51 +1,43 @@
|
||||
class RankingRecord {
|
||||
|
||||
constructor(rank, playerID, playerName, bestRecord) {
|
||||
this.rank = rank;
|
||||
this.playerID = playerID;
|
||||
this.playerName = playerName;
|
||||
this.bestRecord = bestRecord;
|
||||
}
|
||||
function RankingRecord(rank, playerID, playerName, bestRecord) {
|
||||
this.rank = rank;
|
||||
this.playerID = playerID;
|
||||
this.playerName = playerName;
|
||||
this.bestRecord = bestRecord;
|
||||
}
|
||||
|
||||
|
||||
function RankingRecordManager() {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
class RankingRecordManager {
|
||||
RankingRecordManager.prototype.push = function(RankingRecord) {
|
||||
this.rankingRecords.push(RankingRecord);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
RankingRecordManager.prototype.clear = function() {
|
||||
this.rankingRecords = [];
|
||||
}
|
||||
|
||||
push(RankingRecord) {
|
||||
this.rankingRecords.push(RankingRecord);
|
||||
}
|
||||
RankingRecordManager.prototype.getCount = function() {
|
||||
return this.rankingRecords.length;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.rankingRecords = [];
|
||||
}
|
||||
RankingRecordManager.prototype.getAt = function(index) {
|
||||
return this.rankingRecords[index];
|
||||
}
|
||||
|
||||
get count() {
|
||||
return this.rankingRecords.length;
|
||||
}
|
||||
RankingRecordManager.prototype.getRankAt = function(index) {
|
||||
return this.rankingRecords[index].rank;
|
||||
}
|
||||
|
||||
getAt(index) {
|
||||
return this.rankingRecords[index];
|
||||
}
|
||||
RankingRecordManager.prototype.getPlayerIDAt = function(index) {
|
||||
return this.rankingRecords[index].playerID;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
RankingRecordManager.prototype.getPlayerNameAt = function(index) {
|
||||
return this.rankingRecords[index].playerName;
|
||||
}
|
||||
|
||||
RankingRecordManager.prototype.getBestRecordAt = function(index) {
|
||||
return this.rankingRecords[index].bestRecord;
|
||||
}
|
||||
Reference in New Issue
Block a user