fixed some stuff and really basic mission selection
This commit is contained in:
parent
7eceeaf759
commit
e3dd8cfad7
@ -3,7 +3,6 @@ const Missions = require('./missions');
|
||||
|
||||
const {
|
||||
TEXT,
|
||||
// COLOURS,
|
||||
POSITIONS: { GAME_LIST },
|
||||
} = require('./constants');
|
||||
|
||||
@ -25,7 +24,7 @@ class MenuGameList extends Phaser.Scene {
|
||||
}
|
||||
|
||||
addGameList(gameList) {
|
||||
if (gameList.length === 0) return true;
|
||||
if (!gameList) return true;
|
||||
if (this.gameList) this.gameList.destroy(true);
|
||||
this.gameList = this.add.group();
|
||||
|
||||
@ -66,12 +65,12 @@ class MenuGameList extends Phaser.Scene {
|
||||
.setOrigin(0.5, 0.5));
|
||||
|
||||
const boss = this.add
|
||||
.rectangle(X, GAME_LIST.y(2), WIDTH, HEIGHT, 0x441122)
|
||||
.rectangle(X + WIDTH * 2, GAME_LIST.y(0), WIDTH, HEIGHT, 0x222222)
|
||||
.setInteractive()
|
||||
.setOrigin(0);
|
||||
|
||||
this.gameList.add(this.add
|
||||
.text(boss.getCenter().x, boss.getCenter().y, 'new Boss\ngame', TEXT.HEADER)
|
||||
.text(boss.getCenter().x, boss.getCenter().y, 'MISSIONS\n', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5));
|
||||
|
||||
|
||||
@ -127,8 +126,8 @@ class MenuGameList extends Phaser.Scene {
|
||||
if (team.length === 0) return false;
|
||||
this.scene.add('Missions', Missions);
|
||||
this.scene.run('Missions');
|
||||
this.scene.stop();
|
||||
return ws.sendGamePve(team, 'Boss');
|
||||
this.cleanUp();
|
||||
// return ws.sendGamePve(team, 'Boss');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ const MenuCrypList = require('./menu.cryps.list');
|
||||
const MenuGameList = require('./menu.game.list');
|
||||
|
||||
const Combat = require('./combat');
|
||||
// const ItemList = require('./item.list');
|
||||
const ItemList = require('./item.list');
|
||||
const StatSheet = require('./statsheet');
|
||||
|
||||
class Menu extends Phaser.Scene {
|
||||
@ -13,18 +13,15 @@ class Menu extends Phaser.Scene {
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
this.registry.events.on('changedata', this.updateData, this);
|
||||
this.registry.events.on('setdata', this.updateData, this);
|
||||
this.scene.add('MenuCrypList', MenuCrypList, true);
|
||||
this.scene.add('MenuGameList', MenuGameList, true);
|
||||
this.registry.events.on('setdata', this.setData, this);
|
||||
this.sys.events.on('wake', () => {
|
||||
this.wakeMenuScenes();
|
||||
this.addMenuScenes();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
wakeMenuScenes() {
|
||||
addMenuScenes() {
|
||||
this.registry.events.on('changedata', this.updateData, this);
|
||||
this.registry.events.on('setdata', this.updateData, this);
|
||||
this.scene.add('MenuCrypList', MenuCrypList, true);
|
||||
@ -33,15 +30,27 @@ class Menu extends Phaser.Scene {
|
||||
console.log(this.scene.isActive());
|
||||
}
|
||||
|
||||
setData(parent, key, data) {
|
||||
if (key === 'cryps') {
|
||||
this.scene.add('MenuCrypList', MenuCrypList, true);
|
||||
this.scene.add('MenuGameList', MenuGameList, true);
|
||||
}
|
||||
|
||||
if (key === 'game') {
|
||||
this.cleanUp();
|
||||
this.scene.manager.add('Combat', Combat, true, data);
|
||||
this.scene.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
updateData(parent, key, data) {
|
||||
if (key === 'itemList') {
|
||||
// return this.renderItemList();
|
||||
return this.renderItemList(data);
|
||||
}
|
||||
|
||||
if (key === 'game' && this.scene.isActive()) {
|
||||
this.cleanUp();
|
||||
this.scene.add('Combat', Combat);
|
||||
this.scene.run('Combat', data);
|
||||
this.scene.manager.add('Combat', Combat, true, data);
|
||||
this.scene.sleep();
|
||||
}
|
||||
|
||||
@ -60,16 +69,16 @@ class Menu extends Phaser.Scene {
|
||||
return true;
|
||||
}
|
||||
|
||||
renderItemList() {
|
||||
renderItemList(itemList) {
|
||||
const ws = this.registry.get('ws');
|
||||
const itemList = this.registry.get('itemList');
|
||||
|
||||
if (this.itemList) {
|
||||
this.itemList.cleanup();
|
||||
this.itemList.destroy(true);
|
||||
}
|
||||
|
||||
// this.itemList = new ItemList({ list: this, ws, itemList, events: this.game.events });
|
||||
console.log(itemList);
|
||||
|
||||
this.itemList = new ItemList({ list: this, ws, itemList, events: this.game.events });
|
||||
}
|
||||
|
||||
cleanUp() {
|
||||
@ -84,6 +93,11 @@ class Menu extends Phaser.Scene {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
update() {
|
||||
// console.log(this.registry.get('itemList'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Menu;
|
||||
|
||||
@ -74,7 +74,8 @@ class Missions extends Phaser.Scene {
|
||||
// Check cursor hasn't significantly moved during point allocation
|
||||
// If panning and mouse release is on node it won't allocate
|
||||
if (gameObjects[0] instanceof Node) {
|
||||
gameObjects[0].allocate();
|
||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||
this.registry.get('ws').sendGamePve(team, 'Boss');
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -111,7 +112,7 @@ class Missions extends Phaser.Scene {
|
||||
|
||||
displayNodeText(node, pointer) {
|
||||
if (this.nodeText) this.nodeText.destroy();
|
||||
this.nodeText = this.add.text(node.x, node.y, node.text, {
|
||||
this.nodeText = this.add.text(node.x, node.y, 'Going on a mission', {
|
||||
fontSize: '16px',
|
||||
fontFamily: 'Arial',
|
||||
color: '#ffffff',
|
||||
@ -140,6 +141,10 @@ class Missions extends Phaser.Scene {
|
||||
update(delta) {
|
||||
this.controls.update(delta);
|
||||
}
|
||||
|
||||
cleanUp() {
|
||||
this.scene.remove();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Missions;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user