testing scene swaps
This commit is contained in:
parent
0dd96ae961
commit
4c184106fd
@ -43,7 +43,8 @@ function registerEvents(registry, events) {
|
||||
const activeSkill = registry.get('activeSkill');
|
||||
const game = registry.get('game');
|
||||
if (activeSkill) {
|
||||
if (activeSkill.cryp.account !== cryp.account) {
|
||||
const target = activeSkill.cryp.account === cryp.account;
|
||||
if (!target) {
|
||||
const ws = registry.get('ws');
|
||||
if (game.phase === 'Skill') {
|
||||
ws.sendGameSkill(game.id, activeSkill.cryp.id, cryp.account, activeSkill.skill.skill);
|
||||
|
||||
@ -16,7 +16,7 @@ class Combat extends Phaser.Scene {
|
||||
|
||||
preload() {
|
||||
// Textures already loaded can do proper check in future when theres more textures
|
||||
if (!(this.textures.getTextureKeys().length > 0)) {
|
||||
if (!(this.textures.getTextureKeys().length > 2)) {
|
||||
this.textures.addBase64('alk', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/alakazam-f.png')).toString('base64')}`);
|
||||
this.textures.addBase64('magmar', `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/magmar.png')).toString('base64')}`);
|
||||
this.load.image('proj', 'http://labs.phaser.io/assets/sprites/bullet.png');
|
||||
@ -43,6 +43,7 @@ class Combat extends Phaser.Scene {
|
||||
}
|
||||
});
|
||||
|
||||
this.combatCryps = null;
|
||||
this.registry.set('gameAnimating', false);
|
||||
this.account = this.registry.get('account');
|
||||
this.log = this.add.text(COMBAT.LOG.x(), COMBAT.LOG.y(), '', TEXT.NORMAL);
|
||||
@ -56,7 +57,6 @@ class Combat extends Phaser.Scene {
|
||||
}
|
||||
return false;
|
||||
}, 1000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +76,7 @@ function animatePhase(scene, group, game, resolution, cb) {
|
||||
|
||||
// all done
|
||||
scene.time.delayedCall(MOVE_CREEP, () => {
|
||||
animations.cleanup();
|
||||
animations.destroy();
|
||||
animations.destroy(true);
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
const Phaser = require('phaser');
|
||||
|
||||
const CrypRows = require('./cryp.row');
|
||||
const CrypPage = require('./cryp.page');
|
||||
const GameList = require('./game.list');
|
||||
const Player = require('./player');
|
||||
|
||||
class CrypList extends Phaser.Scene {
|
||||
constructor() {
|
||||
@ -38,12 +38,6 @@ class CrypList extends Phaser.Scene {
|
||||
this.CrypRows.destroy(true);
|
||||
}
|
||||
this.CrypRows = new CrypRows(this, cryps);
|
||||
|
||||
// selected cryp
|
||||
if (this.CrypPage) {
|
||||
const cryp = cryps.find(c => c.id === this.CrypPage.id);
|
||||
this.displaySkills(cryp);
|
||||
}
|
||||
}
|
||||
|
||||
renderGameList() {
|
||||
@ -61,10 +55,9 @@ class CrypList extends Phaser.Scene {
|
||||
|
||||
displaySkills(cryp) {
|
||||
if (cryp) {
|
||||
if (this.CrypPage) {
|
||||
this.CrypPage.destroy(true);
|
||||
}
|
||||
this.CrypPage = new CrypPage(this, cryp);
|
||||
this.scene.add('Player', Player);
|
||||
this.scene.run('Player', { x: 400, y: 300 });
|
||||
this.scene.sleep();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ const Phaser = require('phaser');
|
||||
const CrypList = require('./cryp.list');
|
||||
const Menu = require('./menu');
|
||||
const Combat = require('./combat');
|
||||
// const Passives = require('./passives');
|
||||
|
||||
function renderCryps() {
|
||||
const config = {
|
||||
|
||||
@ -9,7 +9,7 @@ class Menu extends Phaser.Scene {
|
||||
|
||||
create() {
|
||||
this.add.text(0, 0, 'cryps.gg', TEXT.HEADER);
|
||||
this.scene.sleep('Passives');
|
||||
// this.scene.sleep('Passives');
|
||||
this.input.keyboard.on('keydown_F', () => {
|
||||
this.scene.wake('Passives');
|
||||
}, 0, this);
|
||||
|
||||
@ -3,13 +3,16 @@ const PassiveNode = require('./passive.node');
|
||||
const passiveDataNode = require('./passive.data.node');
|
||||
const passiveDataEdge = require('./passive.data.edge');
|
||||
|
||||
const { POSITIONS: { COMBAT } } = require('./constants');
|
||||
|
||||
// Passive tree generator - proof of concept visuals need work
|
||||
// Mouse click hold to move, Q + E to zoom in and out
|
||||
// Press 'A' to reset allocated passive nodes
|
||||
|
||||
class PhaserPassives extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'Passives', active: true });
|
||||
super({ key: 'Passives' });
|
||||
// this.input = props.input;
|
||||
}
|
||||
|
||||
preload() {
|
||||
@ -20,6 +23,10 @@ class PhaserPassives extends Phaser.Scene {
|
||||
this.graphics = this.add.graphics();
|
||||
this.passiveNodeData = passiveDataNode;
|
||||
this.passiveEdgeData = passiveDataEdge;
|
||||
this.cameras.main.setViewport(COMBAT.width() * 0.5, COMBAT.height() * 0.3,
|
||||
COMBAT.width() * 0.5, COMBAT.height() * 0.7);
|
||||
this.cameras.main.scrollX = 500;
|
||||
this.cameras.main.scrollY = 500;
|
||||
this.addPassiveNodes();
|
||||
this.addCameraControl();
|
||||
this.addEvents();
|
||||
|
||||
20
client/src/scenes/player.js
Normal file
20
client/src/scenes/player.js
Normal file
@ -0,0 +1,20 @@
|
||||
const Phaser = require('phaser');
|
||||
const Passives = require('./passives');
|
||||
|
||||
class Player extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'Player' });
|
||||
}
|
||||
|
||||
create(data) {
|
||||
console.log(data);
|
||||
this.scene.add('Passives', Passives, true);
|
||||
this.input.keyboard.on('keydown_ONE', () => {
|
||||
this.scene.run('CrypList');
|
||||
this.scene.remove('Passives');
|
||||
this.scene.remove();
|
||||
}, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Player;
|
||||
Loading…
x
Reference in New Issue
Block a user