Adding a playersStore
The playerStore can be useful to get the details of a given player from its ID.
This commit is contained in:
parent
194d6a6414
commit
46e6917df6
8 changed files with 62 additions and 24 deletions
|
@ -1,11 +1,6 @@
|
|||
import type {PointInterface} from "../../Connexion/ConnexionModels";
|
||||
import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures";
|
||||
import type {PlayerInterface} from "./PlayerInterface";
|
||||
|
||||
export interface AddPlayerInterface {
|
||||
userId: number;
|
||||
name: string;
|
||||
characterLayers: BodyResourceDescriptionInterface[];
|
||||
export interface AddPlayerInterface extends PlayerInterface {
|
||||
position: PointInterface;
|
||||
visitCardUrl: string|null;
|
||||
companion: string|null;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ import { soundManager } from "./SoundManager";
|
|||
import { peerStore, screenSharingPeerStore } from "../../Stores/PeerStore";
|
||||
import { videoFocusStore } from "../../Stores/VideoFocusStore";
|
||||
import { biggestAvailableAreaStore } from "../../Stores/BiggestAvailableAreaStore";
|
||||
import {playersStore} from "../../Stores/PlayersStore";
|
||||
|
||||
export interface GameSceneInitInterface {
|
||||
initPosition: PointInterface | null;
|
||||
|
@ -597,6 +598,8 @@ export class GameScene extends DirtyScene {
|
|||
.then((onConnect: OnConnectInterface) => {
|
||||
this.connection = onConnect.connection;
|
||||
|
||||
playersStore.connectToRoomConnection(this.connection);
|
||||
|
||||
this.connection.onUserJoins((message: MessageUserJoined) => {
|
||||
const userMessage: AddPlayerInterface = {
|
||||
userId: message.userId,
|
||||
|
|
9
front/src/Phaser/Game/PlayerInterface.ts
Normal file
9
front/src/Phaser/Game/PlayerInterface.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures";
|
||||
|
||||
export interface PlayerInterface {
|
||||
userId: number;
|
||||
name: string;
|
||||
characterLayers: BodyResourceDescriptionInterface[];
|
||||
visitCardUrl: string|null;
|
||||
companion: string|null;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue