Fix shares information to enter into Webrtc room.
- Refactor share position in world class. - Update selects a client to send information about connecting WebRtc room.
This commit is contained in:
parent
16cf33755c
commit
41f5b5a1f6
2 changed files with 11 additions and 8 deletions
|
@ -1,6 +1,8 @@
|
|||
import {ExtRoomsInterface} from "./ExtRoomsInterface";
|
||||
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{
|
||||
userPositionMapByRoom: any;
|
||||
|
@ -9,7 +11,7 @@ export class ExtRooms implements ExtRoomsInterface{
|
|||
[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 socketsKey = Object.keys(Io.clients().sockets);
|
||||
|
||||
|
@ -35,6 +37,10 @@ let RefreshUserPositionFunction = function(rooms : ExtRooms, Io: socketIO.Server
|
|||
dataArray = [data];
|
||||
}
|
||||
mapPositionUserByRoom.set(data.roomId, dataArray);
|
||||
|
||||
// update position in the worl
|
||||
let messageUserPosition = new MessageUserPosition(data);
|
||||
World.updatePosition(messageUserPosition);
|
||||
}
|
||||
rooms.userPositionMapByRoom = Array.from(mapPositionUserByRoom);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue