Propagating customized sprites all over the game
This commit is contained in:
@@ -177,7 +177,7 @@ export class IoSocketController {
|
||||
//add function to refresh position user in real time.
|
||||
//this.refreshUserPosition(Client);
|
||||
|
||||
const messageUserJoined = new MessageUserJoined(Client.userId, Client.name, Client.character, Client.position);
|
||||
const messageUserJoined = new MessageUserJoined(Client.userId, Client.name, Client.characterLayers, Client.position);
|
||||
|
||||
socket.to(roomId).emit(SockerIoEvent.JOIN_ROOM, messageUserJoined);
|
||||
|
||||
@@ -188,7 +188,7 @@ export class IoSocketController {
|
||||
console.warn('Something went wrong. The World contains a user "'+user.id+"' but this user does not exist in the sockets list!");
|
||||
return null;
|
||||
}
|
||||
return new MessageUserPosition(user.id, player.name, player.character, player.position);
|
||||
return new MessageUserPosition(user.id, player.name, player.characterLayers, player.position);
|
||||
}).filter((item: MessageUserPosition|null) => item !== null);
|
||||
answerFn(listOfUsers);
|
||||
} catch (e) {
|
||||
@@ -278,7 +278,7 @@ export class IoSocketController {
|
||||
}
|
||||
const Client = (socket as ExSocketInterface);
|
||||
Client.name = playerDetails.name;
|
||||
Client.character = playerDetails.character;
|
||||
Client.characterLayers = playerDetails.characterLayers;
|
||||
answerFn(Client.userId);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,6 +9,6 @@ export interface ExSocketInterface extends Socket, Identificable {
|
||||
webRtcRoomId: string;
|
||||
userId: string;
|
||||
name: string;
|
||||
character: string;
|
||||
characterLayers: string[];
|
||||
position: PointInterface;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {PointInterface} from "_Model/Websocket/PointInterface";
|
||||
|
||||
export class MessageUserJoined {
|
||||
constructor(public userId: string, public name: string, public character: string, public position: PointInterface) {
|
||||
constructor(public userId: string, public name: string, public characterLayers: string[], public position: PointInterface) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ export class Point implements PointInterface{
|
||||
}
|
||||
|
||||
export class MessageUserPosition {
|
||||
constructor(public userId: string, public name: string, public character: string, public position: PointInterface) {
|
||||
constructor(public userId: string, public name: string, public characterLayers: string[], public position: PointInterface) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ import * as tg from "generic-type-guard";
|
||||
export const isSetPlayerDetailsMessage =
|
||||
new tg.IsInterface().withProperties({
|
||||
name: tg.isString,
|
||||
character: tg.isString
|
||||
characterLayers: tg.isArray(tg.isString)
|
||||
}).get();
|
||||
export type SetPlayerDetailsMessage = tg.GuardedType<typeof isSetPlayerDetailsMessage>;
|
||||
|
||||
Reference in New Issue
Block a user