Merge remote-tracking branch 'github.com/master' into webrtc
# Conflicts: # front/src/Connexion.ts # front/src/Phaser/Game/GameManager.ts # front/src/Phaser/Game/GameScene.ts # front/src/index.ts
This commit is contained in:
commit
91851c95f3
5 changed files with 34 additions and 65 deletions
|
@ -1,8 +1,8 @@
|
|||
import {GameManagerInterface} from "./Phaser/Game/GameManager";
|
||||
import {GameManager} from "./Phaser/Game/GameManager";
|
||||
|
||||
const SocketIo = require('socket.io-client');
|
||||
import Axios from "axios";
|
||||
import {API_URL} from "./Enum/EnvironmentVariable";
|
||||
import {API_URL, ROOM} from "./Enum/EnvironmentVariable";
|
||||
|
||||
enum EventMessage{
|
||||
WEBRTC_SIGNAL = "webrtc-signal",
|
||||
|
@ -121,7 +121,7 @@ export interface ConnexionInterface {
|
|||
|
||||
joinARoom(roomId: string): void;
|
||||
|
||||
sharePosition(roomId: string, x: number, y: number, direction: string): void;
|
||||
sharePosition(x: number, y: number, direction: string): void;
|
||||
|
||||
positionOfAllUser(): void;
|
||||
|
||||
|
@ -140,9 +140,9 @@ export class Connexion implements ConnexionInterface {
|
|||
userId: string;
|
||||
startedRoom: string;
|
||||
|
||||
GameManager: GameManagerInterface;
|
||||
GameManager: GameManager;
|
||||
|
||||
constructor(email: string, GameManager: GameManagerInterface) {
|
||||
constructor(email : string, GameManager: GameManager) {
|
||||
this.email = email;
|
||||
this.GameManager = GameManager;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ export class Connexion implements ConnexionInterface {
|
|||
this.joinARoom(this.startedRoom);
|
||||
|
||||
//share your first position
|
||||
this.sharePosition(this.startedRoom, 0, 0);
|
||||
this.sharePosition(0, 0);
|
||||
|
||||
this.positionOfAllUser();
|
||||
|
||||
|
@ -189,16 +189,15 @@ export class Connexion implements ConnexionInterface {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param roomId
|
||||
* @param x
|
||||
* @param y
|
||||
* @param direction
|
||||
*/
|
||||
sharePosition(roomId: string, x: number, y: number, direction: string = "none"): void {
|
||||
if (!this.socket) {
|
||||
sharePosition(x : number, y : number, direction : string = "none") : void{
|
||||
if(!this.socket){
|
||||
return;
|
||||
}
|
||||
let messageUserPosition = new MessageUserPosition(this.userId, roomId, new Point(x, y, direction));
|
||||
let messageUserPosition = new MessageUserPosition(this.userId, ROOM[0], new Point(x, y, direction));
|
||||
this.socket.emit(EventMessage.USER_POSITION, messageUserPosition.toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue