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 nameX = COMBAT.width() * team;
|
||||||
const nameY = COMBAT.y() + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
|
const nameY = COMBAT.y() + CRYP_MARGIN * iter + COMBAT.height() * 0.07;
|
||||||
const statusX = COMBAT.width() * team;
|
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 };
|
return { statusX, statusY, nameX, nameY };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,7 @@ class MenuNavigation extends Phaser.Scene {
|
|||||||
pveText.destroy();
|
pveText.destroy();
|
||||||
pvp.destroy();
|
pvp.destroy();
|
||||||
pvpText.destroy();
|
pvpText.destroy();
|
||||||
|
ws.sendAccountZone();
|
||||||
});
|
});
|
||||||
|
|
||||||
pvp.on('pointerdown', () => {
|
pvp.on('pointerdown', () => {
|
||||||
@ -66,6 +67,7 @@ class MenuNavigation extends Phaser.Scene {
|
|||||||
pveText.destroy();
|
pveText.destroy();
|
||||||
pvp.destroy();
|
pvp.destroy();
|
||||||
pvpText.destroy();
|
pvpText.destroy();
|
||||||
|
ws.sendGameJoinableList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const cancel = this.add
|
const cancel = this.add
|
||||||
@ -81,58 +83,30 @@ class MenuNavigation extends Phaser.Scene {
|
|||||||
|
|
||||||
addPvpModes(ws) {
|
addPvpModes(ws) {
|
||||||
const hostPvp = this.add
|
const hostPvp = this.add
|
||||||
.rectangle(0, 0, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
.rectangle(BTN_WIDTH, 0, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
||||||
.setInteractive()
|
.setInteractive()
|
||||||
.setOrigin(0)
|
.setOrigin(0)
|
||||||
.on('pointerdown', () => {
|
.on('pointerdown', () => {
|
||||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||||
ws.sendGamePvp(team);
|
ws.sendGamePvp(team);
|
||||||
return this.scene.restart();
|
|
||||||
});
|
});
|
||||||
this.add
|
this.add
|
||||||
.text(hostPvp.getCenter().x, hostPvp.getCenter().y, 'Host PVP game', TEXT.HEADER)
|
.text(hostPvp.getCenter().x, hostPvp.getCenter().y, 'Host PVP game', TEXT.HEADER)
|
||||||
.setOrigin(0.5, 0.5);
|
.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) {
|
addPveModes(ws) {
|
||||||
const quickPve = this.add
|
const quickPve = this.add
|
||||||
.rectangle(0, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x004400)
|
.rectangle(BTN_WIDTH, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x222222)
|
||||||
.setInteractive()
|
.setInteractive()
|
||||||
.setOrigin(0)
|
.setOrigin(0)
|
||||||
.on('pointerdown', () => {
|
.on('pointerdown', () => {
|
||||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||||
ws.sendGamePve(team);
|
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
|
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);
|
.setOrigin(0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Zones extends Phaser.Scene {
|
|||||||
|
|
||||||
create(zone) {
|
create(zone) {
|
||||||
if (!zone) return false;
|
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.graphics = this.add.graphics();
|
||||||
this.cameras.main.setViewport(X, Y, WIDTH, HEIGHT);
|
this.cameras.main.setViewport(X, Y, WIDTH, HEIGHT);
|
||||||
this.addNodes(zone.graph.nodes);
|
this.addNodes(zone.graph.nodes);
|
||||||
@ -37,7 +37,7 @@ class Zones extends Phaser.Scene {
|
|||||||
this.nodes = [];
|
this.nodes = [];
|
||||||
nodeData.forEach((n, i) => {
|
nodeData.forEach((n, i) => {
|
||||||
this.nodes[i] = this.add.existing(
|
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();
|
).setInteractive();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -73,7 +73,6 @@ class Zones extends Phaser.Scene {
|
|||||||
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
const team = this.registry.get('cryps').filter(c => c.active).map(c => c.id);
|
||||||
if (gameObjects[0].success) return false;
|
if (gameObjects[0].success) return false;
|
||||||
this.registry.get('ws').sendZoneJoin(zoneId, gameObjects[0].id, team);
|
this.registry.get('ws').sendZoneJoin(zoneId, gameObjects[0].id, team);
|
||||||
this.cleanUp();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user