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

이제 킬로그가 UI로 제대로 뜸

parent d503cacc
...@@ -82,7 +82,7 @@ class GameRoom ...@@ -82,7 +82,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;
......
...@@ -207,14 +207,54 @@ socket.on('defeat', function(msg) // object player ...@@ -207,14 +207,54 @@ socket.on('defeat', function(msg) // object player
RoomData.players[msg.index].position = position; RoomData.players[msg.index].position = position;
RoomData.players[msg.index].nicknameText = nicknameText; RoomData.players[msg.index].nicknameText = nicknameText;
let victim = RoomData.findPlayer(msg.id);
RoomData.aliveCount--; RoomData.aliveCount--;
RoomData.findPlayer(msg.id).playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.gameOver]); victim.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.gameOver]);
if (msg.lastAttack != null) if (msg.lastAttack != null)
{ {
let lastAttacker = RoomData.findPlayer(msg.lastAttack.attackerId).nickname; let lastAttacker = RoomData.findPlayer(msg.lastAttack.attackerId);
console.log(RoomData.findPlayer(msg.id).nickname + ' defeated by ' + lastAttacker + ', with ' + msg.lastAttack.word); let attackWord = msg.lastAttack.word;
WordSpace.killLogForTest += ('\n' + lastAttacker + ' --' + msg.lastAttack.word + '-> ' + RoomData.findPlayer(msg.id).nickname); console.log(victim.nickname + ' defeated by ' + lastAttacker.nickname + ', with ' + msg.lastAttack.word);
let itemBag = ScenesData.gameScene.add.sprite(RoomData.findPlayer(msg.lastAttack.attackerId).position.x, RoomData.findPlayer(msg.lastAttack.attackerId).position.y, if(WordSpace.lastAttackGroup.length != 0)
{
WordSpace.lastAttackGroup.forEach(function(element){
element.destroy();
})
}
let attackerLabel = UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 400, 0, 10.2, 'nameBgr' + lastAttacker.nickname.length, 2,
'center', lastAttacker.nickname, 50, '#ffffff', 0.45, 0.5);
let wordLabel = UIObject.createLabel(ScenesData.gameScene, game.config.width / 2, 0, 10.2, 'wordBgr' + msg.lastAttack.wordGrade + '_' + attackWord.length, 2,
'center', attackWord, 50, '#000000', 0.45, 0.5);
let victimLabel = UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 400, 0, 10.2, 'nameBgr' + victim.nickname.length, 2,
'center', victim.nickname, 50, '#ffffff', 0.45, 0.5);
WordSpace.lastAttackGroup.push(attackerLabel);
WordSpace.lastAttackGroup.push(wordLabel);
WordSpace.lastAttackGroup.push(victimLabel);
ScenesData.gameScene.tweens.add({
targets: [attackerLabel, wordLabel, victimLabel],
y: 100,
ese: 'Linear',
duration: 500,
repeat: 0,
onComplete: function () {
setTimeout(function() {
ScenesData.gameScene.tweens.add({
targets: [attackerLabel, wordLabel, victimLabel],
y: -100,
ease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back'
duration: 500,
repeat: 0, // -1: infinity
yoyo: false });
}, 1000);
},
})
let itemBag = ScenesData.gameScene.add.sprite(lastAttacker.position.x, lastAttacker.position.y,
'itemBag').setScale(0).setDepth(5.3); 'itemBag').setScale(0).setDepth(5.3);
ScenesData.gameScene.tweens.add({ ScenesData.gameScene.tweens.add({
targets: itemBag, targets: itemBag,
...@@ -233,10 +273,9 @@ socket.on('defeat', function(msg) // object player ...@@ -233,10 +273,9 @@ socket.on('defeat', function(msg) // object player
ease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back' ease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back'
duration: 500, duration: 500,
repeat: 0, // -1: infinity repeat: 0, // -1: infinity
yoyo: false }); });
}, 1500); }, 1000);
}, }
onCompleteScope: ScenesData.gameScene
}); });
setTimeout(function() { setTimeout(function() {
itemBag.destroy(); itemBag.destroy();
...@@ -245,14 +284,42 @@ socket.on('defeat', function(msg) // object player ...@@ -245,14 +284,42 @@ socket.on('defeat', function(msg) // object player
{ {
var keys = Object.keys(Enums.item); var keys = Object.keys(Enums.item);
WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item[keys[keys.length * Math.random() << 0]]); WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item[keys[keys.length * Math.random() << 0]]);
RoomData.myself.killCount++; RoomData.myself.killCount++;
} }
} }
else else
{ {
console.log(RoomData.findPlayer(msg.id).nickname + ' defeated'); console.log(victim.nickname + ' defeated');
WordSpace.killLogForTest += ('\n--Suicide->' + RoomData.findPlayer(msg.id).nickname); if(WordSpace.lastAttackGroup.length != 0)
{
WordSpace.lastAttackGroup.forEach(function(element){
element.destroy();
})
}
let victimLabel = UIObject.createLabel(ScenesData.gameScene, game.config.width / 2, 0, 10.2, 'nameBgr' + victim.nickname.length, 2, 'center', victim.nickname, 50, '#ffffff', 0.45, 0.5);
WordSpace.lastAttackGroup.push(victimLabel);
ScenesData.gameScene.tweens.add({
targets: victimLabel,
y: 100,
ese: 'Linear',
duration: 500,
repeat: 0,
onComplete: function () {
setTimeout(function() {
ScenesData.gameScene.tweens.add({
targets: victimLabel,
y: -100,
ease: 'Linear', // 'Cubic', 'Elastic', 'Bounce', 'Back'
duration: 500,
repeat: 0, // -1: infinity
});
}, 1000);
}
})
} }
if(msg.id == RoomData.myself.id) if(msg.id == RoomData.myself.id)
{ {
......
...@@ -432,7 +432,6 @@ var gameScene = new Phaser.Class( ...@@ -432,7 +432,6 @@ var gameScene = new Phaser.Class(
}); });
WordSpace.resetGame(); WordSpace.resetGame();
WordSpace.weightTextObjForTest = this.add.text(game.config.width * 5 / 64, game.config.height * 5 / 48, '뇌의 무게: (현재) 0 / ' + this.brainCapacity + ' (전체)').setDepth(9.9).setColor('#000000'); WordSpace.weightTextObjForTest = this.add.text(game.config.width * 5 / 64, game.config.height * 5 / 48, '뇌의 무게: (현재) 0 / ' + this.brainCapacity + ' (전체)').setDepth(9.9).setColor('#000000');
WordSpace.killLogTextForTest = this.add.text(game.config.width * 25 / 32, game.config.height * 5 / 72, WordSpace.killLogForTest).setDepth(9.9).setColor('#000000').setAlign('right');
}, },
create: function() create: function()
...@@ -487,7 +486,6 @@ var gameScene = new Phaser.Class( ...@@ -487,7 +486,6 @@ var gameScene = new Phaser.Class(
}); });
WordSpace.weightTextObjForTest.setText('뇌의 무게: (현재) '+WordSpace.totalWeight+' / '+ WordSpace.brainCapacity+' (전체)'); WordSpace.weightTextObjForTest.setText('뇌의 무게: (현재) '+WordSpace.totalWeight+' / '+ WordSpace.brainCapacity+' (전체)');
WordSpace.killLogTextForTest.setText(WordSpace.killLogForTest);
WordSpace.setPlayerTyping.add(''); WordSpace.setPlayerTyping.add('');
} }
} }
......
...@@ -3,8 +3,6 @@ var WordSpace = WordSpace || {}; ...@@ -3,8 +3,6 @@ var WordSpace = WordSpace || {};
// for test // for test
WordSpace.weightTextObjForTest = null; WordSpace.weightTextObjForTest = null;
WordSpace.nameWordTextForTest = null; WordSpace.nameWordTextForTest = null;
WordSpace.killLogTextForTest = null;
WordSpace.killLogForTest = '';
WordSpace.nextWordCode = 0; WordSpace.nextWordCode = 0;
WordSpace.totalWeight = 0; //현재 단어 무게 총합 WordSpace.totalWeight = 0; //현재 단어 무게 총합
...@@ -20,6 +18,7 @@ WordSpace.nameGroup = []; ...@@ -20,6 +18,7 @@ WordSpace.nameGroup = [];
WordSpace.attackPaperGroup = null; WordSpace.attackPaperGroup = null;
WordSpace.wordForcedGroup = []; WordSpace.wordForcedGroup = [];
WordSpace.wordPhysicsGroup = null; WordSpace.wordPhysicsGroup = null;
WordSpace.lastAttackGroup = [];
WordSpace.GradeProb = [0.35, 0.6, 0.8]; WordSpace.GradeProb = [0.35, 0.6, 0.8];
WordSpace.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3}; WordSpace.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3};
...@@ -502,7 +501,6 @@ WordSpace.changePhase = function(newPhase) ...@@ -502,7 +501,6 @@ WordSpace.changePhase = function(newPhase)
// 여기서 종이 닫으면됨 // 여기서 종이 닫으면됨
phaseChangeBgr.anims.playReverse('phase' + newPhase + 'Anim'); phaseChangeBgr.anims.playReverse('phase' + newPhase + 'Anim');
phaseChangeBgr.on('animationcomplete', function(currentAnim, currentFrame, sprite){sprite.destroy()}); phaseChangeBgr.on('animationcomplete', function(currentAnim, currentFrame, sprite){sprite.destroy()});
//phaseChangeBgr.destroy();
Audio.playSound(ScenesData.gameScene, 'startGame'); Audio.playSound(ScenesData.gameScene, 'startGame');
//WordSpace.pauseCycle(false); //WordSpace.pauseCycle(false);
//console.log('start again'); //console.log('start again');
...@@ -512,8 +510,6 @@ WordSpace.resetGame = function() ...@@ -512,8 +510,6 @@ WordSpace.resetGame = function()
{ {
WordSpace.weightTextObjForTest = null; WordSpace.weightTextObjForTest = null;
WordSpace.nameWordTextForTest = null; WordSpace.nameWordTextForTest = null;
WordSpace.killLogTextForTest = null;
WordSpace.killLogForTest = '';
WordSpace.nextWordCode = 0; WordSpace.nextWordCode = 0;
WordSpace.totalWeight = 0; //현재 단어 무게 총합 WordSpace.totalWeight = 0; //현재 단어 무게 총합
......
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