function RankingRecord(rank, playerID, playerName, bestRecord) { this.rank = rank; this.playerID = playerID; this.playerName = playerName; this.bestRecord = bestRecord; } function RankingRecordManager() { this.clear(); } RankingRecordManager.prototype.push = function(RankingRecord) { this.rankingRecords.push(RankingRecord); } RankingRecordManager.prototype.clear = function() { this.rankingRecords = []; } RankingRecordManager.prototype.getCount = function() { return this.rankingRecords.length; } RankingRecordManager.prototype.getAt = function(index) { if(typeof(this.rankingRecords[index]) == "undefined") return null; return this.rankingRecords[index]; } RankingRecordManager.prototype.getRankAt = function(index) { if(typeof(this.rankingRecords[index]) == "undefined") return -1; return this.rankingRecords[index].rank; } RankingRecordManager.prototype.getPlayerIDAt = function(index) { if(typeof(this.rankingRecords[index]) == "undefined") return -1; return this.rankingRecords[index].playerID; } RankingRecordManager.prototype.getPlayerNameAt = function(index) { if(typeof(this.rankingRecords[index]) == "undefined") return "no data"; return this.rankingRecords[index].playerName; } RankingRecordManager.prototype.getBestRecordAt = function(index) { if(typeof(this.rankingRecords[index]) == "undefined") return -1; return this.rankingRecords[index].bestRecord; }