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

메뉴 씬에 호패 표시 및 호패 누르면 호패 변경하는 메뉴 띄우기 wip

parent ab965a41
......@@ -39,15 +39,85 @@ var menuScene = new Phaser.Class(
this.userName = this.add.text(100, 100, '내 이름 : ' + PlayerData.userData.userName).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
this.money = this.add.text(100, 200, '소지 엽전 : ' + PlayerData.userData.money).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
this.currentHopae = this.add.text(100, 300, '현재 호패 : ' + PlayerData.userData.recentHopae).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
//this.currentHopae = this.add.text(100, 300, '현재 호패 : ' + PlayerData.userData.recentHopae).setOrigin(0, 0.5).setColor('#000000').setDepth(10).setPadding(5,5,5,5).setFontSize(40);
this.myHopae = [];
//PlayerData.userData.forEach(function(element){this.myHopae.push(element)});
for(let i = 0; i < PlayerData.userData.hopae.length; i++)
for(let i = 0; i < PlayerData.userData.hopae.length; i++) this.myHopae.push(PlayerData.userData.hopae[i]);
this.currentHopae = this.button.add(UIObject.createLabel(ScenesData.menuScene, 300, 300, 10,
'nameBgr' + PlayerData.userData.recentHopae.length, 1, PlayerData.userData.recentHopae, 25, '#ffffff', 0.45, 0.5).getElement('background'),
{
let textLength = PlayerData.userData.hopae[i].name.length;
this.myHopae.push(UIObject.createLabel(this, 300, 400 + 50 * i, 10, 'nameBgr' + textLength, 1, PlayerData.userData.hopae[i].name, 25, '#ffffff')
.getElement('text').setOrigin(0.45,0.5));
}
enabled: true, mode: 0
}).on('click', function(button, gameObject, pointer){
button.setEnable(false);
this.hopaeMenu = this.rexUI.add.menu({
x: 300,
y: 300,
items: ScenesData.menuScene.myHopae,
createButtonCallback: function (item, i) {
return ScenesData.menuScene.rexUI.add.label({
background: UIObject.createLabel(ScenesData.menuScene, 0, 0, 10, 'nameBgr' + item.name.length, 1, item.name, 25, '#ffffff', 0.45, 0.5),
text: ScenesData.menuScene.add.text(0, 0, item.name, {
fontSize: '25px'
}).setVisible(false),
space: {
left: 10,
right: 10,
top: 10,
bottom: 10,
icon: 10
}
})
},
easeIn: {
duration: 500,
orientation: 'y'
},
easeOut: {
duration: 100,
orientation: 'y'
},
});
this.hopaeMenu
.on('button.over', function (button) {
})
.on('button.out', function (button) {
})
.on('button.click', function (button) {
PlayerData.nickname = button.text;
ScenesData.menuScene.currentHopae.setEnable(true);
this.collapse();
});
}, this);
this.myCharacter = this.add.sprite(game.config.width / 2, game.config.height / 2 - 200, 'pyeongminStand').setOrigin(0.5, 0.5).setDepth(5).setScale(0.8);
PlayerData.nickname = (PlayerData.userData.recentHopae == '') ? PlayerData.userData.hopae[0].name : PlayerData.userData.recentHopae;
......@@ -223,7 +293,7 @@ var hopaeScene = new Phaser.Class(
else
{
this.checkDialog.setVisible(false);
this.shopBtn = this.button.add(
this.button.add(
this.rexUI.add.dialog({
x: game.config.width / 2,
y: game.config.height / 2,
......@@ -421,13 +491,7 @@ var gameScene = new Phaser.Class(
WordSpace.nameWordTextForTest = this.add.text(50,400,'현재 가진 호패들 : 없음').setDepth(10).setColor('#000000');
WordSpace.nameQueue.initiate();
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.generateWord.Name(ScenesData.gameScene, false, null);
WordSpace.attackGauge.add(11);
//WordSpace.attackGauge.add(11);
},
......
var UIObject = UIObject || {};
UIObject.createLabel = function (scene, x, y, depth, image, size, text = '', textSize = 24, textColor = '#000000') {
UIObject.createLabel = function (scene, x, y, depth, image, size, text = '', textSize = 24, textColor = '#000000', textOriginX = 0.5, textOriginY = 0.5) {
return scene.rexUI.add.label({
/*width: width,
height: height,*/
......@@ -11,7 +11,7 @@ UIObject.createLabel = function (scene, x, y, depth, image, size, text = '', tex
text: scene.add.text(x, y, text, {
fontSize: textSize + 'pt'
}).setDepth(depth).setOrigin(0.5, 0.5).setColor(textColor).setFontFamily('궁서'),
}).setDepth(depth).setOrigin(textOriginX, textOriginY).setColor(textColor).setFontFamily('궁서'),
space: {
left: 10,
......
This diff is collapsed.
......@@ -14,6 +14,7 @@
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"jshint": "^2.10.2",
"socket.io": "^2.2.0",
"web-audio-player": "^1.3.3"
}
......
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