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

Merge branch 'server'

parents 6243e03f bc9e654c
......@@ -82,7 +82,7 @@ class GameRoom
{
this.roomId = GameServer.getRoomNumber();
this.roomIndex = -1;
this.startCount = 5;
this.startCount = 2;
this.maxPlayer = 100;
this.nextRank = 100;
......@@ -143,7 +143,7 @@ class GameRoom
{
if (this.currentPhase === GameServer.Phase.READY)
{
this.endTime = Date.now() + 30000; // 방 대기 시간
this.endTime = Date.now() + 10000; // 방 대기 시간
this.announceToRoom('setRoomCount',
{
isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length,
......@@ -190,7 +190,6 @@ class GameRoom
isEnter: false, player: this.currentPlayer[i]
});
this.currentPhase = GameServer.Phase.READY;
this.refreshRoom();
}
else this.announceToRoom('setRoomCount',
{
......
......@@ -85,7 +85,7 @@ socket.on('setRoomCount', function(msg)
}
ScenesData.roomScene.players.push(playerSet);
}
else // remove character
else if (msg.id != -1) // remove character
{
let idx = ScenesData.roomScene.players.findIndex(function(element)
{
......
......@@ -110,6 +110,7 @@ io.on('connection', function(socket)
socket.playerData.currentRoom.aliveCount--;
//console.log('counted, ' + socket.playerData.currentRoom.aliveCount);
socket.playerData.playingData.isAlive = true;
if (socket.playerData.currentRoom.currentPhase != GameServer.Phase.COUNT) socket.disconnect();
if (socket.playerData.currentRoom.aliveCount === 0 && socket.playerData.currentRoom.currentPlayer.length >= socket.playerData.currentRoom.startCount)
{
socket.playerData.currentRoom.startRoom();
......@@ -121,25 +122,21 @@ io.on('connection', function(socket)
room.startTimer = setTimeout(function()
{
let deads = room.currentPlayer.filter(element => !element.isAlive);
if (room.aliveCount != 0 && room.currentPlayer.length - deads.length >= room.startCount)
deads.forEach(function(element)
{
room.currentSocket[element.index].disconnect();
room.exitRoom(element.id);
});
if (room.aliveCount != 0 && room.currentPlayer.length >= room.startCount)
{
console.error(new Date().toLocaleTimeString('ko-KR') + ' [ROOM#'+room.roomId+'] FORCE START!!!');
room.startRoom();
deads.forEach(function(element)
{
element.defeat();
});
clearTimeout(room.startTimer);
}
else if (deads.length > 0)
{
deads.forEach(function(element)
{
room.currentSocket[element.index].disconnect();
room.exitRoom(element.id);
});
room.refreshRoom();
}
clearTimeout(room.startTimer);
}, 2000);
}
});
......
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