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

버그 수정 및 호패 생성 제한 판정 방식 수정

parent 180c8e78
...@@ -76,7 +76,7 @@ class GameRoom ...@@ -76,7 +76,7 @@ class GameRoom
{ {
this.roomId = GameServer.getRoomNumber(); this.roomId = GameServer.getRoomNumber();
this.roomIndex = -1; this.roomIndex = -1;
this.startCount = 2; this.startCount = 3;
this.maxPlayer = 100; this.maxPlayer = 100;
this.nextRank = 100; this.nextRank = 100;
...@@ -132,7 +132,7 @@ class GameRoom ...@@ -132,7 +132,7 @@ class GameRoom
{ {
if (this.currentPhase === GameServer.Phase.READY) if (this.currentPhase === GameServer.Phase.READY)
{ {
this.endTime = Date.now() + 5000; // 테스트용 10초 this.endTime = Date.now() + 1000; // 테스트용 10초
this.announceToRoom('setRoomCount', this.announceToRoom('setRoomCount',
{ {
isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length, isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length,
...@@ -208,7 +208,7 @@ class GameRoom ...@@ -208,7 +208,7 @@ class GameRoom
{ {
if (this.currentPhase === GameServer.Phase.START) if (this.currentPhase === GameServer.Phase.START)
{ {
if (this.phaseChanger < 0 && checkTime - this.startTime > 60000) if (this.phaseChanger < 0 && checkTime - this.startTime > 6000)
{ {
this.currentPhase = GameServer.Phase.MAIN; this.currentPhase = GameServer.Phase.MAIN;
this.rateArrangePoint = 150; this.rateArrangePoint = 150;
......
...@@ -248,7 +248,7 @@ class UserData ...@@ -248,7 +248,7 @@ class UserData
this.rank = -1; this.rank = -1;
this.hopae = this.hopae =
[ [
{name: prompt("첫번째 호패의 닉네임을 입력해주세요."), type: 'wood'} {name: prompt("첫번째 호패의 닉네임을 입력해주세요.\n(반드시 한글만 사용해주세요 띄어쓰기도 금지)"), type: 'wood'}
]; ];
this.recentHopae = ''; this.recentHopae = '';
this.title = []; this.title = [];
......
...@@ -41,6 +41,7 @@ var menuScene = new Phaser.Class( ...@@ -41,6 +41,7 @@ var menuScene = new Phaser.Class(
this.money = this.add.text(100, 200, '소지 엽전 : ' + PlayerData.userData.money).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40); this.money = this.add.text(100, 200, '소지 엽전 : ' + PlayerData.userData.money).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
this.currentHopae = this.add.text(100, 300, '현재 호패 : ' + PlayerData.userData.recentHopae).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40); this.currentHopae = this.add.text(100, 300, '현재 호패 : ' + PlayerData.userData.recentHopae).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
this.myHopae = []; this.myHopae = [];
//PlayerData.userData.forEach(function(element){this.myHopae.push(element)});
for(let i = 0; i < PlayerData.userData.hopae.length; i++) for(let i = 0; i < PlayerData.userData.hopae.length; i++)
{ {
let textLength = PlayerData.userData.hopae[i].name.length; let textLength = PlayerData.userData.hopae[i].name.length;
...@@ -49,7 +50,7 @@ var menuScene = new Phaser.Class( ...@@ -49,7 +50,7 @@ var menuScene = new Phaser.Class(
} }
this.myCharacter = this.add.sprite(game.config.width / 2, game.config.height / 2 - 200, 'pyeongminStand').setOrigin(0.5, 0.5).setDepth(5).setScale(0.8); this.myCharacter = this.add.sprite(game.config.width / 2, game.config.height / 2 - 200, 'pyeongminStand').setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
PlayerData.nickname = PlayerData.userData.recentHopae; PlayerData.nickname = (PlayerData.userData.recentHopae == '') ? PlayerData.userData.hopae[0].name : PlayerData.userData.recentHopae;
this.roomEnterDialog = this.rexUI.add.dialog({ this.roomEnterDialog = this.rexUI.add.dialog({
x: game.config.width / 2, x: game.config.width / 2,
...@@ -120,7 +121,7 @@ var menuScene = new Phaser.Class( ...@@ -120,7 +121,7 @@ var menuScene = new Phaser.Class(
{ {
enabled: true, mode: 0 enabled: true, mode: 0
}).on('click', function(button, gameObject, pointer){ }).on('click', function(button, gameObject, pointer){
gameObject.setEnable(false); button.setEnable(false);
ScenesData.menuScene.roomEnterDialog.setVisible(true).popUp(200); ScenesData.menuScene.roomEnterDialog.setVisible(true).popUp(200);
}, this); }, this);
...@@ -332,7 +333,7 @@ var roomScene = new Phaser.Class( ...@@ -332,7 +333,7 @@ var roomScene = new Phaser.Class(
//console.log('end Count'); //console.log('end Count');
setTimeout(() => { setTimeout(() => {
socket.emit('endCount'); socket.emit('endCount');
}, (Phaser.Math.Distance.Between(0, 0, game.config.width / 2, game.config.height * 10 / 9) * 3)); }, (Phaser.Math.Distance.Between(0, 0, game.config.width / 2, game.config.height * 10 / 9) * 10));
this.isCounting = false; this.isCounting = false;
this.isCountEnd = true; this.isCountEnd = true;
this.players.forEach(function(element){ this.players.forEach(function(element){
...@@ -381,6 +382,16 @@ var gameScene = new Phaser.Class( ...@@ -381,6 +382,16 @@ var gameScene = new Phaser.Class(
preload: function() preload: function()
{ {
ScenesData.gameScene = this; ScenesData.gameScene = this;
this.load.scenePlugin({
key: 'rexuiplugin',
url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexuiplugin.min.js',
sceneKey: 'rexUI'
});
this.load.scenePlugin({
key: 'rexbuttonplugin',
url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexbuttonplugin.min.js',
sceneKey: 'button'
});
WordSpace.weightTextObjForTest = this.add.text(game.config.width * 5 / 64, game.config.height * 5 / 48, '뇌의 무게: (현재) 0 / ' + this.brainCapacity + ' (전체)').setDepth(10).setColor('#000000'); WordSpace.weightTextObjForTest = this.add.text(game.config.width * 5 / 64, game.config.height * 5 / 48, '뇌의 무게: (현재) 0 / ' + this.brainCapacity + ' (전체)').setDepth(10).setColor('#000000');
WordSpace.killLogTextForTest = this.add.text(game.config.width * 25 / 32, game.config.height * 5 / 72, WordSpace.killLogForTest).setDepth(10).setColor('#000000').setAlign('right'); WordSpace.killLogTextForTest = this.add.text(game.config.width * 25 / 32, game.config.height * 5 / 72, WordSpace.killLogForTest).setDepth(10).setColor('#000000').setAlign('right');
}, },
...@@ -398,7 +409,7 @@ var gameScene = new Phaser.Class( ...@@ -398,7 +409,7 @@ var gameScene = new Phaser.Class(
WordSpace.wordPhysicsGroup = this.physics.add.group(); WordSpace.wordPhysicsGroup = this.physics.add.group();
Input.inputField.generate(this, Input.gameSceneEnterReaction, Input.inputField.generate(this, Input.gameSceneEnterReaction,
UIObject.createLabel(this, game.config.width / 2, game.config.height * 25 / 36, 10, 'inputfield', 1, '', 25, '#000000').getElement('text')); UIObject.createLabel(ScenesData.gameScene, game.config.width / 2, game.config.height * 25 / 36, 10, 'inputfield', 1, '', 25, '#000000').getElement('text'));
WordSpace.attackGauge.generate(this); WordSpace.attackGauge.generate(this);
WordSpace.spaceInitiate(this); WordSpace.spaceInitiate(this);
...@@ -410,18 +421,14 @@ var gameScene = new Phaser.Class( ...@@ -410,18 +421,14 @@ var gameScene = new Phaser.Class(
WordSpace.nameWordTextForTest = this.add.text(50,400,'현재 가진 호패들 : 없음').setDepth(10).setColor('#000000'); WordSpace.nameWordTextForTest = this.add.text(50,400,'현재 가진 호패들 : 없음').setDepth(10).setColor('#000000');
WordSpace.nameQueue.initiate(); WordSpace.nameQueue.initiate();
WordSpace.generateWord.Item(this, Enums.item.nameList); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.nameList); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.invincible); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.invincible); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.charge); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.charge); WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Item(this, Enums.item.clean); WordSpace.attackGauge.add(11);
WordSpace.generateWord.Item(this, Enums.item.clean);
WordSpace.generateWord.Item(this, Enums.item.heavy);
WordSpace.generateWord.Item(this, Enums.item.heavy);
WordSpace.generateWord.Item(this, Enums.item.dark);
WordSpace.generateWord.Item(this, Enums.item.dark);
}, },
update: function() update: function()
......
...@@ -186,8 +186,8 @@ WordSpace.generateWord = ...@@ -186,8 +186,8 @@ WordSpace.generateWord =
{ {
if(newPlayerData == null) if(newPlayerData == null)
{ {
if(WordSpace.nameQueue.queue.length == 1) return null;
let temp = WordSpace.nameQueue.pop(); let temp = WordSpace.nameQueue.pop();
if(temp == null) return null;
word = new NameWord(temp, isStrong); word = new NameWord(temp, isStrong);
} }
else word = new NameWord(newPlayerData, isStrong); else word = new NameWord(newPlayerData, isStrong);
...@@ -457,25 +457,30 @@ WordSpace.nameQueue = ...@@ -457,25 +457,30 @@ WordSpace.nameQueue =
Phaser.Utils.Array.Shuffle(tempQueue); Phaser.Utils.Array.Shuffle(tempQueue);
tempQueue.forEach(function(element) tempQueue.forEach(function(element)
{ {
if(RoomData.players[element].id != PlayerData.id && RoomData.players[element].isAlive && WordSpace.nameQueue.getCount(element) < 3) if(RoomData.players[element].id != PlayerData.id && RoomData.players[element].isAlive && WordSpace.nameQueue.getCount(RoomData.players[element]) < 3)
WordSpace.nameQueue.queue.push(element); WordSpace.nameQueue.queue.push(element);
}); });
}, },
pop: function() pop: function()
{ {
if(WordSpace.nameQueue.queue.length <= RoomData.aliveCount - 1) this.shuffle();
if(WordSpace.nameQueue.queue.length == 0) return null;
let tempElement = WordSpace.nameQueue.queue.shift(); let tempElement = WordSpace.nameQueue.queue.shift();
if(WordSpace.nameQueue.queue.length <= RoomData.aliveCount) this.shuffle(); if(!RoomData.players[tempElement].isAlive || WordSpace.nameQueue.getCount(RoomData.players[tempElement]) >= 3) return WordSpace.nameQueue.pop();
if(!RoomData.players[tempElement].isAlive && WordSpace.nameQueue.getCount(tempElement) < 3) return WordSpace.nameQueue.pop();
else return RoomData.players[tempElement]; else return RoomData.players[tempElement];
}, },
getCount: function(player) getCount: function(player)
{ {
let i = 0; WordSpace.nameQueue.counter = 0;
WordSpace.nameGroup.forEach(function(element){ WordSpace.nameGroup.forEach(function(element){
if(element.id == player.id) i++; if(element.id == player.id) WordSpace.nameQueue.counter++;
}) })
return i; WordSpace.wordGroup.forEach(function(element){
if(element instanceof NameWord && element.ownerId == player.id) WordSpace.nameQueue.counter++;
})
return WordSpace.nameQueue.counter;
}, },
counter: 0,
initiate: function() initiate: function()
{ {
this.shuffle(); this.shuffle();
......
...@@ -142,7 +142,7 @@ io.on('connection', function(socket) ...@@ -142,7 +142,7 @@ io.on('connection', function(socket)
socket.on('disconnect', function(reason) socket.on('disconnect', function(reason)
{ {
let data = socket.playerData; let data = socket.playerData;
if (typeof data.id === undefined) if (data === undefined)
{ {
console.log('[ERROR] data.id is undefined'); console.log('[ERROR] data.id is undefined');
console.log(GameServer.currentPlayer); console.log(GameServer.currentPlayer);
......
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