Commit f8ecc5f1 authored by 18손재민's avatar 18손재민

씬 전환 함수 수정

parent e6303876
...@@ -30,8 +30,9 @@ socket.on('setId', function(msg) // {str, num playerNum} ...@@ -30,8 +30,9 @@ socket.on('setId', function(msg) // {str, num playerNum}
socket.on('enterRoom', function() socket.on('enterRoom', function()
{ {
Audio.killSound(ScenesData.menuScene, 'login'); Audio.killSound(ScenesData.menuScene, 'login');
game.scene.stop('menuScene'); ScenesData.changeScene('roomScene');
game.scene.start('roomScene'); /*game.scene.stop('menuScene');
game.scene.start('roomScene');*/
}); });
socket.on('syncRoomScene', function(msg) socket.on('syncRoomScene', function(msg)
{ {
...@@ -104,8 +105,9 @@ socket.on('syncRoomData', function(msg) // {num roomNum, [] players} ...@@ -104,8 +105,9 @@ socket.on('syncRoomData', function(msg) // {num roomNum, [] players}
socket.on('startGame', function() socket.on('startGame', function()
{ {
Audio.killSound(ScenesData.roomScene, 'inRoom'); Audio.killSound(ScenesData.roomScene, 'inRoom');
game.scene.stop('roomScene'); ScenesData.changeScene('gameScene');
game.scene.start('gameScene'); /*game.scene.stop('roomScene');
game.scene.start('gameScene');*/
}); });
// in game // in game
......
...@@ -15,6 +15,7 @@ var menuScene = new Phaser.Class( ...@@ -15,6 +15,7 @@ var menuScene = new Phaser.Class(
preload: function() preload: function()
{ {
ScenesData.menuScene = this; ScenesData.menuScene = this;
ScenesData.currentScene = this;
ResourceLoader.loadBackGround(this); ResourceLoader.loadBackGround(this);
ResourceLoader.loadImage(this); ResourceLoader.loadImage(this);
Input.inputField.loadImage(this); Input.inputField.loadImage(this);
...@@ -220,8 +221,9 @@ var gameScene = new Phaser.Class( ...@@ -220,8 +221,9 @@ var gameScene = new Phaser.Class(
} }
}); });
ScenesData.changeScene(scene) ScenesData.changeScene = function(scene)
{ {
game.scene.stop(); game.scene.stop(ScenesData.currentScene);
ScenesData.currentScene = scene;
game.scene.start(scene); game.scene.start(scene);
} }
\ No newline at end of file
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