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

씬 전환 함수 수정

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