Commit 6818ac38 authored by 18손재민's avatar 18손재민

나머지 버튼 UI들 모두 적용 및 생성 가능한 호패 개수 5개로 제한

parent 9ce93814
...@@ -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 = 5; this.startCount = 3;
this.maxPlayer = 100; this.maxPlayer = 100;
this.nextRank = 100; this.nextRank = 100;
...@@ -143,7 +143,7 @@ class GameRoom ...@@ -143,7 +143,7 @@ class GameRoom
{ {
if (this.currentPhase === GameServer.Phase.READY) if (this.currentPhase === GameServer.Phase.READY)
{ {
this.endTime = Date.now() + 30000; // 방 대기 시간 this.endTime = Date.now() + 1000; // 방 대기 시간
this.announceToRoom('setRoomCount', this.announceToRoom('setRoomCount',
{ {
isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length, isEnable: true, endTime: this.endTime, playerCount: this.currentPlayer.length,
......
...@@ -398,7 +398,7 @@ var gameEndMenu = function(isWin) ...@@ -398,7 +398,7 @@ var gameEndMenu = function(isWin)
Input.inputField.text.destroy(); Input.inputField.text.destroy();
var temp = function(){ var endGame = function(){
socket.emit('exitFromRoom', RoomData.myself.id); socket.emit('exitFromRoom', RoomData.myself.id);
fbClient.updateUserData('killCount', RoomData.myself.killCount); fbClient.updateUserData('killCount', RoomData.myself.killCount);
...@@ -410,21 +410,21 @@ var gameEndMenu = function(isWin) ...@@ -410,21 +410,21 @@ var gameEndMenu = function(isWin)
x: game.config.width / 2, x: game.config.width / 2,
y: game.config.height / 2, y: game.config.height / 2,
background: ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'noticeBackground').setOrigin(0.5, 0.5), background: ScenesData.gameScene.add.sprite(game.config.width / 2, game.config.height / 2, 'dialog1').setOrigin(0.5, 0.5),
content: ScenesData.gameScene.rexUI.add.dialog({ content: ScenesData.gameScene.rexUI.add.dialog({
x: game.config.width / 2, x: game.config.width / 2,
y: game.config.height / 2, y: game.config.height / 2,
choices: [ choices: [
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 100, game.config.height / 2 - 100, 10.2, 'playerStand', 0.7, 'center'), 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 + 120, game.config.height / 2 - 150, 10.2, UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 - 180, 10.2,
'button', 1, 'center', '등수 : ' + RoomData.myself.rank + '', 30).layout(), 'button', 1, 'center', '등수 : ' + RoomData.myself.rank + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 120, game.config.height / 2 - 50, 10.2, UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 - 60, 10.2,
'button', 1, 'center', '킬 수 : ' + RoomData.myself.killCount + '', 30).layout(), 'button', 1, 'center', '킬 수 : ' + RoomData.myself.killCount + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 120, game.config.height / 2 + 50, 10.2, UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 + 60, 10.2,
'button', 1, 'center', '획득 강호패 : ' + RoomData.myself.earnedStrongHopae + '', 30).layout(), 'button', 1, 'center', '획득 강호패 : ' + RoomData.myself.earnedStrongHopae + '', 20).layout(),
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 120, game.config.height / 2 + 150, 10.2, UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 150, game.config.height / 2 + 180, 10.2,
'button', 1, 'center', '획득 골드 : ' + earnedMoney + '', 30).layout() 'button', 1, 'center', '획득 골드 : ' + earnedMoney + '', 20).layout()
], ],
align: { align: {
...@@ -432,17 +432,17 @@ var gameEndMenu = function(isWin) ...@@ -432,17 +432,17 @@ var gameEndMenu = function(isWin)
} }
}), }),
actions: [ actions: [
UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 - 120, game.config.height / 2 + 300, 10.2, 'button', 1, 'center', '나가기').layout(), 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 + 120, game.config.height / 2 + 300, 10.2, 'button', 1, 'center', '관전하기').layout() UIObject.createLabel(ScenesData.gameScene, game.config.width / 2 + 200, game.config.height / 2 + 300, 10.2, 'spectateBtn', 1, 'center', ' ').layout()
], ],
space: { space: {
action: 10, action: 10,
left: 20, left: 50,
right: 20, right: 50,
top: 20, top: 50,
bottom: 20, bottom: 50,
}, },
align: { align: {
...@@ -452,11 +452,12 @@ var gameEndMenu = function(isWin) ...@@ -452,11 +452,12 @@ var gameEndMenu = function(isWin)
ScenesData.gameScene.backToMenuDialog ScenesData.gameScene.backToMenuDialog
.on('button.click', function (button, groupName, index) { .on('button.click', function (button, groupName, index) {
if(index == 0) temp(); if(index == 0) endGame();
else else
{ {
ScenesData.gameScene.backToMenuDialog.setVisible(false); ScenesData.gameScene.backToMenuDialog.setVisible(false);
ScenesData.gameScene.backToMenuBtn = UIObject.createButton(ScenesData.gameScene, UIObject.createLabel(ScenesData.gameScene, 100, 900, 10.2, 'pyeongminThrow', 0.5, 'center'), 1, 0, 2, temp); ScenesData.gameScene.backToMenuBtn = UIObject.createButton(ScenesData.gameScene,
UIObject.createLabel(ScenesData.gameScene, 100, 900, 10.2, 'spectateBtn', 1, 'center'), 1, 0, 2, temp);
} }
}, ScenesData.gameScene) }, ScenesData.gameScene)
.on('button.over', function (button, groupName, index) { .on('button.over', function (button, groupName, index) {
......
...@@ -44,15 +44,26 @@ ResourceLoader.loadImage = function(scene) ...@@ -44,15 +44,26 @@ ResourceLoader.loadImage = function(scene)
scene.load.spritesheet('hopaeSceneInput', 'assets/image/word/hopaeSceneInput.png', { frameWidth: 239, frameHeight: 45 }); 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 }); scene.load.spritesheet('gameSceneInput', 'assets/image/etc/wordSpace/wordspace.png', { frameWidth: 253, frameHeight: 67 });
scene.load.image('attackPaper', 'assets/image/etc/paper_crumbled.png'); scene.load.image('attackPaper', 'assets/image/etc/paper_crumbled.png');
scene.load.image('itemBag', 'assets/image/etc/itembag2.png');
scene.load.image('button', 'assets/placeholder/button.png'); scene.load.image('button', 'assets/placeholder/button.png');
scene.load.image('panel', 'assets/placeholder/panel.png'); scene.load.image('panel', 'assets/placeholder/panel.png');
scene.load.image('noticeBackground', 'assets/image/UI/noticeWindow/background.png');
scene.load.image('itemBag', 'assets/image/etc/itembag2.png'); scene.load.image('dialog1', 'assets/image/UI/dialog/dialog1.png');
scene.load.image('dialog2', 'assets/image/UI/dialog/dialog2.png');
scene.load.image('friendlyPlayBtn', 'assets/image/UI/main/friendlyPlay.png'); scene.load.image('friendlyPlayBtn', 'assets/image/UI/main/friendlyPlay.png');
scene.load.image('rankPlayBtn', 'assets/image/UI/main/rankPlay.png'); scene.load.image('rankPlayBtn', 'assets/image/UI/main/rankPlay.png');
scene.load.image('shopBtn', 'assets/image/UI/main/shop.png'); scene.load.image('shopBtn', 'assets/image/UI/main/shop.png');
scene.load.image('hopaeManageBtn', 'assets/image/UI/main/hopaeManage.png'); scene.load.image('hopaeManageBtn', 'assets/image/UI/main/hopaeManage.png');
scene.load.image('helpBtn', 'assets/image/UI/main/help.png'); scene.load.image('helpBtn', 'assets/image/UI/main/help.png');
scene.load.image('cancelBtn', 'assets/image/UI/decisionBtn/cancel.png');
scene.load.image('confirmBtn', 'assets/image/UI/decisionBtn/confirm.png');
scene.load.image('exitBtn', 'assets/image/UI/decisionBtn/exit.png');
scene.load.image('noBtn', 'assets/image/UI/decisionBtn/no.png');
scene.load.image('spectateBtn', 'assets/image/UI/decisionBtn/spectate.png');
scene.load.image('yesBtn', 'assets/image/UI/decisionBtn/yes.png');
......
...@@ -38,7 +38,7 @@ var menuScene = new Phaser.Class( ...@@ -38,7 +38,7 @@ var menuScene = new Phaser.Class(
Audio.loopSound(this, 'login'); Audio.loopSound(this, 'login');
ScenesData.menuScene.tutorialFrame = 0; ScenesData.menuScene.tutorialFrame = 0;
ScenesData.menuScene.tutorialImage = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, game.config.height / 2, 11, ScenesData.menuScene.tutorialImage = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, game.config.height / 2, 11,
'tutorialImage', 1, 'center'), -1, -1, -1, 'tutorialImage', 1, 'center'), -2, -2, -2,
function() function()
{ {
ScenesData.menuScene.tutorialFrame = (ScenesData.menuScene.tutorialFrame + 1) % 9; ScenesData.menuScene.tutorialFrame = (ScenesData.menuScene.tutorialFrame + 1) % 9;
...@@ -140,25 +140,21 @@ var menuScene = new Phaser.Class( ...@@ -140,25 +140,21 @@ var menuScene = new Phaser.Class(
x: game.config.width / 2, x: game.config.width / 2,
y: game.config.height / 2, y: game.config.height / 2,
background: this.add.sprite(game.config.width / 2, game.config.height / 2, 'noticeBackground').setOrigin(0.5, 0.5), background: this.add.sprite(game.config.width / 2, game.config.height / 2, 'dialog1').setOrigin(0.5, 0.5),
content: this.add.text(0, 0, '대기실에 참가하시겠습니까?', { content: this.add.text(game.config.width / 2, game.config.height / 2, '대기실에 참가하시겠습니까?', {
font: '50pt sejongFont' font: '50pt sejongFont'
}), }).setColor('#000000'),
actions: [ actions: [
UIObject.createLabel(this, 0, 0, 0, 'button', 1, 'center', '', 50), UIObject.createLabel(this, 0, 0, 0, 'yesBtn', 1, 'center', ' '),
UIObject.createLabel(this, 0, 0, 0, 'button', 1, 'center', '아니오', 50) UIObject.createLabel(this, 0, 0, 0, 'noBtn', 1, 'center', ' ')
], ],
space: { space: {
content: 25, content: 25, action: 100,
action: 100,
left: 20, left: 50, right: 50, top: 50, bottom: 50,
right: 20,
top: 20,
bottom: 20,
}, },
align: { align: {
...@@ -204,7 +200,8 @@ var menuScene = new Phaser.Class( ...@@ -204,7 +200,8 @@ var menuScene = new Phaser.Class(
this.hopaeBtn = UIObject.createButton(this, UIObject.createLabel(this, 100, 950, 5, 'hopaeManageBtn', 1, 'center'), -1, -1, -1, this.hopaeBtn = UIObject.createButton(this, UIObject.createLabel(this, 100, 950, 5, 'hopaeManageBtn', 1, 'center'), -1, -1, -1,
function() function()
{ {
ScenesData.changeScene('hopaeScene'); if(PlayerData.userData.hopae.length > 4) console.log('호패가 5개입니다.');
else ScenesData.changeScene('hopaeScene');
}) })
this.helpBtn = UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 100, 75, 5, 'helpBtn', 1, 'center'), -1, -1, -1, this.helpBtn = UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 100, 75, 5, 'helpBtn', 1, 'center'), -1, -1, -1,
function() function()
...@@ -254,14 +251,14 @@ var hopaeScene = new Phaser.Class( ...@@ -254,14 +251,14 @@ var hopaeScene = new Phaser.Class(
Input.inputField.generate(this, function(){}, this.inputBackground); Input.inputField.generate(this, function(){}, this.inputBackground);
UIObject.createLabel(this, game.config.width / 2, game.config.height / 2 - 200, 2, 'noticeBackground', 1, 'center', UIObject.createLabel(this, game.config.width / 2, game.config.height / 2 - 200, 2, 'dialog2', 1, 'center',
'호패는 오직 한글만 입력이 가능합니다.\n띄어쓰기도 사용할 수 없습니다.', 50, '#000000').layout(); '호패는 오직 한글만 입력이 가능합니다.\n띄어쓰기도 사용할 수 없습니다.', 50, '#000000').layout();
this.checkDialog = this.rexUI.add.dialog({ this.checkDialog = this.rexUI.add.dialog({
x: game.config.width / 2, x: game.config.width / 2,
y: game.config.height / 2, y: game.config.height / 2,
background: this.add.sprite(game.config.width / 2, game.config.height / 2, 'noticeBackground').setOrigin(0.5, 0.5), background: this.add.sprite(game.config.width / 2, game.config.height / 2, 'dialog1').setOrigin(0.5, 0.5),
content: this.add.text(0, 0, '이 이름으로 하시겠습니까?' + (PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0 ? content: this.add.text(0, 0, '이 이름으로 하시겠습니까?' + (PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0 ?
'\n(최초 호패는 비용이 들지 않습니다.)' : '\n변경에는 엽전이 소모됩니다.'), { '\n(최초 호패는 비용이 들지 않습니다.)' : '\n변경에는 엽전이 소모됩니다.'), {
...@@ -269,13 +266,13 @@ var hopaeScene = new Phaser.Class( ...@@ -269,13 +266,13 @@ var hopaeScene = new Phaser.Class(
}), }),
actions: [ actions: [
UIObject.createLabel(this, 0, 0, 0, 'button', 1, 'center', '', 50), UIObject.createLabel(this, 0, 0, 0, 'yesBtn', 1, 'center', ' '),
UIObject.createLabel(this, 0, 0, 0, 'button', 1, 'center', '아니오', 50) UIObject.createLabel(this, 0, 0, 0, 'noBtn', 1, 'center', ' ')
], ],
space: { space: {
content: 25, action: 100, content: 25, action: 100,
left: 20, right: 20, top: 20, bottom: 20, left: 50, right: 50, top: 50, bottom: 50,
}, },
align: { actions: 'center' }, align: { actions: 'center' },
...@@ -289,13 +286,13 @@ var hopaeScene = new Phaser.Class( ...@@ -289,13 +286,13 @@ var hopaeScene = new Phaser.Class(
if(PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0 || PlayerData.userData.money > 0) if(PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0 || PlayerData.userData.money > 0)
{ {
fbClient.updateUserData('hopae', {name: Input.inputField.text.text, type: 'wood'}); fbClient.updateUserData('hopae', {name: Input.inputField.text.text, type: 'wood'});
fbClient.updateUserData('money', PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0 ? 0 : -1); if(PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0) fbClient.updateUserData('money', -1);
ScenesData.changeScene('menuScene'); ScenesData.changeScene('menuScene');
} }
else else
{ {
this.checkDialog.setVisible(false); this.checkDialog.setVisible(false);
this.errorMsg = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, game.config.height / 2, 10, 'noticeBackground', 1, 'center', this.errorMsg = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, game.config.height / 2, 10, 'dialog1', 1, 'center',
'엽전이 부족합니다', 50, '#000000').layout().popUp(200), 0, 0, 0, '엽전이 부족합니다', 50, '#000000').layout().popUp(200), 0, 0, 0,
function() function()
{ {
...@@ -316,7 +313,7 @@ var hopaeScene = new Phaser.Class( ...@@ -316,7 +313,7 @@ var hopaeScene = new Phaser.Class(
.on('button.out', function (button, groupName, index) { .on('button.out', function (button, groupName, index) {
//console.log('button out'); //console.log('button out');
}); });
this.warningText = UIObject.createLabel(this, game.config.width / 2, game.config.height / 2 - 100, 5, 'noticeBackground', 1, 'center', this.warningText = UIObject.createLabel(this, game.config.width / 2, game.config.height / 2 - 100, 5, 'dialog1', 1, 'center',
'이름 타수가 많아 플레이에 패널티가 있을 수 있습니다', 40, '#000000').setVisible(false).layout(); '이름 타수가 많아 플레이에 패널티가 있을 수 있습니다', 40, '#000000').setVisible(false).layout();
this.checkBtn = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, 900, 5, 'pyeongminWrite', 0.5, 'center'), 1, 0, 2, this.checkBtn = UIObject.createButton(this, UIObject.createLabel(this, game.config.width / 2, 900, 5, 'pyeongminWrite', 0.5, 'center'), 1, 0, 2,
...@@ -327,7 +324,7 @@ var hopaeScene = new Phaser.Class( ...@@ -327,7 +324,7 @@ var hopaeScene = new Phaser.Class(
ScenesData.hopaeScene.checkBtn.setEnable(false); ScenesData.hopaeScene.checkBtn.setEnable(false);
ScenesData.hopaeScene.checkDialog.setVisible(true).popUp(200); ScenesData.hopaeScene.checkDialog.setVisible(true).popUp(200);
} }
}) }).setEnable(false);
if(!(PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0)) if(!(PlayerData.userData.hopae === undefined || PlayerData.userData.hopae.length == 0))
{ {
this.backBtn = UIObject.createButton(this, UIObject.createLabel(this, 100, 900, 5, 'pyeongminWrite', 0.5, 'center'), 1, 0, 2, this.backBtn = UIObject.createButton(this, UIObject.createLabel(this, 100, 900, 5, 'pyeongminWrite', 0.5, 'center'), 1, 0, 2,
...@@ -476,8 +473,6 @@ var gameScene = new Phaser.Class( ...@@ -476,8 +473,6 @@ var gameScene = new Phaser.Class(
WordSpace.startCycle(this); WordSpace.startCycle(this);
WordSpace.setPlayerTyping.initiate(this);
WordSpace.nameQueue.initiate(); WordSpace.nameQueue.initiate();
this.warningImage = this.add.sprite(game.config.width / 2, game.config.height / 2, 'weightWarning').setDisplaySize(game.config.width, game.config.height).setDepth(0.1).setAlpha(0) this.warningImage = this.add.sprite(game.config.width / 2, game.config.height / 2, 'weightWarning').setDisplaySize(game.config.width, game.config.height).setDepth(0.1).setAlpha(0)
......
...@@ -12,7 +12,7 @@ UIObject.createLabel = function (scene, x, y, depth, image, size, align, text = ...@@ -12,7 +12,7 @@ UIObject.createLabel = function (scene, x, y, depth, image, size, align, text =
text: scene.add.text(x, y, text, { text: scene.add.text(x, y, text, {
font: textSize + 'pt sejongFont', font: textSize + 'pt sejongFont',
align: 'center' align: 'center'
}).setDepth(depth).setOrigin(textOriginX, textOriginY).setColor(textColor), }).setDepth(depth).setOrigin(textOriginX, textOriginY).setColor(textColor).setPadding(30, 30, 30, 30),
space: { space: {
left: 10, left: 10,
...@@ -58,28 +58,28 @@ UIObject.createButton = function(scene, buttonGameObject, overFrame, outFrame, d ...@@ -58,28 +58,28 @@ UIObject.createButton = function(scene, buttonGameObject, overFrame, outFrame, d
.on('pointerover', () => { .on('pointerover', () => {
if(temp.enabled) if(temp.enabled)
{ {
if(overFrame != -1) buttonGameObjectBackground.setFrame(overFrame); if(overFrame > 0) buttonGameObjectBackground.setFrame(overFrame);
else buttonGameObject.setScale(1.1); if(overFrame != -2) buttonGameObject.setScale(1.1);
} }
}) })
.on('pointerdown', () => { .on('pointerdown', () => {
if(temp.enabled) if(temp.enabled)
{ {
if(downFrame != -1) buttonGameObjectBackground.setFrame(downFrame); if(downFrame > 0) buttonGameObjectBackground.setFrame(downFrame);
else buttonGameObject.setScale(0.9); if(downFrame != -2) buttonGameObject.setScale(0.9);
clickCallback(); clickCallback();
} }
}) })
.on('pointerup', () => { .on('pointerup', () => {
if(temp.enabled) if(temp.enabled)
{ {
if(overFrame != -1) buttonGameObjectBackground.setFrame(overFrame); if(overFrame > 0) buttonGameObjectBackground.setFrame(overFrame);
else buttonGameObject.setScale(1.1); if(overFrame != -2) buttonGameObject.setScale(1.1);
} }
}) })
.on('pointerout', () => { .on('pointerout', () => {
if(outFrame != -1) buttonGameObjectBackground.setFrame(outFrame); if(outFrame > 0) buttonGameObjectBackground.setFrame(outFrame);
else buttonGameObject.setScale(1); if(outFrame != -2) buttonGameObject.setScale(1);
}) })
temp.setEnable = function(isEnable) temp.setEnable = function(isEnable)
{ {
......
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