Fix: result.js -> classify

This commit is contained in:
2019-09-06 22:49:28 +09:00
parent ba1a36a734
commit f30bd7fc8b
+43 -46
View File
@@ -1,6 +1,10 @@
var Result = {
Result.prototype = Object.create(Phaser.State.prototype);
Result.constructor = Result;
preload: function() {
function Result() {
}
Result.prototype.preload = function() {
game.load.image('icon_fullscreen', '../../../resources/image/icon/fullscreen_white.png');
if(isTypingPracticeApp() || isTypingTestApp() || isTypingExamApp())
@@ -8,9 +12,9 @@ var Result = {
RankingBoard.loadResources();
game.load.image('star', '../../../resources/image/ui/star_particle.png');
},
}
create: function() {
Result.prototype.create = function() {
this.dbConnectManager = new DBConnectManager();
this.game.stage.backgroundColor = '#4d4d4d';
@@ -36,6 +40,12 @@ var Result = {
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
screenTopUI.makeFullScreenButton();
var titleText = this.makeDefaultText(game.world.width / 2, 35);
titleText.text = "결과";
titleText.fontSize = 38;
titleText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
titleText.anchor.set(0.5);
// contents
this.printRecord();
@@ -58,45 +68,35 @@ var Result = {
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
},
}
back: function() {
Result.prototype.back = function() {
location.href = '../../web/client/main_menu.html';
}
/*
if(isTypingExamApp())
location.href = '../../web/client/menu_typing_exam.html';
else if(isTypingPracticeApp())
location.href = '../../web/client/menu_typing_practice.html';
else if(isTypingTestApp())
location.href = '../../web/client/menu_typing_test.html';
else
location.href = '../../web/client/menu_app.html';
Result.prototype.makeDefaultText = function(x, y) {
var defaultText = game.add.text(x, y, "");
defaultText.anchor.set(0, 0.5);
// defaultText.font = "Nanum Gothic Coding";
defaultText.fontSize = 26;
defaultText.fontWeight = "normal";
defaultText.style.fill = "white";
sessionStorageManager.resetPlayingAppData();
*/
},
printRecord: function() {
var style = { font: "bold 38px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
var titleText = game.add.text(game.world.width / 2, 35, "결과", style);
titleText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
titleText.anchor.set(0.5);
return defaultText;
}
Result.prototype.printRecord = function() {
if(sessionStorageManager.getRecord() === null)
sessionStorageManager.setRecord(0);
var record = sessionStorageManager.getRecord();
var x = game.world.width / 2;
var y = 150;
if(sessionStorageManager.getRecord() === null)
sessionStorageManager.setRecord(0);
var record = sessionStorageManager.getRecord();
style.font = "80px Arial";
var scoreText = game.add.text(
x, y,
"",
style
);
var scoreText = this.makeDefaultText(x, y);
scoreText.text = "";
scoreText.fontSize = 80;
scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
scoreText.anchor.set(0.5);
@@ -122,9 +122,9 @@ var Result = {
var rightAnimal = new Animal(Animal.TYPE_ANIMATION, animalLevelID, game.world.centerX + 200, 150);
rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]);
}
},
}
printTodayBestRecord: function() {
Result.prototype.printTodayBestRecord = function() {
// console.log(sessionStorageManager.getAppHighestRecord());
// console.log(sessionStorageManager.getRecord());
var appHighestRecord = sessionStorageManager.getAppHighestRecord();
@@ -143,9 +143,9 @@ var Result = {
else if(prevRecord < appHighestRecord)
this.showHighestRecordEffect(prevRecord);
}
},
}
showHighestRecordEffect: function(record) {
Result.prototype.showHighestRecordEffect = function(record) {
sessionStorageManager.setAppHighestRecord(record);
var newRecordEmitter = game.add.emitter(game.world.centerX, 140, 300);
@@ -160,26 +160,23 @@ var Result = {
bestRecordText.text = "! : . 최고 기록 경신 . : !";
newRecordEmitter.start(true, 2000, null, 20);
},
}
isHighestRecordPreferApp: function() {
Result.prototype.isHighestRecordPreferApp = function() {
if(sessionStorageManager.getPlayingAppID() == 105)
return false;
return true;
},
}
makeRestartButton: function() {
Result.prototype.makeRestartButton = function() {
var setting = new RoundRectButtonSetting(game.world.centerX, game.world.height / 2 - 70, 200, 100);
setting.fontStyle.fontWeight = "bold";
var startButton = new RoundRectButton(setting, RoundRectButton.NONE_ICON, "다시 시작", this.restartStage);
startButton.addShortcutText("Enter");
},
}
restartStage: function() {
Result.prototype.restartStage = function() {
location.href = "../../web/client/" + getGameAppName() + ".html";
}
}