Completely getting rid of "userid"
Previously, userid was generated by the "/login" route and passed along. This commit completely removes the uuid "userid" (and disables the LoginController too and any Jwt check). "userid" is replaced by the "socket id" of the connection. So a user is now identified using a socket id, which is unique for a given connection.
This commit is contained in:
parent
76b43245c5
commit
4de552437d
13 changed files with 130 additions and 84 deletions
|
@ -15,7 +15,7 @@ export enum Textures {
|
|||
|
||||
export interface GameSceneInterface extends Phaser.Scene {
|
||||
Map: Phaser.Tilemaps.Tilemap;
|
||||
createCurrentPlayer(UserId : string) : void;
|
||||
createCurrentPlayer() : void;
|
||||
shareUserPosition(UsersPosition : Array<MessageUserPositionInterface>): void;
|
||||
shareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface): void;
|
||||
updateOrCreateMapPlayer(UsersPosition : Array<MessageUserPositionInterface>): void;
|
||||
|
@ -266,11 +266,11 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface, Creat
|
|||
})
|
||||
}
|
||||
|
||||
createCurrentPlayer(UserId : string){
|
||||
createCurrentPlayer(){
|
||||
//initialise player
|
||||
//TODO create animation moving between exit and strat
|
||||
this.CurrentPlayer = new Player(
|
||||
UserId,
|
||||
null, // The current player is not has no id (because the id can change if connexion is lost and we should check that id using the GameManager.
|
||||
this,
|
||||
this.startX,
|
||||
this.startY,
|
||||
|
@ -347,9 +347,11 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface, Creat
|
|||
return;
|
||||
}
|
||||
|
||||
let currentPlayerId = this.GameManager.getPlayerId();
|
||||
|
||||
//add or create new user
|
||||
UsersPosition.forEach((userPosition : MessageUserPositionInterface) => {
|
||||
if(userPosition.userId === this.CurrentPlayer.userId){
|
||||
if(userPosition.userId === currentPlayerId){
|
||||
return;
|
||||
}
|
||||
let player = this.findPlayerInMap(userPosition.userId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue