Add: ESC key back(), Enter key start/restart to all features

This commit is contained in:
2018-10-14 09:13:11 +09:00
parent 18150fc332
commit 99e99b3c80
23 changed files with 218 additions and 55 deletions
+28 -10
View File
@@ -16,18 +16,24 @@ var Result = {
this.game.stage.backgroundColor = '#4d4d4d';
this.chartGraphics = game.add.graphics(100, game.world.height - 120);
// keyboard shortcut
this.keyboardShortcut = new KeyboardShortcut();
this.keyboardShortcut.addCallback(
Phaser.KeyCode.ESC, // keyCode
null, // keyDownHandler
(function() { this.back(); }).bind(this), // keyUpHandler
"result" // callerClassName
);
this.keyboardShortcut.addCallback(
Phaser.KeyCode.ENTER, // keyCode
null, // keyDownHandler
(function() { this.restartStage(); }).bind(this), // keyUpHandler
"result" // callerClassName
);
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( function() {
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';
sessionStorageManager.resetPlayingAppData();
});
screenTopUI.makeBackButton( function() { (function() { this.back(); }).bind(this) });
screenTopUI.makeFullScreenButton();
@@ -54,6 +60,18 @@ var Result = {
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
},
back: function() {
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';
sessionStorageManager.resetPlayingAppData();
},
printRecord: function() {
const style = { font: "bold 38px Arial", fill: "#fff", align: "left", boundsAlignH: "center", boundsAlignV: "middle" };
var titleText = game.add.text(game.world.width / 2, 35, "결과", style);