Get playerlist on home page
This commit is contained in:
parent
dafbf145f8
commit
750a81c29f
@ -15,20 +15,19 @@ class HomeRankings extends Phaser.Scene {
|
|||||||
this.add.text(X, Y, 'Instances Scene', TEXT.HEADER);
|
this.add.text(X, Y, 'Instances Scene', TEXT.HEADER);
|
||||||
const playerList = this.registry.get('playerList');
|
const playerList = this.registry.get('playerList');
|
||||||
const addInstance = (player, i) => {
|
const addInstance = (player, i) => {
|
||||||
const joinNormal = this.add
|
const joinNormal = this.add
|
||||||
.rectangle(X, Y + HEIGHT * 0.15 * (i + 1), WIDTH * 0.5, HEIGHT * 0.1, 0x888888)
|
.rectangle(X, Y + HEIGHT * 0.15 * (i + 1), WIDTH * 0.5, HEIGHT * 0.1, 0x888888)
|
||||||
.setInteractive()
|
.setInteractive()
|
||||||
.setOrigin(0)
|
.setOrigin(0)
|
||||||
.on('pointerdown', () => {
|
.on('pointerdown', () => {
|
||||||
this.game.events.emit('SET_PLAYER', player);
|
this.game.events.emit('SET_PLAYER', player);
|
||||||
});
|
});
|
||||||
this.add
|
this.add
|
||||||
.text(joinNormal.getCenter().x, joinNormal.getCenter().y, `${player.instance}`, TEXT.NORMAL)
|
.text(joinNormal.getCenter().x, joinNormal.getCenter().y, `${player.instance}`, TEXT.NORMAL)
|
||||||
.setOrigin(0.5, 0.5);
|
.setOrigin(0.5, 0.5);
|
||||||
};
|
};
|
||||||
|
|
||||||
playerList.forEach(addInstance);
|
playerList.forEach(addInstance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanUp() {
|
cleanUp() {
|
||||||
|
|||||||
@ -26,6 +26,8 @@ class Home extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
|
this.registry.get('ws').sendAccountPlayers();
|
||||||
|
|
||||||
this.registry.events.on('changedata', this.updateData, this);
|
this.registry.events.on('changedata', this.updateData, this);
|
||||||
this.registry.events.on('setdata', this.updateData, this);
|
this.registry.events.on('setdata', this.updateData, this);
|
||||||
this.scene.manager.add('HomeCryps', HomeCryps, true);
|
this.scene.manager.add('HomeCryps', HomeCryps, true);
|
||||||
|
|||||||
@ -28,7 +28,6 @@ class MenuNavigation extends Phaser.Scene {
|
|||||||
.text(ready.getCenter().x, ready.getCenter().y, 'Ready', TEXT.HEADER)
|
.text(ready.getCenter().x, ready.getCenter().y, 'Ready', TEXT.HEADER)
|
||||||
.setOrigin(0.5, 0.5);
|
.setOrigin(0.5, 0.5);
|
||||||
ready.on('pointerdown', () => {
|
ready.on('pointerdown', () => {
|
||||||
console.log(player);
|
|
||||||
ws.sendInstanceReady(player.instance);
|
ws.sendInstanceReady(player.instance);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,6 @@ function createSocket(events) {
|
|||||||
account = login;
|
account = login;
|
||||||
events.setAccount(login);
|
events.setAccount(login);
|
||||||
sendAccountCryps();
|
sendAccountCryps();
|
||||||
sendAccountPlayers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function accountPlayerList(res) {
|
function accountPlayerList(res) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user