commit
25b7fc5e36
@ -91,9 +91,6 @@ export class IoSocketController {
|
|||||||
return socket.emit(SockerIoEvent.MESSAGE_ERROR, JSON.stringify({message: messageUserPosition.message}));
|
return socket.emit(SockerIoEvent.MESSAGE_ERROR, JSON.stringify({message: messageUserPosition.message}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update position in the worl
|
|
||||||
this.World.updatePosition(messageUserPosition);
|
|
||||||
|
|
||||||
// sending to all clients in room except sender
|
// sending to all clients in room except sender
|
||||||
this.saveUserInformation((socket as ExSocketInterface), messageUserPosition);
|
this.saveUserInformation((socket as ExSocketInterface), messageUserPosition);
|
||||||
|
|
||||||
@ -172,6 +169,9 @@ export class IoSocketController {
|
|||||||
Client.broadcast.emit(SockerIoEvent.WEBRTC_DISCONNECT, JSON.stringify({
|
Client.broadcast.emit(SockerIoEvent.WEBRTC_DISCONNECT, JSON.stringify({
|
||||||
userId: Client.userId
|
userId: Client.userId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
//disconnect webrtc room
|
||||||
|
Client.leave(Client.webRtcRoomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,11 +186,11 @@ export class IoSocketController {
|
|||||||
socket.join(roomId);
|
socket.join(roomId);
|
||||||
socket.webRtcRoomId = roomId;
|
socket.webRtcRoomId = roomId;
|
||||||
//if two persone in room share
|
//if two persone in room share
|
||||||
if (this.Io.sockets.adapter.rooms[roomId].length < 2) {
|
if (this.Io.sockets.adapter.rooms[roomId].length < 2 || this.Io.sockets.adapter.rooms[roomId].length >= 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let clients: Array<any> = Object.values(this.Io.sockets.sockets);
|
let clients: Array<ExSocketInterface> = (Object.values(this.Io.sockets.sockets) as Array<ExSocketInterface>)
|
||||||
|
.filter((client: ExSocketInterface) => client.webRtcRoomId && client.webRtcRoomId === roomId);
|
||||||
//send start at one client to initialise offer webrtc
|
//send start at one client to initialise offer webrtc
|
||||||
//send all users in room to create PeerConnection in front
|
//send all users in room to create PeerConnection in front
|
||||||
clients.forEach((client: ExSocketInterface, index: number) => {
|
clients.forEach((client: ExSocketInterface, index: number) => {
|
||||||
@ -225,7 +225,7 @@ export class IoSocketController {
|
|||||||
if (!rooms.refreshUserPosition) {
|
if (!rooms.refreshUserPosition) {
|
||||||
rooms.refreshUserPosition = RefreshUserPositionFunction;
|
rooms.refreshUserPosition = RefreshUserPositionFunction;
|
||||||
}
|
}
|
||||||
rooms.refreshUserPosition(rooms, this.Io);
|
rooms.refreshUserPosition(rooms, this.Io, this.World);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hydrate and manage error
|
//Hydrate and manage error
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import {ExtRoomsInterface} from "./ExtRoomsInterface";
|
import {ExtRoomsInterface} from "./ExtRoomsInterface";
|
||||||
import socketIO = require('socket.io');
|
import socketIO = require('socket.io');
|
||||||
import {ExSocketInterface} from "_Model/Websocket/ExSocketInterface";
|
import {ExSocketInterface} from "./ExSocketInterface";
|
||||||
|
import {MessageUserPosition} from "./MessageUserPosition";
|
||||||
|
import {World} from "_Model/World";
|
||||||
|
|
||||||
export class ExtRooms implements ExtRoomsInterface{
|
export class ExtRooms implements ExtRoomsInterface{
|
||||||
userPositionMapByRoom: any;
|
userPositionMapByRoom: any;
|
||||||
@ -9,7 +11,7 @@ export class ExtRooms implements ExtRoomsInterface{
|
|||||||
[room: string]: SocketIO.Room;
|
[room: string]: SocketIO.Room;
|
||||||
}
|
}
|
||||||
|
|
||||||
let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server) {
|
let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server, World : World) {
|
||||||
let clients = Io.clients();
|
let clients = Io.clients();
|
||||||
let socketsKey = Object.keys(Io.clients().sockets);
|
let socketsKey = Object.keys(Io.clients().sockets);
|
||||||
|
|
||||||
@ -35,6 +37,10 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
|
|||||||
dataArray = [data];
|
dataArray = [data];
|
||||||
}
|
}
|
||||||
mapPositionUserByRoom.set(data.roomId, dataArray);
|
mapPositionUserByRoom.set(data.roomId, dataArray);
|
||||||
|
|
||||||
|
// update position in the worl
|
||||||
|
let messageUserPosition = new MessageUserPosition(data);
|
||||||
|
World.updatePosition(messageUserPosition);
|
||||||
}
|
}
|
||||||
rooms.userPositionMapByRoom = Array.from(mapPositionUserByRoom);
|
rooms.userPositionMapByRoom = Array.from(mapPositionUserByRoom);
|
||||||
}
|
}
|
||||||
|
1142
front/dist/maps/map.json
vendored
1142
front/dist/maps/map.json
vendored
File diff suppressed because it is too large
Load Diff
478
front/dist/maps/office_1.tsx
vendored
478
front/dist/maps/office_1.tsx
vendored
@ -1,254 +1,224 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<tileset version="1.2" tiledversion="1.3.3" name="office_1" tilewidth="32" tileheight="32" tilecount="256" columns="16">
|
<tileset version="1.2" tiledversion="1.3.3" name="office_1" tilewidth="32" tileheight="32" tilecount="256" columns="16">
|
||||||
<image source="tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
<image source="tilesets_deviant_milkian_1.png" width="512" height="512"/>
|
||||||
<tile id="7">
|
<tile id="7">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="12">
|
<tile id="14">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="13">
|
<tile id="15">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="14">
|
<tile id="23">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="15">
|
<tile id="28">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="23">
|
<tile id="29">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="28">
|
<tile id="30">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="29">
|
<tile id="31">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="30">
|
<tile id="39">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="31">
|
<tile id="48">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="39">
|
<tile id="49">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="44">
|
<tile id="50">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="45">
|
<tile id="51">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="48">
|
<tile id="52">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="49">
|
<tile id="64">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="50">
|
<tile id="65">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="51">
|
<tile id="66">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="52">
|
<tile id="67">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="56">
|
<tile id="68">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="57">
|
<tile id="72">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="64">
|
<tile id="73">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="65">
|
<tile id="84">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="66">
|
<tile id="152">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="67">
|
<tile id="153">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="68">
|
<tile id="154">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="72">
|
<tile id="155">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="73">
|
<tile id="156">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="84">
|
<tile id="157">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="152">
|
<tile id="161">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="153">
|
<tile id="162">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="154">
|
<tile id="168">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="155">
|
<tile id="169">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="156">
|
<tile id="170">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="157">
|
<tile id="171">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="161">
|
<tile id="172">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="162">
|
<tile id="173">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="168">
|
<tile id="177">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="169">
|
<tile id="178">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="170">
|
<tile id="184">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="171">
|
<tile id="185">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="172">
|
<tile id="186">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="173">
|
<tile id="196">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="177">
|
<tile id="198">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="178">
|
<tile id="214">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="collides" type="bool" value="true"/>
|
<property name="collides" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="184">
|
</tileset>
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
<tile id="185">
|
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
<tile id="186">
|
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
<tile id="196">
|
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
<tile id="198">
|
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
<tile id="214">
|
|
||||||
<properties>
|
|
||||||
<property name="collides" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</tile>
|
|
||||||
</tileset>
|
|
||||||
|
@ -89,7 +89,12 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
this.Layers = new Array<Phaser.Tilemaps.StaticTilemapLayer>();
|
this.Layers = new Array<Phaser.Tilemaps.StaticTilemapLayer>();
|
||||||
let depth = -2;
|
let depth = -2;
|
||||||
this.map.layers.forEach((layer) => {
|
this.map.layers.forEach((layer) => {
|
||||||
if (layer.type === 'tilelayer') {
|
if (layer.type === 'tilelayer' && layer.name === "override") {
|
||||||
|
let tab : Array<any> = (layer.properties as any);
|
||||||
|
let propertiesDepth = tab.find((props : any) => props.name === "depth");
|
||||||
|
this.addLayer( this.Map.createStaticLayer(layer.name, this.Terrains, 0, 0).setDepth(propertiesDepth ? propertiesDepth.value : 2) );
|
||||||
|
}
|
||||||
|
else if (layer.type === 'tilelayer') {
|
||||||
this.addLayer( this.Map.createStaticLayer(layer.name, this.Terrains, 0, 0).setDepth(depth) );
|
this.addLayer( this.Map.createStaticLayer(layer.name, this.Terrains, 0, 0).setDepth(depth) );
|
||||||
} else if (layer.type === 'objectgroup' && layer.name === 'floorLayer') {
|
} else if (layer.type === 'objectgroup' && layer.name === 'floorLayer') {
|
||||||
depth = -1;
|
depth = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user