Simplified navigation, load zone on pve and game list on pvp
This commit is contained in:
parent
a44b9bc929
commit
f887a6e4ca
@ -11,7 +11,7 @@ const crypAvatarText = (team, iter) => {
|
||||
const nameX = COMBAT.width() * team;
|
||||
const nameY = COMBAT.y() + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
|
||||
const statusX = COMBAT.width() * team;
|
||||
const statusY = COMBAT.y() + TEXT_MARGIN * 3 + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
|
||||
const statusY = COMBAT.y() + TEXT_MARGIN * 6 + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
|
||||
return { statusX, statusY, nameX, nameY };
|
||||
};
|
||||
|
||||
|
||||
@ -58,6 +58,7 @@ class MenuNavigation extends Phaser.Scene {
|
||||
pveText.destroy();
|
||||
pvp.destroy();
|
||||
pvpText.destroy();
|
||||
ws.sendAccountZone();
|
||||
});
|
||||
|
||||
pvp.on('pointerdown', () => {
|
||||
@ -66,6 +67,7 @@ class MenuNavigation extends Phaser.Scene {
|
||||
pveText.destroy();
|
||||
pvp.destroy();
|
||||
pvpText.destroy();
|
||||
ws.sendGameJoinableList();
|
||||
});
|
||||
|
||||
const cancel = this.add
|
||||
@ -81,58 +83,30 @@ class MenuNavigation extends Phaser.Scene {
|
||||
|
||||
addPvpModes(ws) {
|
||||
const hostPvp = this.add
|
||||
.rectangle(0, 0, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
||||
.rectangle(BTN_WIDTH, 0, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => {
|
||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||
ws.sendGamePvp(team);
|
||||
return this.scene.restart();
|
||||
});
|
||||
this.add
|
||||
.text(hostPvp.getCenter().x, hostPvp.getCenter().y, 'Host PVP game', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
|
||||
const refresh = this.add
|
||||
.rectangle(BTN_WIDTH, 0, BTN_WIDTH, BTN_HEIGHT, 0x000044)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => {
|
||||
ws.sendGameJoinableList();
|
||||
return this.scene.restart();
|
||||
});
|
||||
|
||||
this.add
|
||||
.text(refresh.getCenter().x, refresh.getCenter().y, 'PVP games list', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
}
|
||||
|
||||
addPveModes(ws) {
|
||||
const quickPve = this.add
|
||||
.rectangle(0, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x004400)
|
||||
.rectangle(BTN_WIDTH, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x222222)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => {
|
||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||
ws.sendGamePve(team);
|
||||
return this.scene.restart();
|
||||
});
|
||||
this.add
|
||||
.text(quickPve.getCenter().x, quickPve.getCenter().y, 'Quick battle', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
|
||||
const zones = this.add
|
||||
.rectangle(BTN_WIDTH, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x222222)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => {
|
||||
if (this.scene.get('Zones')) return false;
|
||||
ws.sendAccountZone();
|
||||
return this.scene.restart();
|
||||
});
|
||||
|
||||
this.add
|
||||
.text(zones.getCenter().x, zones.getCenter().y, 'Zone Mode', TEXT.HEADER)
|
||||
.text(quickPve.getCenter().x, quickPve.getCenter().y, 'Quick Game', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class Zones extends Phaser.Scene {
|
||||
|
||||
create(zone) {
|
||||
if (!zone) return false;
|
||||
this.scene.manager.add('ZoneControls', ZoneControls, true, zone.id);
|
||||
if (!this.scene.get('ZoneControls')) this.scene.manager.add('ZoneControls', ZoneControls, true, zone.id);
|
||||
this.graphics = this.add.graphics();
|
||||
this.cameras.main.setViewport(X, Y, WIDTH, HEIGHT);
|
||||
this.addNodes(zone.graph.nodes);
|
||||
@ -37,7 +37,7 @@ class Zones extends Phaser.Scene {
|
||||
this.nodes = [];
|
||||
nodeData.forEach((n, i) => {
|
||||
this.nodes[i] = this.add.existing(
|
||||
new Node(this, n.x * 50, n.y * 50, i, n.success, n.tag)
|
||||
new Node(this, n.x * 50 + 200, n.y * 50 + 200, i, n.success, n.tag)
|
||||
).setInteractive();
|
||||
});
|
||||
}
|
||||
@ -73,7 +73,6 @@ class Zones extends Phaser.Scene {
|
||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||
if (gameObjects[0].success) return false;
|
||||
this.registry.get('ws').sendZoneJoin(zoneId, gameObjects[0].id, team);
|
||||
this.cleanUp();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user