Fix: change self variable to this
This commit is contained in:
+33
-31
@@ -5,20 +5,14 @@ var Ranking = {
|
||||
},
|
||||
|
||||
create: function() {
|
||||
self = this;
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
|
||||
this.jsonData = null;
|
||||
this.mode = Ranking.MODE_HOUR;
|
||||
this.refreshTimeSec = Ranking.REFRESH_TIME_SEC;
|
||||
|
||||
this.game.stage.backgroundColor = '#4d4d4d';
|
||||
|
||||
// var phaser = game.add.image(game.world.centerX, game.world.centerY, 'phaser');
|
||||
// phaser.anchor.set(0.5);
|
||||
// phaser.alpha = 0.1;
|
||||
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
this.keyboardShortcut.addCallback(
|
||||
@@ -59,11 +53,23 @@ var Ranking = {
|
||||
|
||||
|
||||
var buttonPositionY = 640;
|
||||
var buttonHour = this.makeTextButton(game.world.centerX - 220, buttonPositionY, "수업시간 순위", this.showRankingHour);
|
||||
var buttonHour = this.makeTextButton(
|
||||
game.world.centerX - 220, buttonPositionY,
|
||||
"수업시간 순위",
|
||||
(function() { this.showRankingHour(); }).bind(this)
|
||||
);
|
||||
// buttonHour.inputEnabled = false;
|
||||
var buttonDay = this.makeTextButton(game.world.centerX, buttonPositionY, "오늘의 순위", this.showRankingDay);
|
||||
var buttonDay = this.makeTextButton(
|
||||
game.world.centerX, buttonPositionY,
|
||||
"오늘의 순위",
|
||||
(function() { this.showRankingDay(); }).bind(this)
|
||||
);
|
||||
// buttonDay.inputEnabled = false;
|
||||
var buttonMonth = this.makeTextButton(game.world.centerX + 220, buttonPositionY, "이달의 순위", this.showRankingMonth);
|
||||
var buttonMonth = this.makeTextButton(
|
||||
game.world.centerX + 220, buttonPositionY,
|
||||
"이달의 순위",
|
||||
(function() { this.showRankingMonth(); }).bind(this)
|
||||
);
|
||||
// buttonMonth.inputEnabled = false;
|
||||
|
||||
|
||||
@@ -76,7 +82,7 @@ var Ranking = {
|
||||
this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
||||
|
||||
this.getRecordToRankingServer();
|
||||
game.time.events.loop(Phaser.Timer.SECOND * 10, this.getRecordToRankingServer, this);
|
||||
game.time.events.loop(Phaser.Timer.SECOND * this.refreshTimeSec, this.getRecordToRankingServer, this);
|
||||
},
|
||||
|
||||
|
||||
@@ -158,39 +164,33 @@ var Ranking = {
|
||||
|
||||
getRecordToRankingServer: function() {
|
||||
// console.log("getRecordToRankingServer : " + this.mode);
|
||||
var self = this;
|
||||
|
||||
this.dbConnectManager.requestAppRanking(
|
||||
sessionStorageManager.getMaestroID(),
|
||||
sessionStorageManager.getPlayingAppID(),
|
||||
(function(jsonData) {
|
||||
self.showRanking(jsonData);
|
||||
}),
|
||||
(function(jsonData) {
|
||||
self.showRanking(null);
|
||||
})
|
||||
(function(jsonData) { this.showRanking(jsonData); }).bind(this),
|
||||
(function(jsonData) { this.showRanking(null); }).bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
showRankingHour: function() {
|
||||
self.mode = Ranking.MODE_HOUR;
|
||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
|
||||
self.textTitle.addColor("#ff6666", 0);
|
||||
self.getRecordToRankingServer();
|
||||
this.mode = Ranking.MODE_HOUR;
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
|
||||
this.textTitle.addColor("#ff6666", 0);
|
||||
this.getRecordToRankingServer();
|
||||
},
|
||||
|
||||
showRankingDay: function() {
|
||||
self.mode = Ranking.MODE_DAY;
|
||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
|
||||
self.textTitle.addColor("#9999ff", 0);
|
||||
self.getRecordToRankingServer();
|
||||
this.mode = Ranking.MODE_DAY;
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
|
||||
this.textTitle.addColor("#9999ff", 0);
|
||||
this.getRecordToRankingServer();
|
||||
},
|
||||
|
||||
showRankingMonth: function() {
|
||||
self.mode = Ranking.MODE_MONTH;
|
||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
|
||||
self.textTitle.addColor("#99ff99", 0);
|
||||
self.getRecordToRankingServer();
|
||||
this.mode = Ranking.MODE_MONTH;
|
||||
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
|
||||
this.textTitle.addColor("#99ff99", 0);
|
||||
this.getRecordToRankingServer();
|
||||
},
|
||||
|
||||
showRanking: function(jsonRankingData) {
|
||||
@@ -302,3 +302,5 @@ var Ranking = {
|
||||
Ranking.MODE_HOUR = "mode_hour";
|
||||
Ranking.MODE_DAY = "mode_day";
|
||||
Ranking.MODE_MONTH = "mode_month";
|
||||
|
||||
Ranking.REFRESH_TIME_SEC = 10;
|
||||
Reference in New Issue
Block a user