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

시즌 19호 머지

parents 54451891 0afe790b
......@@ -82,7 +82,7 @@ class GameRoom
{
this.roomId = GameServer.getRoomNumber();
this.roomIndex = -1;
this.startCount = 2;
this.startCount = 5;
this.maxPlayer = 100;
this.nextRank = 100;
......@@ -143,7 +143,7 @@ class GameRoom
{
if (this.currentPhase === GameServer.Phase.READY)
{
this.endTime = Date.now() + 10000; // 방 대기 시간
this.endTime = Date.now() + 30000; // 방 대기 시간
this.announceToRoom('setRoomCount',
{
isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length,
......@@ -362,6 +362,7 @@ class Player
this.killCount = 0;
this.earnedStrongHopae = 0;
this.attackSucceed = 0;
this.skin = playerData.skin;
this.isAlive = false;
this.isInThisRoom = true;
......
......@@ -13,7 +13,8 @@ BackGround.otherCharacters = [];
BackGround.drawCharacter = function(scene)
{
RoomData.myself.playerImage = scene.add.sprite(game.config.width / 2, game.config.height * 41 / 48, 'pyeongminWrite').setScale(0.45).setDepth(5);
RoomData.myself.playerImage = scene.add.sprite(game.config.width / 2, game.config.height * 41 / 48, Enums.characterSkin[PlayerData.userData.skin] + 'Write')
.setScale(0.45).setDepth(5);
RoomData.myself.position = new Phaser.Math.Vector2(RoomData.myself.playerImage.x - 20, RoomData.myself.playerImage.y - 20);
RoomData.myself.mat = scene.add.sprite(RoomData.myself.position.x, RoomData.myself.position.y, 'mat')
.setScale(0.45).setDepth(4);
......@@ -22,7 +23,8 @@ BackGround.drawCharacter = function(scene)
if(element.id != RoomData.myself.id)
{
element.position = BackGround.characterPos.pop();
element.playerImage = scene.add.sprite(element.position.x, element.position.y, 'pyeongminWrite').setScale(0.315).setDepth(5);
element.playerImage = scene.add.sprite(element.position.x, element.position.y, Enums.characterSkin[element.skin] + 'Write')
.setScale(0.315).setDepth(5);
element.playerImage.flipX = element.position.x < game.config.width / 2 ? true : false;
element.mat = scene.add.sprite(element.position.x - 14 * (element.position.x < game.config.width / 2 ? -1 : 1), element.position.y - 14, 'mat')
.setScale(0.315).setDepth(4);
......
......@@ -223,7 +223,7 @@ socket.on('defeat', function(msg) // object player
let victim = RoomData.findPlayer(msg.id);
RoomData.aliveCount--;
victim.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.gameOver]);
victim.playerImage.play(WordSpace.characterAnims[victim.skin][Enums.characterAnim.gameOver]);
if (msg.lastAttack != null)
......@@ -313,6 +313,7 @@ socket.on('defeat', function(msg) // object player
{
var keys = Object.keys(Enums.item);
WordSpace.generateWord.Item(ScenesData.gameScene, Enums.item[keys[keys.length * Math.random() << 0]]);
Audio.playSound(ScenesData.gameScene, 'getItem');
RoomData.myself.killCount++;
}
}
......@@ -362,7 +363,7 @@ socket.on('defeat', function(msg) // object player
{
RoomData.myself = RoomData.players[msg.index];
setTimeout(() => {
gameEndMenu(true);
gameEndMenu(false);
}, 2000);
}
});
......@@ -392,6 +393,7 @@ socket.on('attackSucceed', function(msg)
{
//console.log('client');
let tempWord = WordSpace.generateWord.Name(ScenesData.gameScene, true, RoomData.findPlayer(msg.victimId));
tempWord.instantiate(ScenesData.gameScene);
let victimPos = RoomData.findPlayer(msg.victimId).position;
tempWord.physicsObj.setPosition(victimPos.x, victimPos.y);
tempWord.wordObj.setPosition(tempWord.physicsObj.x, tempWord.physicsObj.y);
......@@ -415,9 +417,10 @@ var gameEndMenu = function(isWin)
let earnedMoney = 0;
if(isWin) earnedMoney += 20;
earnedMoney += RoomData.myself.killCount * 3;
earnedMoney += parseInt(WordSpace.playerTypingRate / 10);
earnedMoney += parseInt(WordSpace.playerTyping / 10);
earnedMoney += Math.max(20, Math.pow(RoomData.myself.attackSucceed, 2));
earnedMoney += parseInt(20 * (1 - (RoomData.myself.rank - 1) / (RoomData.players.length - 1)));
earnedMoney = parseInt(earnedMoney / 40);
Input.inputField.text.destroy();
......@@ -429,25 +432,29 @@ var gameEndMenu = function(isWin)
ScenesData.changeScene('menuScene');
}
ScenesData.gameScene.backToMenuDialog = ScenesData.gameScene.rexUI.add.dialog({
x: game.config.width / 2,
y: game.config.height / 2,
background: ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'dialog1').setOrigin(0.5, 0.5),
background: ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'resultDialog').setOrigin(0.5, 0.5),
content: ScenesData.gameScene.rexUI.add.dialog({
x: game.config.width / 2,
y: game.config.height / 2,
choices: [
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 150, game.config.height / 2 - 100, 10.2, 'playerStand', 0.7, 'center'),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 - 180, 10.2,
'button', 1, 'center', '등수 : ' + RoomData.myself.rank + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 - 60, 10.2,
'button', 1, 'center', '킬 수 : ' + RoomData.myself.killCount + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 + 60, 10.2,
'button', 1, 'center', '획득 강호패 : ' + RoomData.myself.earnedStrongHopae + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 + 180, 10.2,
'button', 1, 'center', '획득 골드 : ' + earnedMoney + '', 20).layout()
ScenesData.gameScene.add.sprite(game.config.width / 2 - 200, game.config.height / 2 - 100, Enums.characterSkin[PlayerData.userData.skin] + 'Stand')
.setOrigin(0.5, 0.5).setDepth(10.2).setScale(0.7),
ScenesData.gameScene.add.text(game.config.width / 2 + 400, game.config.height / 2 - 220, RoomData.myself.rank + '')
.setOrigin(1, 0.5).setColor('#000000').setDepth(10.2).setPadding(5,5,5,5).setFont('50pt sejongFont'),
ScenesData.gameScene.add.text(game.config.width / 2 + 400, game.config.height / 2 - 80, RoomData.myself.killCount + '')
.setOrigin(1, 0.5).setColor('#000000').setDepth(10.2).setPadding(5,5,5,5).setFont('50pt sejongFont'),
ScenesData.gameScene.add.text(game.config.width / 2 + 400, game.config.height / 2 + 80, RoomData.myself.earnedStrongHopae + '')
.setOrigin(1, 0.5).setColor('#000000').setDepth(10.2).setPadding(5,5,5,5).setFont('50pt sejongFont'),
ScenesData.gameScene.add.text(game.config.width / 2 + 400, game.config.height / 2 + 220, '+' + earnedMoney + '')
.setOrigin(1, 0.5).setColor('#000000').setDepth(10.2).setPadding(5,5,5,5).setFont('50pt sejongFont'),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 250, game.config.height / 2 + 220, 10.2, 'nameBgr' + RoomData.myself.nickname.length, 2,
'center', RoomData.myself.nickname, 50, '#ffffff', 0.45, 0.5)
],
align: {
......@@ -455,32 +462,33 @@ var gameEndMenu = function(isWin)
}
}),
actions: [
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 200, game.config.height / 2 + 300, 10.2, 'exitBtn', 1, 'center', ' ').layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 200, game.config.height / 2 + 300, 10.2, 'spectateBtn', 1, 'center', ' ').layout()
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 200, game.config.height / 2 + 350, 10.2, 'exitBtn', 1, 'center', ' ').layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 200, game.config.height / 2 + 350, 10.2, 'spectateBtn', 1, 'center', ' ').layout()
],
space: {
action: 10,
left: 50,
right: 50,
top: 50,
bottom: 50,
left: 50, right: 50, top: 50, bottom: 50,
},
align: {
actions: 'center' // 'center'|'left'|'right'
}
}).setDepth(10.2);
if(isWin) ScenesData.gameScene.winMark =
ScenesData.gameScene.add.sprite(game.config.width / 2 + 500, game.config.height / 2 + 400, 'resultStamp').setOrigin(0.5, 0.5).setDepth(10.2);
ScenesData.gameScene.backToMenuDialog
.on('button.click', function (button, groupName, index) {
if(index == 0) endGame();
else
{
if(isWin) ScenesData.gameScene.winMark.destroy();
ScenesData.gameScene.backToMenuDialog.setVisible(false);
ScenesData.gameScene.backToMenuBtn = UIObject.createButton(ScenesData.gameScene,
UIObject.createLabel(ScenesData.gameScene, 100, 900, 10.2, 'spectateBtn', 1, 'center'), 1, 0, 2, temp);
UIObject.createLabel(ScenesData.gameScene, 200, 900, 10.2, 'spectateBtn', 1, 'center'), -1, -1, -1, endGame);
}
}, ScenesData.gameScene)
.on('button.over', function (button, groupName, index) {
......
var Enums = Enums || {};
Enums.characterAnim = { sit: 0, write: 1, notBurning: 2, smallBurning: 3, bigBurning: 4, throw: 5, hit: 6, gameOver: 7 }
Enums.item = {invincible: "무적", nameList: "명단", charge: "충전", clean: "청소", heavy: "중량", dark: "암흑"}
\ No newline at end of file
Enums.item = {invincible: "무적", nameList: "명단", charge: "충전", clean: "청소", heavy: "중량", dark: "암흑"}
Enums.characterSkin = ["pyeongmin", "sunbi"]
\ No newline at end of file
......@@ -264,6 +264,8 @@ FirebaseClient.prototype.updateUserData = function(key, valueChanged, replace =
case 'killCount':
beforeData.killCount = replace ? (valueChanged) : (beforeData.killCount + valueChanged);
break;
case 'skin':
beforeData.skin = valueChanged;
default:
console.log('[ERROR] database has no key for ' + key);
break;
......@@ -311,7 +313,8 @@ class UserData
this.recentHopae = null;
this.title = [];
this.money = 0;
this.item = [];
this.item = [0];
this.killCount = 0;
this.skin = 0;
}
}
\ No newline at end of file
......@@ -322,7 +322,7 @@ Input.inputField =
scene.input.keyboard.on('keyup', function() {Input.pressCount--; Input.justPressed = '';
if(ScenesData.currentScene == ScenesData.hopaeScene)
{
ScenesData.hopaeScene.checkBtn.setEnable(Input.checkProperInput(Input.inputField.text.text) || (Input.finalInput.length > 1) ? true : false);
ScenesData.hopaeScene.checkBtn.setEnable(Input.checkProperInput(Input.inputField.text.text) && (Input.finalInput.length > 1) ? true : false);
ScenesData.hopaeScene.warningText.setVisible(WordReader.getWordTyping(Input.finalInput) > 9 ? true : false);
}
})
......
......@@ -40,6 +40,14 @@ ResourceLoader.loadImage = function(scene)
scene.load.spritesheet('pyeongminGameOver', 'assets/image/character/pyeongmin/balladang/pyeong_balladang.png', { frameWidth: 720, frameHeight: 700 });
scene.load.image('pyeongminStand', 'assets/image/character/pyeongmin/pyeong_stand.png');
scene.load.spritesheet('sunbiSit', 'assets/image/character/sunbi/sunbi_sit.png', { frameWidth: 521, frameHeight: 610 });
scene.load.spritesheet('sunbiWrite', 'assets/image/character/sunbi/sunbi_write.png', { frameWidth: 521, frameHeight: 610 });
scene.load.spritesheet('sunbiThrow', 'assets/image/character/sunbi/sunbi_throw.png', { frameWidth: 521, frameHeight: 610 });
scene.load.spritesheet('sunbiBurningSmall', 'assets/image/character/sunbi/sunbi_burning_small.png', { frameWidth: 521, frameHeight: 610 });
scene.load.spritesheet('sunbiBurningBig', 'assets/image/character/sunbi/sunbi_burning_big.png', { frameWidth: 521, frameHeight: 610 });
scene.load.spritesheet('sunbiGameOver', 'assets/image/character/sunbi/sunbi_die.png', { frameWidth: 720, frameHeight: 700 });
scene.load.image('sunbiStand', 'assets/image/character/sunbi/sunbi_stand.png');
scene.load.spritesheet('wordBreak', 'assets/image/word/wordbreak.png', { frameWidth: 180, frameHeight: 180 });
scene.load.spritesheet('hopaeSceneInput', 'assets/image/word/hopaeSceneInput.png', { frameWidth: 239, frameHeight: 45 });
scene.load.spritesheet('gameSceneInput', 'assets/image/etc/wordSpace/wordspace.png', { frameWidth: 253, frameHeight: 67 });
......@@ -52,6 +60,8 @@ ResourceLoader.loadImage = function(scene)
scene.load.image('dialog1', 'assets/image/UI/dialog/dialog1.png');
scene.load.image('dialog2', 'assets/image/UI/dialog/dialog2.png');
scene.load.image('resultDialog', 'assets/image/UI/dialog/result_background.png');
scene.load.image('resultStamp', 'assets/image/UI/dialog/result_stamp.png');
scene.load.image('friendlyPlayBtn', 'assets/image/UI/main/friendlyPlay.png');
scene.load.image('rankPlayBtn', 'assets/image/UI/main/rankPlay.png');
scene.load.image('shopBtn', 'assets/image/UI/main/shop.png');
......@@ -100,46 +110,52 @@ ResourceLoader.loadAnimation = function(scene)
frameRate: 20,
repeat: 0
});
WordSpace.pyeongminAnims[Enums.characterAnim.sit] = scene.anims.create({
key: 'pyeongminSitAnim',
frames: scene.anims.generateFrameNumbers('pyeongminSit'),
frameRate: 10,
repeat: 0
});
WordSpace.pyeongminAnims[Enums.characterAnim.write] = scene.anims.create({
key: 'pyeongminWriteAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: 0
});
WordSpace.pyeongminAnims[Enums.characterAnim.notBurning] = scene.anims.create({
key: 'pyeongminnotBurningAnim',
frames: scene.anims.generateFrameNumbers('pyeongminWrite'),
frameRate: 10,
repeat: -1
});
WordSpace.pyeongminAnims[Enums.characterAnim.smallBurning] = scene.anims.create({
key: 'pyeongminsmallBurningAnim',
frames: scene.anims.generateFrameNumbers('pyeongminBurningSmall'),
frameRate: 10,
repeat: -1
});
WordSpace.pyeongminAnims[Enums.characterAnim.bigBurning] = scene.anims.create({
key: 'pyeongminbigBurningAnim',
frames: scene.anims.generateFrameNumbers('pyeongminBurningBig'),
frameRate: 10,
repeat: -1
});
WordSpace.pyeongminAnims[Enums.characterAnim.throw] = scene.anims.create({
key: 'pyeongminThrowAnim',
frames: scene.anims.generateFrameNumbers('pyeongminThrow'),
frameRate: 10,
repeat: 0
});
WordSpace.pyeongminAnims[Enums.characterAnim.gameOver] = scene.anims.create({
key: 'pyeongminGameOverAnim',
frames: scene.anims.generateFrameNumbers('pyeongminGameOver'),
frameRate: 10,
repeat: 0
});
for(let i = 0; i < 2; i++)
{
WordSpace.characterAnims[i][Enums.characterAnim.sit] = scene.anims.create({
key: Enums.characterSkin[i] + 'SitAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'Sit'),
frameRate: 10,
repeat: 0
});
WordSpace.characterAnims[i][Enums.characterAnim.write] = scene.anims.create({
key: Enums.characterSkin[i] + 'WriteAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'Write'),
frameRate: 10,
repeat: 0
});
WordSpace.characterAnims[i][Enums.characterAnim.notBurning] = scene.anims.create({
key: Enums.characterSkin[i] + 'notBurningAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'Write'),
frameRate: 10,
repeat: -1
});
WordSpace.characterAnims[i][Enums.characterAnim.smallBurning] = scene.anims.create({
key: Enums.characterSkin[i] + 'smallBurningAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'BurningSmall'),
frameRate: 10,
repeat: -1
});
WordSpace.characterAnims[i][Enums.characterAnim.bigBurning] = scene.anims.create({
key: Enums.characterSkin[i] + 'bigBurningAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'BurningBig'),
frameRate: 10,
repeat: -1
});
WordSpace.characterAnims[i][Enums.characterAnim.throw] = scene.anims.create({
key: Enums.characterSkin[i] + 'ThrowAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'Throw'),
frameRate: 10,
repeat: 0
});
WordSpace.characterAnims[i][Enums.characterAnim.gameOver] = scene.anims.create({
key: Enums.characterSkin[i] + 'GameOverAnim',
frames: scene.anims.generateFrameNumbers(Enums.characterSkin[i] + 'GameOver'),
frameRate: 10,
repeat: 0
});
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ var menuScene = new Phaser.Class(
create: function()
{
ResourceLoader.loadAnimation(this);
BackGround.drawMenu(this);
Audio.playSound(this, 'login');
ScenesData.menuScene.tutorialFrame = 0;
......@@ -135,7 +136,8 @@ var menuScene = new Phaser.Class(
this.organizeHopae();
this.createCurrentHopae();
this.myCharacter = this.add.sprite(game.config.width / 2, game.config.height / 2, 'pyeongminStand').setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
this.myCharacter = this.add.sprite(game.config.width / 2, game.config.height / 2, Enums.characterSkin[PlayerData.userData.skin] + 'Stand')
.setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
this.roomEnterDialog = this.rexUI.add.dialog({
x: game.config.width / 2,
......@@ -169,7 +171,7 @@ var menuScene = new Phaser.Class(
this.roomEnterDialog
.on('button.click', function (button, groupName, index) {
if(index == 0) socket.emit('enterRoom', PlayerData.nickname);
if(index == 0) socket.emit('enterRoom', {nickname: PlayerData.nickname, skin: PlayerData.userData.skin});
else
{
this.roomEnterDialog.setVisible(false);
......@@ -195,7 +197,7 @@ var menuScene = new Phaser.Class(
this.shopBtn = UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 100, 950, 5, 'shopBtn', 1, 'center'), -1, -1, -1,
function()
{
console.log('상점 입장');
ScenesData.changeScene('shopScene');
})
this.hopaeBtn = UIObject.createButton(this, UIObject.createLabel(this, 100, 950, 5, 'hopaeManageBtn', 1, 'center'), -1, -1, -1,
......@@ -338,6 +340,135 @@ var hopaeScene = new Phaser.Class(
}
});
var shopScene = new Phaser.Class(
{
Extends: Phaser.Scene,
initialize:
function shopScene ()
{
Phaser.Scene.call(this, {key: 'shopScene'});
},
preload: function()
{
ScenesData.shopScene = 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'
});
},
create: function()
{
BackGround.drawBackground(this);
this.currentSkin = this.add.sprite(500, game.config.height / 2, Enums.characterSkin[PlayerData.userData.skin] + 'Stand')
.setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
this.money = this.add.text(200, 70, PlayerData.userData.money + "").setOrigin(1, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont');
this.pyeongminItem = {
price: 0,
itemName: this.add.text(game.config.width - 500, 300, '평민').setOrigin(1, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont'),
itemPrice: this.add.text(game.config.width - 200, 300, '0냥').setOrigin(1, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont'),
buyBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 600, 300, 5, 'button', 1, 'center', '구매하기'), -1, -1, -1,
function()
{
if(PlayerData.userData.money >= ScenesData.shopScene.pyeongminItem.price)
{
ScenesData.shopScene.pyeongminItem.buyBtn.setVisible(false);
ScenesData.shopScene.pyeongminItem.itemPrice.setText('보유중');
fbClient.updateUserData('item', 0);
fbClient.updateUserData('money', -ScenesData.shopScene.pyeongminItem.price);
ScenesData.shopScene.money.setText(PlayerData.userData.money + '');
ScenesData.shopScene.pyeongminItem.useBtn.setVisible(true);
}
}),
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 300, 5, 'button', 1, 'center', '사용하기'), -1, -1, -1,
function()
{
if(PlayerData.userData.item.includes(0))
{
ScenesData.shopScene.pyeongminItem.useBtn.setVisible(false);
ScenesData.shopScene.sunbiItem.useBtn.setVisible(true);
fbClient.updateUserData('skin', 0);
ScenesData.shopScene.currentSkin.destroy();
ScenesData.shopScene.currentSkin = ScenesData.shopScene.add.sprite(500, game.config.height / 2, Enums.characterSkin[PlayerData.userData.skin] + 'Stand')
.setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
}
})
}
this.pyeongminItem.buyBtn.setEnable(PlayerData.userData.money < ScenesData.shopScene.pyeongminItem.price ? false : true);
if(PlayerData.userData.item.includes(0))
{
this.pyeongminItem.buyBtn.setVisible(false);
this.pyeongminItem.itemPrice.setText('보유중');
}
if(PlayerData.userData.skin == 0 || !PlayerData.userData.item.includes(0)) this.pyeongminItem.useBtn.setVisible(false);
this.sunbiItem = {
price: 100,
itemName: this.add.text(game.config.width - 500, 400, '선비').setOrigin(1, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont'),
itemPrice: this.add.text(game.config.width - 200, 400, '100냥').setOrigin(1, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont'),
buyBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 400, 5, 'button', 1, 'center', '구매하기'), -1, -1, -1,
function()
{
if(PlayerData.userData.money >= ScenesData.shopScene.sunbiItem.price)
{
ScenesData.shopScene.sunbiItem.buyBtn.setVisible(false);
ScenesData.shopScene.sunbiItem.itemPrice.setText('보유중');
fbClient.updateUserData('item', 1);
fbClient.updateUserData('money', -ScenesData.shopScene.sunbiItem.price);
ScenesData.shopScene.money.setText(PlayerData.userData.money + '');
ScenesData.shopScene.sunbiItem.useBtn.setVisible(true);
}
}),
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 400, 5, 'button', 1, 'center', '사용하기'), -1, -1, -1,
function()
{
if(PlayerData.userData.item.includes(1))
{
ScenesData.shopScene.sunbiItem.useBtn.setVisible(false);
ScenesData.shopScene.pyeongminItem.useBtn.setVisible(true);
fbClient.updateUserData('skin', 1);
ScenesData.shopScene.currentSkin.destroy();
ScenesData.shopScene.currentSkin = ScenesData.shopScene.add.sprite(500, game.config.height / 2, Enums.characterSkin[PlayerData.userData.skin] + 'Stand')
.setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
}
})
}
this.sunbiItem.buyBtn.setEnable(PlayerData.userData.money < ScenesData.shopScene.sunbiItem.price ? false : true);
if(PlayerData.userData.item.includes(1))
{
this.sunbiItem.buyBtn.setVisible(false);
this.sunbiItem.itemPrice.setText('보유중');
}
if(PlayerData.userData.skin == 1 || !PlayerData.userData.item.includes(1)) this.sunbiItem.useBtn.setVisible(false);
this.backBtn = UIObject.createButton(this, UIObject.createLabel(this, 200, 900, 5, 'exitBtn', 1, 'center', ' '), -2, -2, -2,
function()
{
ScenesData.changeScene('menuScene');
});
}
});
var roomScene = new Phaser.Class(
{
Extends: Phaser.Scene,
......@@ -458,7 +589,6 @@ var gameScene = new Phaser.Class(
{
WordSpace.gameTimer = new Phaser.Time.Clock(this);
WordSpace.gameTimer.start();
ResourceLoader.loadAnimation(this);
CSVParsing.CSVParse(this);
BackGround.drawBackground(this);
BackGround.drawBrain(this);
......
......@@ -57,7 +57,6 @@ class WordObject
setTimeout(function() {
breakAnim.destroy();
}, 200);
Audio.playSound(ScenesData.gameScene, 'killWord');
}
attract()
......@@ -109,8 +108,9 @@ class NormalWord extends WordObject
super.destroy();
if(isNormallyRemoved)
{
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.pyeongminAnims[Enums.characterAnim.sit]);
Audio.playSound(ScenesData.gameScene, 'killWord');
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.sit]);
switch(this.wordGrade)
{
case 0: WordSpace.attackGauge.add(2.5); break;
......@@ -149,8 +149,8 @@ class AttackWord extends WordObject
let textColor = '#000000'
super.instantiate(scene, spriteName, textColor, 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 = this.isDark ? 1 : 0.5;
.setTint(Phaser.Display.Color.GetColor(40, 40, 40)).setScale(this.scale).setDepth(1.1);
this.maskBackground.alpha = this.isDark ? 1 : 0.7;
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);
......@@ -190,8 +190,9 @@ class AttackWord extends WordObject
super.destroy();
if(isNormallyRemoved)
{
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.pyeongminAnims[Enums.characterAnim.sit]);
Audio.playSound(ScenesData.gameScene, 'killWord');
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.sit]);
switch(this.wordGrade)
{
case 0: WordSpace.attackGauge.add(2.5); break;
......@@ -262,10 +263,7 @@ class NameWord extends WordObject
if(this.isStrong)
{
this.physicsObj.setScale(this.follower.t < 0.2 ? 0.2 : this.follower.t * this.scale);
this.wordObj.setFont({
font: (this.follower.t < 0.2 ? 0.05 : this.follower.t * this.scale * this.fontScale) +'pt sejongFont',
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
});
this.wordObj.setScale((this.follower.t < 0.2 ? 0.2 : this.follower.t * this.scale) * 0.9);
}
}
}
......@@ -274,8 +272,9 @@ class NameWord extends WordObject
super.destroy();
if(isNormallyRemoved)
{
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.pyeongminAnims[Enums.characterAnim.sit]);
Audio.playSound(ScenesData.gameScene, 'killWord');
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.sit]);
ScenesData.gameScene.physics.world.removeCollider(this.physicsObj.wordCollider);
WordSpace.wordGroup.forEach(function(element)
{
......@@ -303,10 +302,6 @@ class NameWord extends WordObject
duration: 2000,
repeat: 0
});
//이동경로 디버그
/*var graphics = ScenesData.gameScene.add.graphics();
graphics.lineStyle(2, 0xffffff, 1);
this.path.draw(graphics);*/
}
}
}
......@@ -361,8 +356,9 @@ class ItemWord extends WordObject
super.destroy();
if(isNormallyRemoved)
{
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.pyeongminAnims[Enums.characterAnim.sit]);
Audio.playSound(ScenesData.gameScene, 'killWord');
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.write]);
RoomData.myself.playerImage.anims.chain(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.sit]);
WordSpace.attackGauge.add(0.5);
switch(this.itemType)
{
......
......@@ -12,6 +12,9 @@ WordSpace.isTimerOn = false;
WordSpace.isInvincible = false;
WordSpace.pyeongminAnims = [];
WordSpace.characterAnims = Array(2).fill(null).map(() => Array());
WordSpace.wordGroup = [];
WordSpace.nameGroup = [];
WordSpace.attackPaperGroup = null;
......@@ -192,7 +195,6 @@ WordSpace.generateWord =
Item: function(scene, itemType, lenRate)
{
word = new ItemWord(itemType);
Audio.playSound(ScenesData.gameScene, 'getItem');
WordSpace.pushWord(scene, word, lenRate);
return word;
}
......@@ -277,16 +279,16 @@ WordSpace.findWord = function(wordText)
switch(tempAttackOption.wordCount)
{
case 2:
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.notBurning]);
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.notBurning]);
break;
case 3:
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.smallBurning]);
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.smallBurning]);
break;
case 4:
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.smallBurning]);
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.smallBurning]);
break;
case 5:
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.bigBurning]);
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.bigBurning]);
break;
default:
console.log('Improper attack option.');
......@@ -396,8 +398,8 @@ WordSpace.attack = function(wordText, grade)
WordSpace.attackGauge.resetValue();
WordSpace.setPlayerTyping.add(wordText);
RoomData.myself.playerImage.play(WordSpace.pyeongminAnims[Enums.characterAnim.throw]);
RoomData.myself.playerImage.anims.chain(WordSpace.pyeongminAnims[Enums.characterAnim.sit]);
RoomData.myself.playerImage.play(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.throw]);
RoomData.myself.playerImage.anims.chain(WordSpace.characterAnims[PlayerData.userData.skin][Enums.characterAnim.sit]);
Input.attackOption.isHeavy = false;
Input.attackOption.isDark = false;
}
......@@ -492,7 +494,8 @@ WordSpace.changePhase = function(newPhase)
//WordSpace.pauseCycle(true);
// 여기서 종이 드르륵 열면됨
let phaseChangeBgr = ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'phase' + newPhase).setOrigin(0.5, 0.5).setDepth(9.9).play('phase' + newPhase + 'Anim');
let phaseChangeBgr = ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'phase' + newPhase).setOrigin(0.5, 0.5).setDepth(9.9)
.play('phase' + newPhase + 'Anim');
//ScenesData.gameScene.scene.pause('gameScene');
setTimeout(function()
{
......@@ -515,7 +518,6 @@ WordSpace.resetGame = function()
WordSpace.isGameOver = false;
WordSpace.isTimerOn = false;
WordSpace.isInvincible = false;
WordSpace.pyeongminAnims = [];
WordSpace.wordGroup = [];
WordSpace.nameGroup = [];
......
......@@ -14,7 +14,7 @@ var config = {
}
},
backgroundColor: Phaser.Display.Color.HexStringToColor('#ffffff').color,//GetColor(245,208,138),
scene: [ menuScene, hopaeScene, roomScene, gameScene ]
scene: [ menuScene, hopaeScene, shopScene, roomScene, gameScene ]
};
var game = null;
......
......@@ -29,6 +29,7 @@ io.on('connection', function(socket)
{
id: GameServer.getPlayerNumber(),
nickname: '게스트',
skin: 0,
currentRoom: null,
playingData: null,
isReceivable: false
......@@ -45,11 +46,12 @@ io.on('connection', function(socket)
socket.on('enterRoom', function(msg) // string new_nickname
{
if(msg.length < 1) socket.emit('alert' ,'errNicknameEmpty');
if(msg.nickname.length < 1) socket.emit('alert' ,'errNicknameEmpty');
else
{
socket.playerData.nickname = msg;
console.log(new Date().toLocaleTimeString('ko-KR') + ' ['+socket.playerData.id+'] nickname set to ' + msg);
socket.playerData.nickname = msg.nickname;
socket.playerData.skiin = msg.skin;
console.log(new Date().toLocaleTimeString('ko-KR') + ' ['+socket.playerData.id+'] nickname set to ' + msg.nickname);
GameServer.enterEmptyRoom(socket);
}
});
......
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