Added back my passives, f to show g to hide
This commit is contained in:
parent
9327b4381c
commit
ab0aebc49f
9
client/src/scenes/cryp.list.js
Normal file → Executable file
9
client/src/scenes/cryp.list.js
Normal file → Executable file
@ -10,6 +10,7 @@ class CrypList extends Phaser.Scene {
|
|||||||
create() {
|
create() {
|
||||||
this.registry.events.on('changedata', this.updateData, this);
|
this.registry.events.on('changedata', this.updateData, this);
|
||||||
this.input.on('gameobjectup', this.clickHandler, this);
|
this.input.on('gameobjectup', this.clickHandler, this);
|
||||||
|
this.CrypPage = this.scene.get('CrypPage');
|
||||||
console.log('creating');
|
console.log('creating');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -29,8 +30,8 @@ class CrypList extends Phaser.Scene {
|
|||||||
|
|
||||||
renderCryps(cryps) {
|
renderCryps(cryps) {
|
||||||
if (!cryps) return true;
|
if (!cryps) return true;
|
||||||
console.log(JSON.stringify(this.children.list));
|
// console.log(JSON.stringify(this.children.list));
|
||||||
console.log(this.children.length);
|
// console.log(this.children.length);
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
|
||||||
cryps.forEach((cryp, i) => {
|
cryps.forEach((cryp, i) => {
|
||||||
@ -42,8 +43,8 @@ class CrypList extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clickHandler(pointer, crypBox) {
|
clickHandler(pointer, crypBox) {
|
||||||
console.log(crypBox);
|
this.CrypPage.redraw();
|
||||||
this.registry.set('activeCryp', Object.create(crypBox.cryp));
|
this.CrypPage.renderCryp(crypBox.cryp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
client/src/scenes/cryp.row.js
Normal file → Executable file
1
client/src/scenes/cryp.row.js
Normal file → Executable file
@ -12,7 +12,6 @@ const xPos = i => 0;
|
|||||||
const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN;
|
const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN;
|
||||||
|
|
||||||
function crypRow(list, cryp, i) {
|
function crypRow(list, cryp, i) {
|
||||||
console.log(i);
|
|
||||||
const X_ORIGIN = xPos(i);
|
const X_ORIGIN = xPos(i);
|
||||||
const Y_ORIGIN = yPos(i);
|
const Y_ORIGIN = yPos(i);
|
||||||
|
|
||||||
|
|||||||
5
client/src/scenes/cryps.js
Normal file → Executable file
5
client/src/scenes/cryps.js
Normal file → Executable file
@ -3,6 +3,7 @@ const Phaser = require('phaser');
|
|||||||
const CrypList = require('./cryp.list');
|
const CrypList = require('./cryp.list');
|
||||||
const CrypPage = require('./cryp.page');
|
const CrypPage = require('./cryp.page');
|
||||||
const Menu = require('./menu');
|
const Menu = require('./menu');
|
||||||
|
const Passives = require('./passives');
|
||||||
// const Passives = require('./passives');
|
// const Passives = require('./passives');
|
||||||
|
|
||||||
function renderCryps(store) {
|
function renderCryps(store) {
|
||||||
@ -24,6 +25,7 @@ function renderCryps(store) {
|
|||||||
Menu,
|
Menu,
|
||||||
CrypList,
|
CrypList,
|
||||||
CrypPage,
|
CrypPage,
|
||||||
|
Passives,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,7 +35,8 @@ function renderCryps(store) {
|
|||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
game.registry.set('cryps', state.cryps);
|
game.registry.set('cryps', state.cryps);
|
||||||
});
|
});
|
||||||
|
window.addEventListener('mouseup', () => game.registry.set('pan', false));
|
||||||
|
window.addEventListener('mousedown', () => game.registry.set('pan', true));
|
||||||
window.addEventListener('resize', () => game.resize(window.innerWidth, window.innerHeight), false);
|
window.addEventListener('resize', () => game.resize(window.innerWidth, window.innerHeight), false);
|
||||||
|
|
||||||
return game;
|
return game;
|
||||||
|
|||||||
4
client/src/scenes/menu.js
Normal file → Executable file
4
client/src/scenes/menu.js
Normal file → Executable file
@ -6,7 +6,11 @@ class Menu extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
|
this.scene.sleep('Passives');
|
||||||
this.add.text(0, 0, 'cryps.gg', { fontFamily: 'Arial', fontSize: 24, color: '#ffffff', fontStyle: 'bold' });
|
this.add.text(0, 0, 'cryps.gg', { fontFamily: 'Arial', fontSize: 24, color: '#ffffff', fontStyle: 'bold' });
|
||||||
|
this.input.keyboard.on('keydown_F', () => {
|
||||||
|
this.scene.wake('Passives');
|
||||||
|
}, 0, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const passiveDataEdge = require('./passive.data.edge');
|
|||||||
|
|
||||||
class PhaserPassives extends Phaser.Scene {
|
class PhaserPassives extends Phaser.Scene {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('passives');
|
super({ key: 'Passives', active: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
preload() {
|
preload() {
|
||||||
@ -73,7 +73,7 @@ class PhaserPassives extends Phaser.Scene {
|
|||||||
});
|
});
|
||||||
this.input.on('pointermove', (pointer) => {
|
this.input.on('pointermove', (pointer) => {
|
||||||
const zoomFactor = 2 / this.cameras.main.zoom;
|
const zoomFactor = 2 / this.cameras.main.zoom;
|
||||||
if (this.pan) {
|
if (this.registry.get('pan')) {
|
||||||
const points = pointer.getInterpolatedPosition(2);
|
const points = pointer.getInterpolatedPosition(2);
|
||||||
this.cameras.main.scrollX -= zoomFactor * (points[1].x - points[0].x);
|
this.cameras.main.scrollX -= zoomFactor * (points[1].x - points[0].x);
|
||||||
this.cameras.main.scrollY -= zoomFactor * (points[1].y - points[0].y);
|
this.cameras.main.scrollY -= zoomFactor * (points[1].y - points[0].y);
|
||||||
@ -82,8 +82,8 @@ class PhaserPassives extends Phaser.Scene {
|
|||||||
this.input.keyboard.on('keydown_A', () => {
|
this.input.keyboard.on('keydown_A', () => {
|
||||||
this.updatePassives(); // Will update nodes from state
|
this.updatePassives(); // Will update nodes from state
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
this.input.keyboard.on('keydown_S', () => {
|
this.input.keyboard.on('keydown_G', () => {
|
||||||
this.scene.switch('combat');
|
this.scene.sleep('Passives');
|
||||||
}, 0, this);
|
}, 0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,6 @@ class PhaserPassives extends Phaser.Scene {
|
|||||||
} else {
|
} else {
|
||||||
this.graphics.lineStyle(2, 0xffffff, 0.2);
|
this.graphics.lineStyle(2, 0xffffff, 0.2);
|
||||||
}
|
}
|
||||||
// console.log(drawEdge);
|
|
||||||
this.graphics.lineBetween(drawEdge[0].x, drawEdge[0].y, drawEdge[1].x, drawEdge[1].y);
|
this.graphics.lineBetween(drawEdge[0].x, drawEdge[0].y, drawEdge[1].x, drawEdge[1].y);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user