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