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

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

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