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

Merge branch 'shopScene'

parents 6c7405b3 b820986a
This diff is collapsed.
This diff is collapsed.
......@@ -52,6 +52,11 @@ BackGround.drawMenu = function(scene)
scene.add.sprite(game.config.width / 2, game.config.height / 2, 'menuBackground').setDisplaySize(game.config.width, game.config.height).setDepth(3);
}
BackGround.drawShop = function(scene)
{
scene.add.sprite(game.config.width / 2, game.config.height / 2, 'shopBackground').setDisplaySize(game.config.width, game.config.height).setDepth(3);
}
BackGround.drawRoom = function(scene)
{
scene.add.sprite(game.config.width / 2, game.config.height / 2, 'roomBackground').setDisplaySize(game.config.width, game.config.height).setDepth(5.2);
......
......@@ -7,6 +7,7 @@ ResourceLoader.loadBackGround = function(scene)
scene.load.image('gameBackground', 'assets/image/background/background_brain.png');
scene.load.image('menuBackground', 'assets/image/UI/main/mainBackground.png');
scene.load.image('roomBackground', 'assets/placeholder/roomBackground.png');
scene.load.image('shopBackground', 'assets/image/UI/shop/shop_background.png');
}
ResourceLoader.loadImage = function(scene)
......@@ -65,6 +66,7 @@ ResourceLoader.loadImage = function(scene)
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');
scene.load.image('boughtItem', 'assets/image/UI/shop/bought_item.png');
scene.load.image('hopaeManageBtn', 'assets/image/UI/main/hopaeManage.png');
scene.load.image('helpBtn', 'assets/image/UI/main/help.png');
......@@ -75,6 +77,8 @@ ResourceLoader.loadImage = function(scene)
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');
scene.load.image('buyBtn', 'assets/image/UI/decisionBtn/buy.png');
scene.load.image('equipBtn', 'assets/image/UI/decisionBtn/equip.png');
......@@ -156,6 +160,4 @@ ResourceLoader.loadAnimation = function(scene)
repeat: 0
});
}
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ var menuScene = new Phaser.Class(
PlayerData.nickname = PlayerData.currentHopae.name;
this.userName = this.add.text(250, 75, PlayerData.userData.userName).setOrigin(0, 0.5).setColor('#000000').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont');
this.money = this.add.text(950, 70, PlayerData.userData.money).setOrigin(1, 0.5).setColor('#ffffff').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont');
this.money = this.add.text(950, 70, PlayerData.userData.money + '').setOrigin(1, 0.5).setColor('#ffffff').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont');
this.organizeHopae = function()
{
......@@ -368,11 +368,11 @@ var shopScene = new Phaser.Class(
create: function()
{
BackGround.drawBackground(this);
BackGround.drawShop(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.money = this.add.text(400, 260, PlayerData.userData.money + "").setOrigin(1, 0.5).setColor('#ffffff').setDepth(9.9).setPadding(5,5,5,5).setFont('40pt sejongFont');
......@@ -380,7 +380,7 @@ var shopScene = new Phaser.Class(
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,
buyBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 600, 300, 5, 'buyBtn', 1, 'center'), -1, -1, -1,
function()
{
if(PlayerData.userData.money >= ScenesData.shopScene.pyeongminItem.price)
......@@ -391,9 +391,10 @@ var shopScene = new Phaser.Class(
fbClient.updateUserData('money', -ScenesData.shopScene.pyeongminItem.price);
ScenesData.shopScene.money.setText(PlayerData.userData.money + '');
ScenesData.shopScene.pyeongminItem.useBtn.setVisible(true);
ScenesData.shopScene.pyeongminItem.boughtSign.setVisible(true);
}
}),
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 300, 5, 'button', 1, 'center', '사용하기'), -1, -1, -1,
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 300, 5, 'equipBtn', 1, 'center'), -1, -1, -1,
function()
{
if(PlayerData.userData.item.includes(0))
......@@ -402,16 +403,18 @@ var shopScene = new Phaser.Class(
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')
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);
}
})
}),
boughtSign: UIObject.createLabel(ScenesData.shopScene, game.config.width - 400, 300, 5, 'boughtItem', 1, 'center').setVisible(false)
}
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.boughtSign.setVisible(true);
this.pyeongminItem.itemPrice.setText('보유중');
}
if(PlayerData.userData.skin == 0 || !PlayerData.userData.item.includes(0)) this.pyeongminItem.useBtn.setVisible(false);
......@@ -422,7 +425,7 @@ var shopScene = new Phaser.Class(
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,
buyBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 400, 5, 'buyBtn', 1, 'center'), -1, -1, -1,
function()
{
if(PlayerData.userData.money >= ScenesData.shopScene.sunbiItem.price)
......@@ -433,9 +436,10 @@ var shopScene = new Phaser.Class(
fbClient.updateUserData('money', -ScenesData.shopScene.sunbiItem.price);
ScenesData.shopScene.money.setText(PlayerData.userData.money + '');
ScenesData.shopScene.sunbiItem.useBtn.setVisible(true);
ScenesData.shopScene.sunbiItem.boughtSign.setVisible(true);
}
}),
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 400, 5, 'button', 1, 'center', '사용하기'), -1, -1, -1,
useBtn: UIObject.createButton(this, UIObject.createLabel(this, game.config.width - 800, 400, 5, 'equipBtn', 1, 'center'), -1, -1, -1,
function()
{
if(PlayerData.userData.item.includes(1))
......@@ -447,13 +451,15 @@ var shopScene = new Phaser.Class(
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);
}
})
}),
boughtSign: UIObject.createLabel(ScenesData.shopScene, game.config.width - 400, 400, 5, 'boughtItem', 1, 'center').setVisible(false)
}
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.boughtSign.setVisible(true);
this.sunbiItem.itemPrice.setText('보유중');
}
if(PlayerData.userData.skin == 1 || !PlayerData.userData.item.includes(1)) this.sunbiItem.useBtn.setVisible(false);
......
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