Commit 82a56735 authored by 18손재민's avatar 18손재민 Committed by 18류지석

이제 플레이어의 타수를 측정함

parent 2fab5dd6
...@@ -195,6 +195,7 @@ WordSpace.findWord = function(wordText) ...@@ -195,6 +195,7 @@ WordSpace.findWord = function(wordText)
default: console.log('[ERR] wrong grade of word'); break; default: console.log('[ERR] wrong grade of word'); break;
} }
weightest.destroy(); weightest.destroy();
WordSpace.playerTyping.add(wordText);
} }
else if (wordText === '공격' && WordSpace.attackGauge.value > 3) // 공격모드 진입. else if (wordText === '공격' && WordSpace.attackGauge.value > 3) // 공격모드 진입.
{ {
...@@ -203,6 +204,7 @@ WordSpace.findWord = function(wordText) ...@@ -203,6 +204,7 @@ WordSpace.findWord = function(wordText)
Input.maxInput = Input.attackOption.wordCount; Input.maxInput = Input.attackOption.wordCount;
Input.attackMode = true; Input.attackMode = true;
WordSpace.attackGauge.pauseCycle(true); WordSpace.attackGauge.pauseCycle(true);
WordSpace.playerTyping.add(wordText);
} }
else else
{ {
...@@ -210,6 +212,24 @@ WordSpace.findWord = function(wordText) ...@@ -210,6 +212,24 @@ WordSpace.findWord = function(wordText)
} }
} }
WordSpace.playerTyping =
{
totalTyping: 0,
playerTyping: 0,
add: function(wordText)
{
this.totalTyping += wordText != null ? WordReader.getWordTyping(wordText) : 0;
this.playerTyping = this.totalTyping / this.gameTimer.now * 1000;
this.text.setText('현재 타수 : ' + this.playerTyping.toFixed(1));
},
initiate: function(scene)
{
this.gameTimer = new Phaser.Time.Clock(scene);
this.gameTimer.start();
this.text = scene.add.text(100,200,'현재 타수 : ' + this.playerTyping.toFixed(1)).setDepth(10).setColor('#000000');
}
}
WordSpace.attack = function(wordText, grade) WordSpace.attack = function(wordText, grade)
{ {
wordText = Input.removeConVow(wordText); wordText = Input.removeConVow(wordText);
...@@ -220,6 +240,7 @@ WordSpace.attack = function(wordText, grade) ...@@ -220,6 +240,7 @@ WordSpace.attack = function(wordText, grade)
// 이부분에서 게이지에 따라 급수 결정 // 이부분에서 게이지에 따라 급수 결정
// 이부분은 서버 잘써야함 // 이부분은 서버 잘써야함
WordSpace.attackGauge.resetValue(); WordSpace.attackGauge.resetValue();
WordSpace.playerTyping.add(wordText);
} }
else else
{ {
......
...@@ -34,6 +34,7 @@ function create() ...@@ -34,6 +34,7 @@ function create()
WordSpace.wordPhysicsGroup = this.physics.add.group(); WordSpace.wordPhysicsGroup = this.physics.add.group();
WordSpace.wordCycle.resetCycle(this, 3000); WordSpace.wordCycle.resetCycle(this, 3000);
WordSpace.attackGauge.resetCycle(this); WordSpace.attackGauge.resetCycle(this);
WordSpace.playerTyping.initiate(this);
CSVParsing.CSVParse(this); CSVParsing.CSVParse(this);
} }
...@@ -43,6 +44,7 @@ function update() ...@@ -43,6 +44,7 @@ function update()
{ {
element.attract(); element.attract();
}); });
WordSpace.playerTyping.add('');
} }
var socket = io.connect(); var socket = io.connect();
......
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