Commit 083dc35e authored by 18김재민's avatar 18김재민

오타 수정, 처음에 리소스 안불러와지는 버그 수정

parent 0b3c5d88
...@@ -12,7 +12,7 @@ Audio.loadSound = function(scene) ...@@ -12,7 +12,7 @@ Audio.loadSound = function(scene)
// 게임 진행 중 효과음들 // 게임 진행 중 효과음들
scene.load.audio('attack', 'assets/sound/attackShort.ogg'); scene.load.audio('attack', 'assets/sound/attackShort.ogg');
scene.load.audio('Bagazi', 'aassets/sound/Bagazi_ddak.ogg'); scene.load.audio('Bagazi', 'assets/sound/Bagazi_ddak.ogg');
scene.load.audio('getItem', 'assets/sound/getItem.ogg'); scene.load.audio('getItem', 'assets/sound/getItem.ogg');
scene.load.audio('killLog', 'assets/sound/killLog.ogg'); scene.load.audio('killLog', 'assets/sound/killLog.ogg');
scene.load.audio('killWord', 'assets/sound/killWord.ogg'); scene.load.audio('killWord', 'assets/sound/killWord.ogg');
......
...@@ -124,7 +124,6 @@ socket.on('startGame', function() ...@@ -124,7 +124,6 @@ socket.on('startGame', function()
// in game // in game
socket.on('changePhase', function(msg) // number Phase socket.on('changePhase', function(msg) // number Phase
{ {
// Audio.killSound('gameScene',) -> 여기다 게임 페이즈 bgm 넣으면 됨
WordSpace.changePhase(msg); WordSpace.changePhase(msg);
}); });
socket.on('setPlayerTypingRate', function(msg) // number playerTypingRate socket.on('setPlayerTypingRate', function(msg) // number playerTypingRate
...@@ -207,9 +206,11 @@ socket.on('defeat', function(msg) // object player ...@@ -207,9 +206,11 @@ socket.on('defeat', function(msg) // object player
let position = RoomData.findPlayer(msg.id).position; let position = RoomData.findPlayer(msg.id).position;
let nicknameText = RoomData.findPlayer(msg.id).nicknameText; let nicknameText = RoomData.findPlayer(msg.id).nicknameText;
// 이거 조건문으로 페이즈마다 다르게 해줘야 하는데 모르겠음 if(WordSpace.CurrentPhase == 1)
Audio.killSound(ScenesData.gameScene, 'Phase1'); Audio.killSound(ScenesData.gameScene, 'Phase1');
if(WordSpace.CurrentPhase == 2)
Audio.killSound(ScenesData.gameScene, 'Phase2'); Audio.killSound(ScenesData.gameScene, 'Phase2');
if(WordSpace.CurrentPhase == 3)
Audio.killSound(ScenesData.gameScene, 'Phase3'); Audio.killSound(ScenesData.gameScene, 'Phase3');
Audio.playSound(ScenesData.gameScene, 'defeat'); Audio.playSound(ScenesData.gameScene, 'defeat');
...@@ -369,9 +370,11 @@ socket.on('gameEnd', function(msg) // number winnerId ...@@ -369,9 +370,11 @@ socket.on('gameEnd', function(msg) // number winnerId
{ {
const winner = RoomData.findPlayer(msg); const winner = RoomData.findPlayer(msg);
// 패배랑 같은 이유의 조건문 필요 if(WordSpace.CurrentPhase == 1)
Audio.killSound(ScenesData.gameScene, 'Phase1'); Audio.killSound(ScenesData.gameScene, 'Phase1');
if(WordSpace.CurrentPhase == 2)
Audio.killSound(ScenesData.gameScene, 'Phase2'); Audio.killSound(ScenesData.gameScene, 'Phase2');
if(WordSpace.CurrentPhase == 3)
Audio.killSound(ScenesData.gameScene, 'Phase3'); Audio.killSound(ScenesData.gameScene, 'Phase3');
Audio.playSound(ScenesData.gameScene, 'victory'); Audio.playSound(ScenesData.gameScene, 'victory');
......
...@@ -20,6 +20,7 @@ var menuScene = new Phaser.Class( ...@@ -20,6 +20,7 @@ var menuScene = new Phaser.Class(
ResourceLoader.loadImage(this); ResourceLoader.loadImage(this);
CSVParsing.loadText(this); CSVParsing.loadText(this);
Audio.loadSound(this); Audio.loadSound(this);
this.load.scenePlugin({ this.load.scenePlugin({
key: 'rexuiplugin', key: 'rexuiplugin',
url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexuiplugin.min.js', url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexuiplugin.min.js',
...@@ -420,6 +421,7 @@ var gameScene = new Phaser.Class( ...@@ -420,6 +421,7 @@ var gameScene = new Phaser.Class(
preload: function() preload: function()
{ {
ScenesData.gameScene = this; ScenesData.gameScene = this;
Audio.loadSound(this);
this.load.scenePlugin({ this.load.scenePlugin({
key: 'rexuiplugin', key: 'rexuiplugin',
url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexuiplugin.min.js', url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexuiplugin.min.js',
...@@ -443,6 +445,14 @@ var gameScene = new Phaser.Class( ...@@ -443,6 +445,14 @@ var gameScene = new Phaser.Class(
BackGround.drawBrain(this); BackGround.drawBrain(this);
BackGround.drawCharacter(this); BackGround.drawCharacter(this);
Audio.playSound(this, 'startGame'); Audio.playSound(this, 'startGame');
if(WordSpace.CurrentPhase == 1)
Audio.loopSound(this, 'Phase1');
else if(WordSpace.CurrentPhase == 2)
Audio.loopSound(this, 'Phase2');
else
Audio.loopSound(this, 'Phase3');
WordSpace.attackPaperGroup = this.physics.add.group(); WordSpace.attackPaperGroup = this.physics.add.group();
WordSpace.wordPhysicsGroup = this.physics.add.group(); WordSpace.wordPhysicsGroup = this.physics.add.group();
...@@ -506,6 +516,7 @@ var gameScene = new Phaser.Class( ...@@ -506,6 +516,7 @@ var gameScene = new Phaser.Class(
ScenesData.changeScene = function(sceneKey) ScenesData.changeScene = function(sceneKey)
{ {
Audio.killSound(ScenesData.menuScene, 'login');
ScenesData.currentScene.scene.start(sceneKey); ScenesData.currentScene.scene.start(sceneKey);
Input.input = []; Input.input = [];
Input.converted = ''; Input.converted = '';
......
...@@ -494,6 +494,13 @@ WordSpace.changePhase = function(newPhase) ...@@ -494,6 +494,13 @@ WordSpace.changePhase = function(newPhase)
console.log('phase changed from ' + WordSpace.CurrentPhase + ' to ' + newPhase); console.log('phase changed from ' + WordSpace.CurrentPhase + ' to ' + newPhase);
WordSpace.CurrentPhase = newPhase; WordSpace.CurrentPhase = newPhase;
if(WordSpace.CurrentPhase == 1)
Audio.killSound('gameScene', 'Phase1');
else if(WordSpace.CurrentPhase == 2)
Audio.killSound('gameScene', 'Phase2');
else
Audio.killSound('gameScene', 'Phase3');
//WordSpace.pauseCycle(true); //WordSpace.pauseCycle(true);
// 여기서 종이 드르륵 열면됨 // 여기서 종이 드르륵 열면됨
let phaseChangeBgr = ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'phase' + newPhase).setOrigin(0.5, 0.5).setDepth(9.9).play('phase' + newPhase + 'Anim'); let phaseChangeBgr = ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'phase' + newPhase).setOrigin(0.5, 0.5).setDepth(9.9).play('phase' + newPhase + 'Anim');
......
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