Fix: change self variable to this
This commit is contained in:
+34
-32
@@ -5,20 +5,14 @@ var Ranking = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
create: function() {
|
create: function() {
|
||||||
self = this;
|
|
||||||
|
|
||||||
this.dbConnectManager = new DBConnectManager();
|
this.dbConnectManager = new DBConnectManager();
|
||||||
|
|
||||||
this.jsonData = null;
|
this.jsonData = null;
|
||||||
this.mode = Ranking.MODE_HOUR;
|
this.mode = Ranking.MODE_HOUR;
|
||||||
|
this.refreshTimeSec = Ranking.REFRESH_TIME_SEC;
|
||||||
|
|
||||||
this.game.stage.backgroundColor = '#4d4d4d';
|
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
|
// keyboard shortcut
|
||||||
this.keyboardShortcut = new KeyboardShortcut();
|
this.keyboardShortcut = new KeyboardShortcut();
|
||||||
this.keyboardShortcut.addCallback(
|
this.keyboardShortcut.addCallback(
|
||||||
@@ -59,11 +53,23 @@ var Ranking = {
|
|||||||
|
|
||||||
|
|
||||||
var buttonPositionY = 640;
|
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;
|
// 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;
|
// 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;
|
// buttonMonth.inputEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +82,7 @@ var Ranking = {
|
|||||||
this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
this.screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
||||||
|
|
||||||
this.getRecordToRankingServer();
|
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() {
|
getRecordToRankingServer: function() {
|
||||||
// console.log("getRecordToRankingServer : " + this.mode);
|
// console.log("getRecordToRankingServer : " + this.mode);
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this.dbConnectManager.requestAppRanking(
|
this.dbConnectManager.requestAppRanking(
|
||||||
sessionStorageManager.getMaestroID(),
|
sessionStorageManager.getMaestroID(),
|
||||||
sessionStorageManager.getPlayingAppID(),
|
sessionStorageManager.getPlayingAppID(),
|
||||||
(function(jsonData) {
|
(function(jsonData) { this.showRanking(jsonData); }).bind(this),
|
||||||
self.showRanking(jsonData);
|
(function(jsonData) { this.showRanking(null); }).bind(this)
|
||||||
}),
|
|
||||||
(function(jsonData) {
|
|
||||||
self.showRanking(null);
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
showRankingHour: function() {
|
showRankingHour: function() {
|
||||||
self.mode = Ranking.MODE_HOUR;
|
this.mode = Ranking.MODE_HOUR;
|
||||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
|
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 수업시간 순위";
|
||||||
self.textTitle.addColor("#ff6666", 0);
|
this.textTitle.addColor("#ff6666", 0);
|
||||||
self.getRecordToRankingServer();
|
this.getRecordToRankingServer();
|
||||||
},
|
},
|
||||||
|
|
||||||
showRankingDay: function() {
|
showRankingDay: function() {
|
||||||
self.mode = Ranking.MODE_DAY;
|
this.mode = Ranking.MODE_DAY;
|
||||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
|
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 오늘의 순위";
|
||||||
self.textTitle.addColor("#9999ff", 0);
|
this.textTitle.addColor("#9999ff", 0);
|
||||||
self.getRecordToRankingServer();
|
this.getRecordToRankingServer();
|
||||||
},
|
},
|
||||||
|
|
||||||
showRankingMonth: function() {
|
showRankingMonth: function() {
|
||||||
self.mode = Ranking.MODE_MONTH;
|
this.mode = Ranking.MODE_MONTH;
|
||||||
self.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
|
this.textTitle.text = sessionStorageManager.getPlayingAppKoreanName() + " - 이달의 순위";
|
||||||
self.textTitle.addColor("#99ff99", 0);
|
this.textTitle.addColor("#99ff99", 0);
|
||||||
self.getRecordToRankingServer();
|
this.getRecordToRankingServer();
|
||||||
},
|
},
|
||||||
|
|
||||||
showRanking: function(jsonRankingData) {
|
showRanking: function(jsonRankingData) {
|
||||||
@@ -301,4 +301,6 @@ var Ranking = {
|
|||||||
|
|
||||||
Ranking.MODE_HOUR = "mode_hour";
|
Ranking.MODE_HOUR = "mode_hour";
|
||||||
Ranking.MODE_DAY = "mode_day";
|
Ranking.MODE_DAY = "mode_day";
|
||||||
Ranking.MODE_MONTH = "mode_month";
|
Ranking.MODE_MONTH = "mode_month";
|
||||||
|
|
||||||
|
Ranking.REFRESH_TIME_SEC = 10;
|
||||||
Reference in New Issue
Block a user