Commit 3050301f authored by 18신대성's avatar 18신대성 Committed by Chae Ho Shin

Merge branch 'server' of https://git.kucatdog.net/tear-of-sejong/sejong25 into server

parents 0d4ff0b4 cfa46b01
......@@ -14,6 +14,7 @@
<script src="js/CSVParsing.js"></script>
<script src="js/SelectWord.js"></script>
<script src="js/BGMsound.js"></script>
<script src="js/Enums.js"></script>
</head>
<body>
<script src="js/Client.js"></script>
......
var Enums = Enums || {};
\ No newline at end of file
var Enums = Enums || {};
Enums.characterAnim = { write: 0, attackWrite: 1, throw: 2, hit: 3 }
\ No newline at end of file
......@@ -109,6 +109,8 @@ var gameScene = new Phaser.Class(
create: function()
{
WordSpace.gameTimer = new Phaser.Time.Clock(this);
WordSpace.gameTimer.start();
WordSpace.loadAnimation(this);
CSVParsing.CSVParse(this);
BackGround.drawBrain(this);
......
......@@ -49,10 +49,11 @@ class WordObject
{
fontSize: (this.scale * this.fontScale) +'pt',
fontFamily: '"궁서", 궁서체, serif',
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
//fontStyle: (this.wordWeight > 5 ? 'bold' : '')
});
if (!this.isNameWord) this.wordObj.setColor('#000000').setOrigin(0.5,0.5);
else this.wordObj.setColor('#ffffff').setOrigin(0.45,0.5);
this.createdTime = WordSpace.gameTimer.now;
WordSpace.totalWeight += this.wordWeight;
WordSpace.totalWordNum += 1;
WordSpace.setGameOverTimer();
......@@ -79,7 +80,7 @@ class WordObject
this.wordObj.destroy();
this.physicsObj.destroy();
}
BackGround.myCharacter.play(WordSpace.pyeongminAnims[0]);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
}
attract()
......@@ -145,11 +146,42 @@ class AttackWord extends WordObject
this.wordWeight += this.wordWeight * 0.2 * (WordReader.getWordTyping(_playerData.nickname) - 9);
this.wordWeight *= isStrong ? 3 : 2;
this.attacker = _playerData;
this.counterTime = WordSpace.gameTimer.now + 1000 * (this.wordTyping <= (5 - _wordGrade) * 2.5 ? this.wordTyping / (Math.max(200, WordSpace.playerTyping) / 60) * 1.5 :
((5 - _wordGrade) * 3 + (this.wordTyping - (5 - _wordGrade) * 2.5) * 2.5) / (Math.max(200, WordSpace.playerTyping) / 60) * 1.5);
/*this.counterTime = WordSpace.gameTimer.now + 1000 * (this.wordTyping <= (5 - _wordGrade) * 2.5 ? this.wordTyping / (Math.max(200, WordSpace.playerTyping) / 60) * 1.5 :
((5 - _wordGrade) * 3 + (this.wordTyping - (5 - _wordGrade) * 2.5) * 2.5) / (Math.max(200, WordSpace.playerTyping) / 60) * 1.5);*/
this.counterTime = WordSpace.gameTimer.now + 10000;
console.log('Attack text : ' + text + ', Attacker : ' + this.attacker.nickname + ', Weight : ' + this.wordWeight);
console.log('Counter time : ' + this.counterTime);
}
instantiate(scene, lenRate)
{
super.instantiate(scene, lenRate);
this.maskBackground = scene.physics.add.sprite(this.physicsObj.x, this.physicsObj.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6))
.setTint(Phaser.Display.Color.GetColor(120, 120, 120)).setScale(this.scale);
this.maskBackground.alpha = 0.5;
this.shape = scene.make.graphics();
var rect = new Phaser.Geom.Rectangle(0, 0, this.maskBackground.width * this.scale, this.maskBackground.height * this.scale);
this.shape.fillStyle(0xffffff).fillRectShape(rect);
this.mask = this.shape.createGeometryMask();
this.maskBackground.setMask(this.mask);
this.maskStart = this.physicsObj.x;
this.maskEnd = this.physicsObj.x - this.physicsObj.width * this.scale;
}
attract()
{
super.attract();
if(WordSpace.gameTimer.now < this.counterTime)
{
this.maskBackground.setPosition(this.physicsObj.x, this.physicsObj.y);
this.shape.x = this.physicsObj.x + (this.maskEnd - this.maskStart) *
((WordSpace.gameTimer.now - this.createdTime) / (this.counterTime - this.createdTime)) - this.physicsObj.width * this.scale / 2;
this.shape.y = this.physicsObj.y - this.physicsObj.height * this.scale / 2;
}
else if(this.maskBackground != null) this.maskBackground.destroy();
}
destroy()
{
switch(this.wordGrade)
......@@ -166,7 +198,7 @@ class AttackWord extends WordObject
let tempWord = WordSpace.generateWord.Name(ScenesData.gameScene, true, this.attacker);
tempWord.destroy();
}
//WordSpace.nameGroup.push(new NameWord(this.attacker, true));
if(this.maskBackground != null) this.maskBackground.destroy();
super.destroy();
}
}
......@@ -185,7 +217,8 @@ class NameWord extends WordObject
attract()
{
if(this.isActive) super.attract();
else{
else
{
this.path.getPoint(this.follower.t, this.follower.vec);
this.physicsObj.setPosition(this.follower.vec.x, this.follower.vec.y);
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y);
......
......@@ -210,20 +210,27 @@ WordSpace.loadAnimation = function(scene)
repeat: 0,
hideOnComplete: false
});
WordSpace.pyeongminAnims.push(scene.anims.create({
key: 'write',
WordSpace.pyeongminAnims[Enums.characterAnim.write] = scene.anims.create({
key: 'pyeongminWriteAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: 0,
hideOnComplete: false
}));
WordSpace.pyeongminAnims.push(scene.anims.create({
key: 'throw',
});
WordSpace.pyeongminAnims[Enums.characterAnim.attackWrite] = scene.anims.create({
key: 'pyeongminattackWriteAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: -1,
hideOnComplete: false
});
WordSpace.pyeongminAnims[Enums.characterAnim.throw] = scene.anims.create({
key: 'pyeongminThrowAnim',
frames: scene.anims.generateFrameNumbers('pyeongminThrow'),
frameRate: 10,
repeat: 0,
hideOnComplete: false
}));
});
}
WordSpace.generateWord =
......@@ -327,6 +334,8 @@ WordSpace.findWord = function(wordText)
Input.attackMode = true;
WordSpace.attackGauge.pauseCycle(true);
WordSpace.setPlayerTyping.add(wordText);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.attackWrite]);
BackGround.myCharacter.anims.msPerFrame /= (4 - WordSpace.attackGauge.getAttackOption().wordGrade);
}
else // 오타 체크
{
......@@ -371,8 +380,6 @@ WordSpace.setPlayerTyping =
},
initiate: function(scene)
{
WordSpace.gameTimer = new Phaser.Time.Clock(scene);
WordSpace.gameTimer.start();
this.text = scene.add.text(100,200,'현재 타수 : ' + WordSpace.playerTyping.toFixed(1)).setDepth(10).setColor('#000000');
}
}
......@@ -405,7 +412,7 @@ WordSpace.attack = function(wordText, grade)
WordSpace.attackGauge.resetValue();
WordSpace.setPlayerTyping.add(wordText);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[1]);
BackGround.myCharacter.play(WordSpace.pyeongminAnims[Enums.characterAnim.throw]);
}
else WordSpace.attackGauge.cutValue(0.3);
Input.maxInput = 6;
......
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