Removing dead code
This commit is contained in:
parent
4ec92ddf58
commit
227575043b
6 changed files with 3 additions and 114 deletions
|
@ -34,10 +34,8 @@ import {SimplePeer} from "../../WebRtc/SimplePeer";
|
||||||
import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
|
import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
|
||||||
import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
||||||
import {
|
import {
|
||||||
CenterListener,
|
|
||||||
JITSI_MESSAGE_PROPERTIES,
|
JITSI_MESSAGE_PROPERTIES,
|
||||||
layoutManager,
|
layoutManager,
|
||||||
LayoutMode,
|
|
||||||
ON_ACTION_TRIGGER_BUTTON,
|
ON_ACTION_TRIGGER_BUTTON,
|
||||||
TRIGGER_JITSI_PROPERTIES,
|
TRIGGER_JITSI_PROPERTIES,
|
||||||
TRIGGER_WEBSITE_PROPERTIES,
|
TRIGGER_WEBSITE_PROPERTIES,
|
||||||
|
@ -135,7 +133,7 @@ interface DeleteGroupEventInterface {
|
||||||
|
|
||||||
const defaultStartLayerName = 'start';
|
const defaultStartLayerName = 'start';
|
||||||
|
|
||||||
export class GameScene extends DirtyScene /*implements CenterListener*/ {
|
export class GameScene extends DirtyScene {
|
||||||
Terrains : Array<Phaser.Tilemaps.Tileset>;
|
Terrains : Array<Phaser.Tilemaps.Tileset>;
|
||||||
CurrentPlayer!: Player;
|
CurrentPlayer!: Player;
|
||||||
MapPlayers!: Phaser.Physics.Arcade.Group;
|
MapPlayers!: Phaser.Physics.Arcade.Group;
|
||||||
|
@ -1117,7 +1115,6 @@ ${escapedMessage}
|
||||||
initCamera() {
|
initCamera() {
|
||||||
this.cameras.main.setBounds(0,0, this.Map.widthInPixels, this.Map.heightInPixels);
|
this.cameras.main.setBounds(0,0, this.Map.widthInPixels, this.Map.heightInPixels);
|
||||||
this.cameras.main.startFollow(this.CurrentPlayer, true);
|
this.cameras.main.startFollow(this.CurrentPlayer, true);
|
||||||
//this.updateCameraOffset();
|
|
||||||
biggestAvailableArrayStore.recompute();
|
biggestAvailableArrayStore.recompute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1498,7 +1495,6 @@ ${escapedMessage}
|
||||||
this.openChatIcon.setY(this.game.renderer.height - 2);
|
this.openChatIcon.setY(this.game.renderer.height - 2);
|
||||||
|
|
||||||
// Recompute camera offset if needed
|
// Recompute camera offset if needed
|
||||||
//this.updateCameraOffset();
|
|
||||||
biggestAvailableArrayStore.recompute();
|
biggestAvailableArrayStore.recompute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1516,10 +1512,6 @@ ${escapedMessage}
|
||||||
this.cameras.main.setFollowOffset((xCenter - game.offsetWidth/2) * window.devicePixelRatio / this.scale.zoom , (yCenter - game.offsetHeight/2) * window.devicePixelRatio / this.scale.zoom);
|
this.cameras.main.setFollowOffset((xCenter - game.offsetWidth/2) * window.devicePixelRatio / this.scale.zoom , (yCenter - game.offsetHeight/2) * window.devicePixelRatio / this.scale.zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public onCenterChange(): void {
|
|
||||||
this.updateCameraOffset();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public startJitsi(roomName: string, jwt?: string): void {
|
public startJitsi(roomName: string, jwt?: string): void {
|
||||||
const allProps = this.gameMap.getCurrentProperties();
|
const allProps = this.gameMap.getCurrentProperties();
|
||||||
const jitsiConfig = this.safeParseJSONstring(allProps.get("jitsiConfig") as string|undefined, 'jitsiConfig');
|
const jitsiConfig = this.safeParseJSONstring(allProps.get("jitsiConfig") as string|undefined, 'jitsiConfig');
|
||||||
|
@ -1579,7 +1571,6 @@ ${escapedMessage}
|
||||||
|
|
||||||
zoomByFactor(zoomFactor: number) {
|
zoomByFactor(zoomFactor: number) {
|
||||||
waScaleManager.zoomModifier *= zoomFactor;
|
waScaleManager.zoomModifier *= zoomFactor;
|
||||||
//this.updateCameraOffset();
|
|
||||||
biggestAvailableArrayStore.recompute();
|
biggestAvailableArrayStore.recompute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,6 @@ export enum DivImportance {
|
||||||
Normal = "Normal",
|
Normal = "Normal",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Classes implementing this interface can be notified when the center of the screen (the player position) should be
|
|
||||||
* changed.
|
|
||||||
*/
|
|
||||||
export interface CenterListener {
|
|
||||||
onCenterChange(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ON_ACTION_TRIGGER_BUTTON = 'onaction';
|
export const ON_ACTION_TRIGGER_BUTTON = 'onaction';
|
||||||
|
|
||||||
export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger';
|
export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger';
|
||||||
|
|
|
@ -31,21 +31,8 @@ export class MediaManager {
|
||||||
|
|
||||||
private userInputManager?: UserInputManager;
|
private userInputManager?: UserInputManager;
|
||||||
|
|
||||||
//FIX ME SOUNDMETER: check stalability of sound meter calculation
|
|
||||||
/*private mySoundMeter?: SoundMeter|null;
|
|
||||||
private soundMeters: Map<string, SoundMeter> = new Map<string, SoundMeter>();
|
|
||||||
private soundMeterElements: Map<string, HTMLDivElement> = new Map<string, HTMLDivElement>();*/
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
this.pingCameraStatus();
|
|
||||||
|
|
||||||
//FIX ME SOUNDMETER: check stability of sound meter calculation
|
|
||||||
/*this.mySoundMeterElement = (HtmlUtils.getElementByIdOrFail('mySoundMeter'));
|
|
||||||
this.mySoundMeterElement.childNodes.forEach((value: ChildNode, index) => {
|
|
||||||
this.mySoundMeterElement.children.item(index)?.classList.remove('active');
|
|
||||||
});*/
|
|
||||||
|
|
||||||
//Check of ask notification navigator permission
|
//Check of ask notification navigator permission
|
||||||
this.getNotification();
|
this.getNotification();
|
||||||
|
|
||||||
|
@ -59,7 +46,6 @@ export class MediaManager {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//let isScreenSharing = false;
|
|
||||||
screenSharingLocalStreamStore.subscribe((result) => {
|
screenSharingLocalStreamStore.subscribe((result) => {
|
||||||
if (result.type === 'error') {
|
if (result.type === 'error') {
|
||||||
console.error(result.error);
|
console.error(result.error);
|
||||||
|
@ -150,22 +136,6 @@ export class MediaManager {
|
||||||
show ? blockLogoElement.classList.add('active') : blockLogoElement.classList.remove('active');
|
show ? blockLogoElement.classList.add('active') : blockLogoElement.classList.remove('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
isConnecting(userId: string): void {
|
|
||||||
const connectingSpinnerDiv = this.getSpinner(userId);
|
|
||||||
if (connectingSpinnerDiv === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
connectingSpinnerDiv.style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
isConnected(userId: string): void {
|
|
||||||
const connectingSpinnerDiv = this.getSpinner(userId);
|
|
||||||
if (connectingSpinnerDiv === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
connectingSpinnerDiv.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
isError(userId: string): void {
|
isError(userId: string): void {
|
||||||
console.info("isError", `div-${userId}`);
|
console.info("isError", `div-${userId}`);
|
||||||
const element = document.getElementById(`div-${userId}`);
|
const element = document.getElementById(`div-${userId}`);
|
||||||
|
@ -188,23 +158,8 @@ export class MediaManager {
|
||||||
if(!element){
|
if(!element){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const connnectingSpinnerDiv = element.getElementsByClassName('connecting-spinner').item(0) as HTMLDivElement|null;
|
const connectingSpinnerDiv = element.getElementsByClassName('connecting-spinner').item(0) as HTMLDivElement|null;
|
||||||
return connnectingSpinnerDiv;
|
return connectingSpinnerDiv;
|
||||||
}
|
|
||||||
|
|
||||||
private getColorByString(str: String) : String|null {
|
|
||||||
let hash = 0;
|
|
||||||
if (str.length === 0) return null;
|
|
||||||
for (let i = 0; i < str.length; i++) {
|
|
||||||
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
||||||
hash = hash & hash;
|
|
||||||
}
|
|
||||||
let color = '#';
|
|
||||||
for (let i = 0; i < 3; i++) {
|
|
||||||
const value = (hash >> (i * 8)) & 255;
|
|
||||||
color += ('00' + value.toString(16)).substr(-2);
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
||||||
|
@ -220,16 +175,6 @@ export class MediaManager {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* For some reasons, the microphone muted icon or the stream is not always up to date.
|
|
||||||
* Here, every 30 seconds, we are "reseting" the streams and sending again the constraints to the other peers via the data channel again (see SimplePeer::pushVideoToRemoteUser)
|
|
||||||
**/
|
|
||||||
private pingCameraStatus(){
|
|
||||||
/*setInterval(() => {
|
|
||||||
console.log('ping camera status');
|
|
||||||
this.triggerUpdatedLocalStreamCallbacks(this.localStream);
|
|
||||||
}, 30000);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public addNewMessage(name: string, message: string, isMe: boolean = false){
|
public addNewMessage(name: string, message: string, isMe: boolean = false){
|
||||||
discussionManager.addMessage(name, message, isMe);
|
discussionManager.addMessage(name, message, isMe);
|
||||||
|
@ -244,10 +189,6 @@ export class MediaManager {
|
||||||
discussionManager.onSendMessageCallback(userId, callback);
|
discussionManager.onSendMessageCallback(userId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
get activatedDiscussion(){
|
|
||||||
return discussionManager.activatedDiscussion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setUserInputManager(userInputManager : UserInputManager){
|
public setUserInputManager(userInputManager : UserInputManager){
|
||||||
this.userInputManager = userInputManager;
|
this.userInputManager = userInputManager;
|
||||||
discussionManager.setUserInputManager(userInputManager);
|
discussionManager.setUserInputManager(userInputManager);
|
||||||
|
|
|
@ -108,28 +108,13 @@ export class ScreenSharingPeer extends Peer {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*this.on('data', (chunk: Buffer) => {
|
|
||||||
// We unfortunately need to rely on an event to let the other party know a stream has stopped.
|
|
||||||
// It seems there is no native way to detect that.
|
|
||||||
// TODO: we might rely on the "ended" event: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ended_event
|
|
||||||
const message = JSON.parse(chunk.toString('utf8'));
|
|
||||||
if (message.streamEnded !== true) {
|
|
||||||
console.error('Unexpected message on screen sharing peer connection');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mediaManager.removeActiveScreenSharingVideo("" + this.userId);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
this.on('error', (err: any) => {
|
this.on('error', (err: any) => {
|
||||||
console.error(`screen sharing error => ${this.userId} => ${err.code}`, err);
|
console.error(`screen sharing error => ${this.userId} => ${err.code}`, err);
|
||||||
//mediaManager.isErrorScreenSharing(this.userId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('connect', () => {
|
this.on('connect', () => {
|
||||||
this._connected = true;
|
this._connected = true;
|
||||||
// FIXME: we need to put the loader on the screen sharing connection
|
|
||||||
mediaManager.isConnected("" + this.userId);
|
|
||||||
console.info(`connect => ${this.userId}`);
|
console.info(`connect => ${this.userId}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -143,7 +128,6 @@ export class ScreenSharingPeer extends Peer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendWebrtcScreenSharingSignal(data: unknown) {
|
private sendWebrtcScreenSharingSignal(data: unknown) {
|
||||||
//console.log("sendWebrtcScreenSharingSignal", data);
|
|
||||||
try {
|
try {
|
||||||
this.connection.sendWebrtcScreenSharingSignal(data, this.userId);
|
this.connection.sendWebrtcScreenSharingSignal(data, this.userId);
|
||||||
}catch (e) {
|
}catch (e) {
|
||||||
|
@ -155,13 +139,9 @@ export class ScreenSharingPeer extends Peer {
|
||||||
* Sends received stream to screen.
|
* Sends received stream to screen.
|
||||||
*/
|
*/
|
||||||
private stream(stream?: MediaStream) {
|
private stream(stream?: MediaStream) {
|
||||||
//console.log(`ScreenSharingPeer::stream => ${this.userId}`, stream);
|
|
||||||
//console.log(`stream => ${this.userId} => `, stream);
|
|
||||||
if(!stream){
|
if(!stream){
|
||||||
//mediaManager.removeActiveScreenSharingVideo("" + this.userId);
|
|
||||||
this.isReceivingStream = false;
|
this.isReceivingStream = false;
|
||||||
} else {
|
} else {
|
||||||
//mediaManager.addStreamRemoteScreenSharing("" + this.userId, stream);
|
|
||||||
this.isReceivingStream = true;
|
this.isReceivingStream = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +156,6 @@ export class ScreenSharingPeer extends Peer {
|
||||||
if(!this.toClose){
|
if(!this.toClose){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//mediaManager.removeActiveScreenSharingVideo("" + this.userId);
|
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
//console.log('Closing connection with '+userId);
|
//console.log('Closing connection with '+userId);
|
||||||
|
|
|
@ -6,19 +6,14 @@ import {
|
||||||
mediaManager,
|
mediaManager,
|
||||||
StartScreenSharingCallback,
|
StartScreenSharingCallback,
|
||||||
StopScreenSharingCallback,
|
StopScreenSharingCallback,
|
||||||
UpdatedLocalStreamCallback
|
|
||||||
} from "./MediaManager";
|
} from "./MediaManager";
|
||||||
import {ScreenSharingPeer} from "./ScreenSharingPeer";
|
import {ScreenSharingPeer} from "./ScreenSharingPeer";
|
||||||
import {MESSAGE_TYPE_BLOCKED, MESSAGE_TYPE_CONSTRAINT, MESSAGE_TYPE_MESSAGE, VideoPeer} from "./VideoPeer";
|
import {MESSAGE_TYPE_BLOCKED, MESSAGE_TYPE_CONSTRAINT, MESSAGE_TYPE_MESSAGE, VideoPeer} from "./VideoPeer";
|
||||||
import type {RoomConnection} from "../Connexion/RoomConnection";
|
import type {RoomConnection} from "../Connexion/RoomConnection";
|
||||||
import {connectionManager} from "../Connexion/ConnectionManager";
|
|
||||||
import {GameConnexionTypes} from "../Url/UrlManager";
|
|
||||||
import {blackListManager} from "./BlackListManager";
|
import {blackListManager} from "./BlackListManager";
|
||||||
import {get} from "svelte/store";
|
import {get} from "svelte/store";
|
||||||
import {localStreamStore, LocalStreamStoreValue, obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
import {localStreamStore, LocalStreamStoreValue, obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
||||||
import {screenSharingLocalStreamStore} from "../Stores/ScreenSharingStore";
|
import {screenSharingLocalStreamStore} from "../Stores/ScreenSharingStore";
|
||||||
import {DivImportance, layoutManager} from "./LayoutManager";
|
|
||||||
import {HtmlUtils} from "./HtmlUtils";
|
|
||||||
import {discussionManager} from "./DiscussionManager";
|
import {discussionManager} from "./DiscussionManager";
|
||||||
|
|
||||||
export interface UserSimplePeerInterface{
|
export interface UserSimplePeerInterface{
|
||||||
|
@ -127,7 +122,6 @@ export class SimplePeer {
|
||||||
// This would be symmetrical to the way we handle disconnection.
|
// This would be symmetrical to the way we handle disconnection.
|
||||||
|
|
||||||
//start connection
|
//start connection
|
||||||
//console.log('receiveWebrtcStart. Initiator: ', user.initiator)
|
|
||||||
if(!user.initiator){
|
if(!user.initiator){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -230,12 +224,6 @@ export class SimplePeer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should display the screen sharing ONLY if we are not initiator
|
|
||||||
/* if (!user.initiator) {
|
|
||||||
mediaManager.removeActiveScreenSharingVideo("" + user.userId);
|
|
||||||
mediaManager.addScreenSharingActiveVideo("" + user.userId);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Enrich the user with last known credentials (if they are not set in the user object, which happens when a user triggers the screen sharing)
|
// Enrich the user with last known credentials (if they are not set in the user object, which happens when a user triggers the screen sharing)
|
||||||
if (user.webRtcUser === undefined) {
|
if (user.webRtcUser === undefined) {
|
||||||
user.webRtcUser = this.lastWebrtcUserName;
|
user.webRtcUser = this.lastWebrtcUserName;
|
||||||
|
|
|
@ -135,8 +135,6 @@ export class VideoPeer extends Peer {
|
||||||
|
|
||||||
this.on('connect', () => {
|
this.on('connect', () => {
|
||||||
this._connected = true;
|
this._connected = true;
|
||||||
mediaManager.isConnected("" + this.userId);
|
|
||||||
console.info(`connect => ${this.userId}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('data', (chunk: Buffer) => {
|
this.on('data', (chunk: Buffer) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue