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

패배하면 2초 후 방에서 나가지도록 함. 승리 UI 만들것

parent edc03cf9
...@@ -80,7 +80,7 @@ class GameRoom ...@@ -80,7 +80,7 @@ class GameRoom
{ {
this.roomId = GameServer.getRoomNumber(); this.roomId = GameServer.getRoomNumber();
this.roomIndex = -1; this.roomIndex = -1;
this.startCount = 5; this.startCount = 2;
this.maxPlayer = 100; this.maxPlayer = 100;
this.nextRank = 100; this.nextRank = 100;
...@@ -176,7 +176,7 @@ class GameRoom ...@@ -176,7 +176,7 @@ class GameRoom
} }
this.currentPlayer.splice(i, 1); this.currentPlayer.splice(i, 1);
this.currentSocket.splice(i, 1); this.currentSocket.splice(i, 1);
this.aliveCount--; //this.aliveCount--;
return; return;
} }
} }
...@@ -315,7 +315,7 @@ class Player ...@@ -315,7 +315,7 @@ class Player
room.aliveCount--; room.aliveCount--;
room.checkPhase(Date.now()); room.checkPhase(Date.now());
if (this.lastAttacks.length > 0) if (this.lastAttacks.length > 0)
{ {
this.lastAttack = this.lastAttacks[this.lastAttacks.length - 1]; this.lastAttack = this.lastAttacks[this.lastAttacks.length - 1];
......
...@@ -190,8 +190,6 @@ socket.on('defeat', function(msg) // object player ...@@ -190,8 +190,6 @@ socket.on('defeat', function(msg) // object player
RoomData.players[msg.index].nicknameText = nicknameText; RoomData.players[msg.index].nicknameText = nicknameText;
RoomData.aliveCount--; RoomData.aliveCount--;
console.log(msg.id);
console.log(RoomData.findPlayer(msg.id));
RoomData.findPlayer(msg.id).playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.gameOver]); RoomData.findPlayer(msg.id).playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.gameOver]);
if (msg.lastAttack != null) if (msg.lastAttack != null)
{ {
...@@ -239,11 +237,19 @@ socket.on('defeat', function(msg) // object player ...@@ -239,11 +237,19 @@ socket.on('defeat', function(msg) // object player
console.log(RoomData.findPlayer(msg.id).nickname + ' defeated'); console.log(RoomData.findPlayer(msg.id).nickname + ' defeated');
WordSpace.killLogForTest += ('\n--Suicide->' + RoomData.findPlayer(msg.id).nickname); WordSpace.killLogForTest += ('\n--Suicide->' + RoomData.findPlayer(msg.id).nickname);
} }
if(msg.id == RoomData.myself.id)
{
setTimeout(() => {
socket.emit('exitRoom', {roomId: RoomData.myself.gameRoomId, playerId: RoomData.myself.id});
ScenesData.changeScene('menuScene');
}, 2000);
}
}); });
socket.on('gameEnd', function(msg) // object player socket.on('gameEnd', function(msg) // object player
{ {
console.log(msg.nickname + ' Win!!!!!!'); console.log(msg.nickname + ' Win!!!!!!');
}); });
socket.on('attackSucceed', function(msg) socket.on('attackSucceed', function(msg)
{ {
//console.log('client'); //console.log('client');
......
...@@ -437,8 +437,7 @@ var gameScene = new Phaser.Class( ...@@ -437,8 +437,7 @@ var gameScene = new Phaser.Class(
WordSpace.startCycle(this); WordSpace.startCycle(this);
WordSpace.setPlayerTyping.initiate(this); WordSpace.setPlayerTyping.initiate(this);
WordSpace.nameWordTextForTest = this.add.text(50,400,'현재 가진 호패들 : 없음').setDepth(10).setColor('#000000');
WordSpace.nameQueue.initiate(); WordSpace.nameQueue.initiate();
//WordSpace.attackGauge.add(11); //WordSpace.attackGauge.add(11);
...@@ -446,29 +445,25 @@ var gameScene = new Phaser.Class( ...@@ -446,29 +445,25 @@ var gameScene = new Phaser.Class(
update: function() update: function()
{ {
WordSpace.deltaTime = this.sys.game.loop.delta; if(ScenesData.currentScene == ScenesData.gameScene)
WordSpace.wordForcedGroup.forEach(function(element)
{
element.attract();
});
WordSpace.nameGroup.forEach(function(element)
{ {
element.attract(); WordSpace.deltaTime = this.sys.game.loop.delta;
}) WordSpace.wordForcedGroup.forEach(function(element)
WordSpace.attackPaperGroup.forEach(function(element){ {
element.moveObject(element); element.attract();
}); });
let tempNames = ''; WordSpace.nameGroup.forEach(function(element)
WordSpace.nameGroup.forEach(function(element) {
{ element.attract();
//테스트용 })
tempNames += element.wordText + (element.isStrong?' [강]':'') + '\n'; WordSpace.attackPaperGroup.forEach(function(element){
}); element.moveObject(element);
});
WordSpace.nameWordTextForTest.setText('현재 가진 호패들 : \n' + tempNames);
WordSpace.weightTextObjForTest.setText('뇌의 무게: (현재) '+WordSpace.totalWeight+' / '+ WordSpace.brainCapacity+' (전체)'); WordSpace.weightTextObjForTest.setText('뇌의 무게: (현재) '+WordSpace.totalWeight+' / '+ WordSpace.brainCapacity+' (전체)');
WordSpace.killLogTextForTest.setText(WordSpace.killLogForTest); WordSpace.killLogTextForTest.setText(WordSpace.killLogForTest);
WordSpace.setPlayerTyping.add(''); WordSpace.setPlayerTyping.add('');
}
} }
}); });
......
...@@ -63,6 +63,11 @@ io.on('connection', function(socket) ...@@ -63,6 +63,11 @@ io.on('connection', function(socket)
} }
}); });
socket.on('exitRoom', function(msg) // string new_nickname
{
GameServer.findRoom(msg.roomId).exitRoom(msg.playerId);
});
socket.on('setPlayerTyping', function(msg) // number playerTyping socket.on('setPlayerTyping', function(msg) // number playerTyping
{ {
try try
......
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