Commit 7affd41c authored by 18신대성's avatar 18신대성

ESC로 로그아웃 구현

parent 88609700
function FirebaseClient() function FirebaseClient()
{ {
this.init(); this.init();
this.initEvent(); this.initEvent();
this.isGameStarted = false;
} }
FirebaseClient.prototype.init = function() FirebaseClient.prototype.init = function()
...@@ -69,6 +71,7 @@ FirebaseClient.prototype.setLogin = function() ...@@ -69,6 +71,7 @@ FirebaseClient.prototype.setLogin = function()
.then(function() .then(function()
{ {
game = new Phaser.Game(config); game = new Phaser.Game(config);
fbClient.isGameStarted = true;
}); });
document.getElementById('mainTitle').style.display = 'none'; document.getElementById('mainTitle').style.display = 'none';
...@@ -77,7 +80,10 @@ FirebaseClient.prototype.setLogin = function() ...@@ -77,7 +80,10 @@ FirebaseClient.prototype.setLogin = function()
FirebaseClient.prototype.setLogOut = function() FirebaseClient.prototype.setLogOut = function()
{ {
if (game != null) game.destroy(true);
this.isGameStarted = false;
document.getElementById('mainTitle').style.display = 'block';
document.getElementById('titleImg').style.display = 'block';
} }
FirebaseClient.prototype.onEmailBtnClick = function() FirebaseClient.prototype.onEmailBtnClick = function()
...@@ -235,10 +241,15 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace = ...@@ -235,10 +241,15 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
document.addEventListener('DOMContentLoaded', function() document.addEventListener('DOMContentLoaded', function()
{ {
window.fbClient = new FirebaseClient(); window.fbClient = new FirebaseClient();
console.log('done load'); console.log('done load');
}); });
document.onkeydown = function(e)
{
if (fbClient.isGameStarted && e.keyCode === 27) fbClient.logOut();
}
class UserData class UserData
{ {
constructor() constructor()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment