diff --git a/front/src/Administration/ConsoleGlobalMessageManager.ts b/front/src/Administration/ConsoleGlobalMessageManager.ts index c1d0fba9..0dbfe834 100644 --- a/front/src/Administration/ConsoleGlobalMessageManager.ts +++ b/front/src/Administration/ConsoleGlobalMessageManager.ts @@ -1,7 +1,7 @@ import {HtmlUtils} from "../WebRtc/HtmlUtils"; -import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; -import {RoomConnection} from "../Connexion/RoomConnection"; -import {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels"; +import type {UserInputManager} from "../Phaser/UserInput/UserInputManager"; +import type {RoomConnection} from "../Connexion/RoomConnection"; +import type {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels"; import {AdminMessageEventTypes} from "../Connexion/AdminMessagesService"; export const CLASS_CONSOLE_MESSAGE = 'main-console'; diff --git a/front/src/Administration/GlobalMessageManager.ts b/front/src/Administration/GlobalMessageManager.ts index bc9f3cfe..95364e4c 100644 --- a/front/src/Administration/GlobalMessageManager.ts +++ b/front/src/Administration/GlobalMessageManager.ts @@ -1,8 +1,8 @@ import {HtmlUtils} from "./../WebRtc/HtmlUtils"; import {AUDIO_TYPE, MESSAGE_TYPE} from "./ConsoleGlobalMessageManager"; import {PUSHER_URL, UPLOADER_URL} from "../Enum/EnvironmentVariable"; -import {RoomConnection} from "../Connexion/RoomConnection"; -import {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels"; +import type {RoomConnection} from "../Connexion/RoomConnection"; +import type {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels"; export class GlobalMessageManager { diff --git a/front/src/Administration/TypeMessage.ts b/front/src/Administration/TypeMessage.ts index 182f7e01..07f330fd 100644 --- a/front/src/Administration/TypeMessage.ts +++ b/front/src/Administration/TypeMessage.ts @@ -1,4 +1,4 @@ -import {TypeMessageInterface} from "./UserMessageManager"; +import type {TypeMessageInterface} from "./UserMessageManager"; import {HtmlUtils} from "../WebRtc/HtmlUtils"; let modalTimeOut : NodeJS.Timeout; @@ -86,4 +86,4 @@ export class Banned extends TypeMessageExt { showMessage(message: string){ super.showMessage(message, false); } -} \ No newline at end of file +} diff --git a/front/src/Api/Events/IframeEvent.ts b/front/src/Api/Events/IframeEvent.ts index 2f703222..598f4544 100644 --- a/front/src/Api/Events/IframeEvent.ts +++ b/front/src/Api/Events/IframeEvent.ts @@ -1,14 +1,14 @@ -import { ButtonClickedEvent } from './ButtonClickedEvent'; -import { ChatEvent } from './ChatEvent'; -import { ClosePopupEvent } from './ClosePopupEvent'; -import { EnterLeaveEvent } from './EnterLeaveEvent'; -import { GoToPageEvent } from './GoToPageEvent'; -import { OpenCoWebSiteEvent } from './OpenCoWebSiteEvent'; -import { OpenPopupEvent } from './OpenPopupEvent'; -import { OpenTabEvent } from './OpenTabEvent'; -import { UserInputChatEvent } from './UserInputChatEvent'; +import type { ButtonClickedEvent } from './ButtonClickedEvent'; +import type { ChatEvent } from './ChatEvent'; +import type { ClosePopupEvent } from './ClosePopupEvent'; +import type { EnterLeaveEvent } from './EnterLeaveEvent'; +import type { GoToPageEvent } from './GoToPageEvent'; +import type { OpenCoWebSiteEvent } from './OpenCoWebSiteEvent'; +import type { OpenPopupEvent } from './OpenPopupEvent'; +import type { OpenTabEvent } from './OpenTabEvent'; +import type { UserInputChatEvent } from './UserInputChatEvent'; export interface TypedMessageEvent extends MessageEvent { diff --git a/front/src/Api/IframeListener.ts b/front/src/Api/IframeListener.ts index 147361aa..5079fb28 100644 --- a/front/src/Api/IframeListener.ts +++ b/front/src/Api/IframeListener.ts @@ -1,16 +1,16 @@ import { Subject } from "rxjs"; import { ChatEvent, isChatEvent } from "./Events/ChatEvent"; import { HtmlUtils } from "../WebRtc/HtmlUtils"; -import { EnterLeaveEvent } from "./Events/EnterLeaveEvent"; +import type { EnterLeaveEvent } from "./Events/EnterLeaveEvent"; import { isOpenPopupEvent, OpenPopupEvent } from "./Events/OpenPopupEvent"; import { isOpenTabEvent, OpenTabEvent } from "./Events/OpenTabEvent"; -import { ButtonClickedEvent } from "./Events/ButtonClickedEvent"; +import type { ButtonClickedEvent } from "./Events/ButtonClickedEvent"; import { ClosePopupEvent, isClosePopupEvent } from "./Events/ClosePopupEvent"; import { scriptUtils } from "./ScriptUtils"; import { GoToPageEvent, isGoToPageEvent } from "./Events/GoToPageEvent"; import { isOpenCoWebsite, OpenCoWebSiteEvent } from "./Events/OpenCoWebSiteEvent"; import { IframeEventMap, IframeEvent, IframeResponseEvent, IframeResponseEventMap, isIframeEventWrapper, TypedMessageEvent } from "./Events/IframeEvent"; -import { UserInputChatEvent } from "./Events/UserInputChatEvent"; +import type { UserInputChatEvent } from "./Events/UserInputChatEvent"; /** diff --git a/front/src/Connexion/AdminMessagesService.ts b/front/src/Connexion/AdminMessagesService.ts index 1750dd28..0cf7f95f 100644 --- a/front/src/Connexion/AdminMessagesService.ts +++ b/front/src/Connexion/AdminMessagesService.ts @@ -1,5 +1,5 @@ import {Subject} from "rxjs"; -import {BanUserMessage, SendUserMessage} from "../Messages/generated/messages_pb"; +import type {BanUserMessage, SendUserMessage} from "../Messages/generated/messages_pb"; export enum AdminMessageEventTypes { admin = 'message', @@ -19,11 +19,11 @@ interface AdminMessageEvent { class AdminMessagesService { private _messageStream: Subject = new Subject(); public messageStream = this._messageStream.asObservable(); - + constructor() { this.messageStream.subscribe((event) => console.log('message', event)) } - + onSendusermessage(message: SendUserMessage|BanUserMessage) { this._messageStream.next({ type: message.getType() as unknown as AdminMessageEventTypes, @@ -32,4 +32,4 @@ class AdminMessagesService { } } -export const adminMessagesService = new AdminMessagesService(); \ No newline at end of file +export const adminMessagesService = new AdminMessagesService(); diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index a0edacbc..932fb1fc 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -1,7 +1,7 @@ import Axios from "axios"; import {PUSHER_URL, START_ROOM_URL} from "../Enum/EnvironmentVariable"; import {RoomConnection} from "./RoomConnection"; -import {OnConnectInterface, PositionInterface, ViewportInterface} from "./ConnexionModels"; +import type {OnConnectInterface, PositionInterface, ViewportInterface} from "./ConnexionModels"; import {GameConnexionTypes, urlManager} from "../Url/UrlManager"; import {localUserStore} from "./LocalUserStore"; import {LocalUser} from "./LocalUser"; diff --git a/front/src/Connexion/ConnexionModels.ts b/front/src/Connexion/ConnexionModels.ts index 477e86e3..09447445 100644 --- a/front/src/Connexion/ConnexionModels.ts +++ b/front/src/Connexion/ConnexionModels.ts @@ -1,8 +1,8 @@ import {PlayerAnimationDirections} from "../Phaser/Player/Animation"; import {UserSimplePeerInterface} from "../WebRtc/SimplePeer"; -import {SignalData} from "simple-peer"; -import {RoomConnection} from "./RoomConnection"; -import {BodyResourceDescriptionInterface} from "../Phaser/Entity/PlayerTextures"; +import type {SignalData} from "simple-peer"; +import type {RoomConnection} from "./RoomConnection"; +import type {BodyResourceDescriptionInterface} from "../Phaser/Entity/PlayerTextures"; export enum EventMessage{ CONNECT = "connect", diff --git a/front/src/Connexion/RoomConnection.ts b/front/src/Connexion/RoomConnection.ts index 101bdd61..6edb9c45 100644 --- a/front/src/Connexion/RoomConnection.ts +++ b/front/src/Connexion/RoomConnection.ts @@ -27,11 +27,11 @@ import { SendJitsiJwtMessage, CharacterLayerMessage, PingMessage, - SendUserMessage, + SendUserMessage, BanUserMessage } from "../Messages/generated/messages_pb" -import {UserSimplePeerInterface} from "../WebRtc/SimplePeer"; +import type {UserSimplePeerInterface} from "../WebRtc/SimplePeer"; import Direction = PositionMessage.Direction; import {ProtobufClientUtils} from "../Network/ProtobufClientUtils"; import { @@ -42,7 +42,7 @@ import { ViewportInterface, WebRtcDisconnectMessageInterface, WebRtcSignalReceivedMessageInterface, } from "./ConnexionModels"; -import {BodyResourceDescriptionInterface} from "../Phaser/Entity/PlayerTextures"; +import type {BodyResourceDescriptionInterface} from "../Phaser/Entity/PlayerTextures"; import {adminMessagesService} from "./AdminMessagesService"; import {worldFullMessageStream} from "./WorldFullMessageStream"; import {worldFullWarningStream} from "./WorldFullWarningStream"; @@ -86,7 +86,7 @@ export class RoomConnection implements RoomConnection { url += '&bottom='+Math.floor(viewport.bottom); url += '&left='+Math.floor(viewport.left); url += '&right='+Math.floor(viewport.right); - + if (typeof companion === 'string') { url += '&companion='+encodeURIComponent(companion); } diff --git a/front/src/Network/ProtobufClientUtils.ts b/front/src/Network/ProtobufClientUtils.ts index 6a402e97..3d2d5c32 100644 --- a/front/src/Network/ProtobufClientUtils.ts +++ b/front/src/Network/ProtobufClientUtils.ts @@ -1,6 +1,6 @@ import {PositionMessage} from "../Messages/generated/messages_pb"; import Direction = PositionMessage.Direction; -import {PointInterface} from "../Connexion/ConnexionModels"; +import type {PointInterface} from "../Connexion/ConnexionModels"; export class ProtobufClientUtils { diff --git a/front/src/Phaser/Companion/Companion.ts b/front/src/Phaser/Companion/Companion.ts index 72491ae1..1c43f452 100644 --- a/front/src/Phaser/Companion/Companion.ts +++ b/front/src/Phaser/Companion/Companion.ts @@ -1,6 +1,5 @@ import Sprite = Phaser.GameObjects.Sprite; import Container = Phaser.GameObjects.Container; -import { lazyLoadCompanionResource } from "./CompanionTexturesLoadingManager"; import { PlayerAnimationDirections, PlayerAnimationTypes } from "../Player/Animation"; export interface CompanionStatus { @@ -25,7 +24,7 @@ export class Companion extends Container { constructor(scene: Phaser.Scene, x: number, y: number, name: string, texturePromise: Promise) { super(scene, x + 14, y + 4); - + this.sprites = new Map(); this.delta = 0; @@ -104,7 +103,7 @@ export class Companion extends Container { } } } - + this.setDepth(this.y); this.playAnimation(this.direction, this.animationType); } @@ -137,7 +136,7 @@ export class Companion extends Container { this.getAnimations(resource).forEach(animation => { this.scene.anims.create(animation); }); - + this.scene.sys.updateList.add(sprite); this.sprites.set(resource, sprite); } diff --git a/front/src/Phaser/Components/MobileJoystick.ts b/front/src/Phaser/Components/MobileJoystick.ts index 0af3d6c8..fced71da 100644 --- a/front/src/Phaser/Components/MobileJoystick.ts +++ b/front/src/Phaser/Components/MobileJoystick.ts @@ -1,5 +1,4 @@ import VirtualJoystick from 'phaser3-rex-plugins/plugins/virtualjoystick.js'; -import ScaleManager = Phaser.Scale.ScaleManager; import {waScaleManager} from "../Services/WaScaleManager"; //the assets were found here: https://hannemann.itch.io/virtual-joystick-pack-free diff --git a/front/src/Phaser/Components/SoundMeterSprite.ts b/front/src/Phaser/Components/SoundMeterSprite.ts index 2787059d..582617f9 100644 --- a/front/src/Phaser/Components/SoundMeterSprite.ts +++ b/front/src/Phaser/Components/SoundMeterSprite.ts @@ -1,5 +1,5 @@ import Container = Phaser.GameObjects.Container; -import {Scene} from "phaser"; +import type {Scene} from "phaser"; import GameObject = Phaser.GameObjects.GameObject; import Rectangle = Phaser.GameObjects.Rectangle; diff --git a/front/src/Phaser/Components/TextUtils.ts b/front/src/Phaser/Components/TextUtils.ts index beee840a..db9a97fb 100644 --- a/front/src/Phaser/Components/TextUtils.ts +++ b/front/src/Phaser/Components/TextUtils.ts @@ -1,7 +1,5 @@ -import {ITiledMapObject} from "../Map/ITiledMap"; -import Text = Phaser.GameObjects.Text; -import {GameScene} from "../Game/GameScene"; -import TextStyle = Phaser.GameObjects.TextStyle; +import type {ITiledMapObject} from "../Map/ITiledMap"; +import type {GameScene} from "../Game/GameScene"; export class TextUtils { public static createTextFromITiledMapObject(scene: GameScene, object: ITiledMapObject): void { diff --git a/front/src/Phaser/Entity/PlayerTexturesLoadingManager.ts b/front/src/Phaser/Entity/PlayerTexturesLoadingManager.ts index 3dfe8368..6d8b84c2 100644 --- a/front/src/Phaser/Entity/PlayerTexturesLoadingManager.ts +++ b/front/src/Phaser/Entity/PlayerTexturesLoadingManager.ts @@ -1,6 +1,5 @@ import LoaderPlugin = Phaser.Loader.LoaderPlugin; -import TextureManager = Phaser.Textures.TextureManager; -import {CharacterTexture} from "../../Connexion/LocalUser"; +import type {CharacterTexture} from "../../Connexion/LocalUser"; import {BodyResourceDescriptionInterface, LAYERS, PLAYER_RESOURCES} from "./PlayerTextures"; diff --git a/front/src/Phaser/Entity/RemotePlayer.ts b/front/src/Phaser/Entity/RemotePlayer.ts index 41e2e2df..4787d1f2 100644 --- a/front/src/Phaser/Entity/RemotePlayer.ts +++ b/front/src/Phaser/Entity/RemotePlayer.ts @@ -1,7 +1,7 @@ -import {GameScene} from "../Game/GameScene"; -import {PointInterface} from "../../Connexion/ConnexionModels"; +import type {GameScene} from "../Game/GameScene"; +import type {PointInterface} from "../../Connexion/ConnexionModels"; import {Character} from "../Entity/Character"; -import {PlayerAnimationDirections} from "../Player/Animation"; +import type {PlayerAnimationDirections} from "../Player/Animation"; /** * Class representing the sprite of a remote player (a player that plays on another computer) @@ -22,7 +22,7 @@ export class RemotePlayer extends Character { companionTexturePromise?: Promise ) { super(Scene, x, y, texturesPromise, name, direction, moving, 1); - + //set data this.userId = userId; @@ -35,9 +35,9 @@ export class RemotePlayer extends Character { this.playAnimation(position.direction as PlayerAnimationDirections, position.moving); this.setX(position.x); this.setY(position.y); - + this.setDepth(position.y); //this is to make sure the perspective (player models closer the bottom of the screen will appear in front of models nearer the top of the screen). - + if (this.companion) { this.companion.setTarget(position.x, position.y, position.direction as PlayerAnimationDirections); } diff --git a/front/src/Phaser/Entity/SpeechBubble.ts b/front/src/Phaser/Entity/SpeechBubble.ts index 231de875..17b7ed0e 100644 --- a/front/src/Phaser/Entity/SpeechBubble.ts +++ b/front/src/Phaser/Entity/SpeechBubble.ts @@ -1,12 +1,12 @@ import Scene = Phaser.Scene; -import {Character} from "./Character"; +import type {Character} from "./Character"; //todo: improve this WIP export class SpeechBubble { private bubble: Phaser.GameObjects.Graphics; private content: Phaser.GameObjects.Text; - + constructor(scene: Scene, player: Character, text: string = "") { const bubbleHeight = 50; diff --git a/front/src/Phaser/Game/AddPlayerInterface.ts b/front/src/Phaser/Game/AddPlayerInterface.ts index 96762a66..70c341ee 100644 --- a/front/src/Phaser/Game/AddPlayerInterface.ts +++ b/front/src/Phaser/Game/AddPlayerInterface.ts @@ -1,5 +1,5 @@ -import {PointInterface} from "../../Connexion/ConnexionModels"; -import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; +import type {PointInterface} from "../../Connexion/ConnexionModels"; +import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; export interface AddPlayerInterface { userId: number; diff --git a/front/src/Phaser/Game/GameManager.ts b/front/src/Phaser/Game/GameManager.ts index 6047d430..2a1d3d8a 100644 --- a/front/src/Phaser/Game/GameManager.ts +++ b/front/src/Phaser/Game/GameManager.ts @@ -1,6 +1,6 @@ import {GameScene} from "./GameScene"; import {connectionManager} from "../../Connexion/ConnectionManager"; -import {Room} from "../../Connexion/Room"; +import type {Room} from "../../Connexion/Room"; import {MenuScene, MenuSceneName} from "../Menu/MenuScene"; import {HelpCameraSettingsScene, HelpCameraSettingsSceneName} from "../Menu/HelpCameraSettingsScene"; import {LoginSceneName} from "../Login/LoginScene"; @@ -24,7 +24,7 @@ export class GameManager { private companion: string|null; private startRoom!:Room; currentGameSceneName: string|null = null; - + constructor() { this.playerName = localUserStore.getName(); this.characterLayers = localUserStore.getCharacterLayers(); @@ -65,7 +65,7 @@ export class GameManager { return this.characterLayers; } - + setCompanion(companion: string|null): void { this.companion = companion; } @@ -91,7 +91,7 @@ export class GameManager { scenePlugin.launch(MenuSceneName); scenePlugin.launch(HelpCameraSettingsSceneName);//700 } - + public gameSceneIsCreated(scene: GameScene) { this.currentGameSceneName = scene.scene.key; const menuScene: MenuScene = scene.scene.get(MenuSceneName) as MenuScene; @@ -125,7 +125,7 @@ export class GameManager { scene.scene.run(fallbackSceneName) } } - + public getCurrentGameScene(scene: Phaser.Scene): GameScene { if (this.currentGameSceneName === null) throw 'No current scene id set!'; return scene.scene.get(this.currentGameSceneName) as GameScene diff --git a/front/src/Phaser/Game/GameMap.ts b/front/src/Phaser/Game/GameMap.ts index 5fe91b62..7c93a702 100644 --- a/front/src/Phaser/Game/GameMap.ts +++ b/front/src/Phaser/Game/GameMap.ts @@ -1,4 +1,4 @@ -import {ITiledMap, ITiledMapLayer} from "../Map/ITiledMap"; +import type {ITiledMap, ITiledMapLayer} from "../Map/ITiledMap"; import {LayersIterator} from "../Map/LayersIterator"; export type PropertyChangeCallback = (newValue: string | number | boolean | undefined, oldValue: string | number | boolean | undefined, allProps: Map) => void; diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index e7e25678..7b968615 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1,5 +1,5 @@ import {gameManager, HasMovedEvent} from "./GameManager"; -import { +import type { GroupCreatedUpdatedMessageInterface, MessageUserJoined, MessageUserMovedInterface, @@ -16,7 +16,7 @@ import { MAX_PER_GROUP, POSITION_DELAY, } from "../../Enum/EnvironmentVariable"; -import { +import type { ITiledMap, ITiledMapLayer, ITiledMapLayerProperty, @@ -25,7 +25,7 @@ import { ITiledMapTileLayer, ITiledTileSet } from "../Map/ITiledMap"; -import {AddPlayerInterface} from "./AddPlayerInterface"; +import type {AddPlayerInterface} from "./AddPlayerInterface"; import {PlayerAnimationDirections} from "../Player/Animation"; import {PlayerMovement} from "./PlayerMovement"; import {PlayersPositionInterpolator} from "./PlayersPositionInterpolator"; @@ -49,13 +49,13 @@ import { import {GameMap} from "./GameMap"; import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager"; import {mediaManager} from "../../WebRtc/MediaManager"; -import {ItemFactoryInterface} from "../Items/ItemFactoryInterface"; -import {ActionableItem} from "../Items/ActionableItem"; +import type {ItemFactoryInterface} from "../Items/ItemFactoryInterface"; +import type {ActionableItem} from "../Items/ActionableItem"; import {UserInputManager} from "../UserInput/UserInputManager"; -import {UserMovedMessage} from "../../Messages/generated/messages_pb"; +import type {UserMovedMessage} from "../../Messages/generated/messages_pb"; import {ProtobufClientUtils} from "../../Network/ProtobufClientUtils"; import {connectionManager} from "../../Connexion/ConnectionManager"; -import {RoomConnection} from "../../Connexion/RoomConnection"; +import type {RoomConnection} from "../../Connexion/RoomConnection"; import {GlobalMessageManager} from "../../Administration/GlobalMessageManager"; import {userMessageManager} from "../../Administration/UserMessageManager"; import {ConsoleGlobalMessageManager} from "../../Administration/ConsoleGlobalMessageManager"; @@ -80,7 +80,7 @@ import CanvasTexture = Phaser.Textures.CanvasTexture; import GameObject = Phaser.GameObjects.GameObject; import FILE_LOAD_ERROR = Phaser.Loader.Events.FILE_LOAD_ERROR; import DOMElement = Phaser.GameObjects.DOMElement; -import {Subscription} from "rxjs"; +import type {Subscription} from "rxjs"; import {worldFullMessageStream} from "../../Connexion/WorldFullMessageStream"; import { lazyLoadCompanionResource } from "../Companion/CompanionTexturesLoadingManager"; import RenderTexture = Phaser.GameObjects.RenderTexture; diff --git a/front/src/Phaser/Game/PlayerMovement.ts b/front/src/Phaser/Game/PlayerMovement.ts index eb1a5d1b..89c4c1a4 100644 --- a/front/src/Phaser/Game/PlayerMovement.ts +++ b/front/src/Phaser/Game/PlayerMovement.ts @@ -1,6 +1,6 @@ -import {HasMovedEvent} from "./GameManager"; +import type {HasMovedEvent} from "./GameManager"; import {MAX_EXTRAPOLATION_TIME} from "../../Enum/EnvironmentVariable"; -import {PositionInterface} from "../../Connexion/ConnexionModels"; +import type {PositionInterface} from "../../Connexion/ConnexionModels"; export class PlayerMovement { public constructor(private startPosition: PositionInterface, private startTick: number, private endPosition: HasMovedEvent, private endTick: number) { diff --git a/front/src/Phaser/Game/PlayersPositionInterpolator.ts b/front/src/Phaser/Game/PlayersPositionInterpolator.ts index 3ac87397..100aa1a0 100644 --- a/front/src/Phaser/Game/PlayersPositionInterpolator.ts +++ b/front/src/Phaser/Game/PlayersPositionInterpolator.ts @@ -2,8 +2,8 @@ * This class is in charge of computing the position of all players. * Player movement is delayed by 200ms so position depends on ticks. */ -import {PlayerMovement} from "./PlayerMovement"; -import {HasMovedEvent} from "./GameManager"; +import type {PlayerMovement} from "./PlayerMovement"; +import type {HasMovedEvent} from "./GameManager"; export class PlayersPositionInterpolator { playerMovements: Map = new Map(); diff --git a/front/src/Phaser/Items/ActionableItem.ts b/front/src/Phaser/Items/ActionableItem.ts index fe4de385..f012b525 100644 --- a/front/src/Phaser/Items/ActionableItem.ts +++ b/front/src/Phaser/Items/ActionableItem.ts @@ -4,7 +4,7 @@ */ import Sprite = Phaser.GameObjects.Sprite; import {OutlinePipeline} from "../Shaders/OutlinePipeline"; -import {GameScene} from "../Game/GameScene"; +import type {GameScene} from "../Game/GameScene"; type EventCallback = (state: unknown, parameters: unknown) => void; diff --git a/front/src/Phaser/Items/Computer/computer.ts b/front/src/Phaser/Items/Computer/computer.ts index fdc7a358..8240d904 100644 --- a/front/src/Phaser/Items/Computer/computer.ts +++ b/front/src/Phaser/Items/Computer/computer.ts @@ -1,9 +1,9 @@ import * as Phaser from 'phaser'; import {Scene} from "phaser"; import Sprite = Phaser.GameObjects.Sprite; -import {ITiledMapObject} from "../../Map/ITiledMap"; -import {ItemFactoryInterface} from "../ItemFactoryInterface"; -import {GameScene} from "../../Game/GameScene"; +import type {ITiledMapObject} from "../../Map/ITiledMap"; +import type {ItemFactoryInterface} from "../ItemFactoryInterface"; +import type {GameScene} from "../../Game/GameScene"; import {ActionableItem} from "../ActionableItem"; import * as tg from "generic-type-guard"; diff --git a/front/src/Phaser/Items/ItemFactoryInterface.ts b/front/src/Phaser/Items/ItemFactoryInterface.ts index e3e52517..deff8fbb 100644 --- a/front/src/Phaser/Items/ItemFactoryInterface.ts +++ b/front/src/Phaser/Items/ItemFactoryInterface.ts @@ -1,7 +1,7 @@ +import type {GameScene} from "../Game/GameScene"; +import type {ITiledMapObject} from "../Map/ITiledMap"; +import type {ActionableItem} from "./ActionableItem"; import LoaderPlugin = Phaser.Loader.LoaderPlugin; -import {GameScene} from "../Game/GameScene"; -import {ITiledMapObject} from "../Map/ITiledMap"; -import {ActionableItem} from "./ActionableItem"; export interface ItemFactoryInterface { preload: (loader: LoaderPlugin) => void; diff --git a/front/src/Phaser/Login/AbstractCharacterScene.ts b/front/src/Phaser/Login/AbstractCharacterScene.ts index dfc98539..0d3a7c3b 100644 --- a/front/src/Phaser/Login/AbstractCharacterScene.ts +++ b/front/src/Phaser/Login/AbstractCharacterScene.ts @@ -1,8 +1,8 @@ import {ResizableScene} from "./ResizableScene"; import {localUserStore} from "../../Connexion/LocalUserStore"; -import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; +import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; import {loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager"; -import {CharacterTexture} from "../../Connexion/LocalUser"; +import type {CharacterTexture} from "../../Connexion/LocalUser"; export abstract class AbstractCharacterScene extends ResizableScene { @@ -38,4 +38,4 @@ export abstract class AbstractCharacterScene extends ResizableScene { const localUser = localUserStore.getLocalUser(); return localUser?.textures; } -} \ No newline at end of file +} diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index c20bc61e..8b9a9a7a 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -6,7 +6,7 @@ import Container = Phaser.GameObjects.Container; import {gameManager} from "../Game/GameManager"; import {localUserStore} from "../../Connexion/LocalUserStore"; import {addLoader} from "../Components/Loader"; -import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; +import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; import {AbstractCharacterScene} from "./AbstractCharacterScene"; import {areCharacterLayersValid} from "../../Connexion/LocalUser"; import { MenuScene } from "../Menu/MenuScene"; diff --git a/front/src/Phaser/Login/SelectCharacterMobileScene.ts b/front/src/Phaser/Login/SelectCharacterMobileScene.ts index e29ab798..b9c4b5a8 100644 --- a/front/src/Phaser/Login/SelectCharacterMobileScene.ts +++ b/front/src/Phaser/Login/SelectCharacterMobileScene.ts @@ -1,18 +1,4 @@ -import {gameManager} from "../Game/GameManager"; -import {TextField} from "../Components/TextField"; -import Image = Phaser.GameObjects.Image; -import Rectangle = Phaser.GameObjects.Rectangle; -import {EnableCameraSceneName} from "./EnableCameraScene"; -import {CustomizeSceneName} from "./CustomizeScene"; -import {localUserStore} from "../../Connexion/LocalUserStore"; -import {loadAllDefaultModels} from "../Entity/PlayerTexturesLoadingManager"; -import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; -import {AbstractCharacterScene} from "./AbstractCharacterScene"; -import {areCharacterLayersValid} from "../../Connexion/LocalUser"; -import {touchScreenManager} from "../../Touch/TouchScreenManager"; -import {PinchManager} from "../UserInput/PinchManager"; -import {MenuScene} from "../Menu/MenuScene"; -import { SelectCharacterScene, SelectCharacterSceneName } from "./SelectCharacterScene"; +import { SelectCharacterScene } from "./SelectCharacterScene"; export class SelectCharacterMobileScene extends SelectCharacterScene { @@ -20,7 +6,7 @@ export class SelectCharacterMobileScene extends SelectCharacterScene { super.create(); this.selectedRectangle.destroy(); } - + protected defineSetupPlayer(numero: number){ const deltaX = 30; const deltaY = 2; diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index 0366dde5..ecbb9c64 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -1,18 +1,16 @@ import {gameManager} from "../Game/GameManager"; -import Image = Phaser.GameObjects.Image; import Rectangle = Phaser.GameObjects.Rectangle; import {EnableCameraSceneName} from "./EnableCameraScene"; import {CustomizeSceneName} from "./CustomizeScene"; import {localUserStore} from "../../Connexion/LocalUserStore"; import {loadAllDefaultModels} from "../Entity/PlayerTexturesLoadingManager"; import {addLoader} from "../Components/Loader"; -import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; +import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures"; import {AbstractCharacterScene} from "./AbstractCharacterScene"; import {areCharacterLayersValid} from "../../Connexion/LocalUser"; import {touchScreenManager} from "../../Touch/TouchScreenManager"; import {PinchManager} from "../UserInput/PinchManager"; import {MenuScene} from "../Menu/MenuScene"; -import { SelectCharacterMobileScene } from "./SelectCharacterMobileScene"; //todo: put this constants in a dedicated file export const SelectCharacterSceneName = "SelectCharacterScene"; diff --git a/front/src/Phaser/Login/SelectCompanionScene.ts b/front/src/Phaser/Login/SelectCompanionScene.ts index 4ef378d6..203fd557 100644 --- a/front/src/Phaser/Login/SelectCompanionScene.ts +++ b/front/src/Phaser/Login/SelectCompanionScene.ts @@ -5,7 +5,7 @@ import { gameManager} from "../Game/GameManager"; import { ResizableScene } from "./ResizableScene"; import { EnableCameraSceneName } from "./EnableCameraScene"; import { localUserStore } from "../../Connexion/LocalUserStore"; -import { CompanionResourceDescriptionInterface } from "../Companion/CompanionTextures"; +import type { CompanionResourceDescriptionInterface } from "../Companion/CompanionTextures"; import { getAllCompanionResources } from "../Companion/CompanionTexturesLoadingManager"; import {touchScreenManager} from "../../Touch/TouchScreenManager"; import {PinchManager} from "../UserInput/PinchManager"; diff --git a/front/src/Phaser/Map/LayersIterator.ts b/front/src/Phaser/Map/LayersIterator.ts index 501a5f7b..c39f05d8 100644 --- a/front/src/Phaser/Map/LayersIterator.ts +++ b/front/src/Phaser/Map/LayersIterator.ts @@ -1,4 +1,4 @@ -import {ITiledMap, ITiledMapLayer} from "./ITiledMap"; +import type {ITiledMap, ITiledMapLayer} from "./ITiledMap"; /** * Iterates over the layers of a map, flattening the grouped layers diff --git a/front/src/Phaser/Player/Player.ts b/front/src/Phaser/Player/Player.ts index 3db7f051..6044ba84 100644 --- a/front/src/Phaser/Player/Player.ts +++ b/front/src/Phaser/Player/Player.ts @@ -1,5 +1,5 @@ import {PlayerAnimationDirections} from "./Animation"; -import {GameScene} from "../Game/GameScene"; +import type {GameScene} from "../Game/GameScene"; import {UserInputEvent, UserInputManager} from "../UserInput/UserInputManager"; import {Character} from "../Entity/Character"; diff --git a/front/src/Phaser/UserInput/UserInputManager.ts b/front/src/Phaser/UserInput/UserInputManager.ts index fe78dac8..073244d2 100644 --- a/front/src/Phaser/UserInput/UserInputManager.ts +++ b/front/src/Phaser/UserInput/UserInputManager.ts @@ -1,5 +1,5 @@ -import { Direction } from "../../types"; -import {GameScene} from "../Game/GameScene"; +import type { Direction } from "../../types"; +import type {GameScene} from "../Game/GameScene"; import {touchScreenManager} from "../../Touch/TouchScreenManager"; import {MobileJoystick} from "../Components/MobileJoystick"; diff --git a/front/src/Url/UrlManager.ts b/front/src/Url/UrlManager.ts index 9e10b4ee..b502467f 100644 --- a/front/src/Url/UrlManager.ts +++ b/front/src/Url/UrlManager.ts @@ -1,4 +1,4 @@ -import {Room} from "../Connexion/Room"; +import type {Room} from "../Connexion/Room"; export enum GameConnexionTypes { anonymous=1, diff --git a/front/src/WebRtc/DiscussionManager.ts b/front/src/WebRtc/DiscussionManager.ts index 3e565c21..9bbfac5a 100644 --- a/front/src/WebRtc/DiscussionManager.ts +++ b/front/src/WebRtc/DiscussionManager.ts @@ -1,6 +1,6 @@ import {HtmlUtils} from "./HtmlUtils"; -import {mediaManager, ReportCallback, ShowReportCallBack} from "./MediaManager"; -import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; +import type {ShowReportCallBack} from "./MediaManager"; +import type {UserInputManager} from "../Phaser/UserInput/UserInputManager"; import {connectionManager} from "../Connexion/ConnectionManager"; import {GameConnexionTypes} from "../Url/UrlManager"; import {iframeListener} from "../Api/IframeListener"; diff --git a/front/src/WebRtc/LayoutManager.ts b/front/src/WebRtc/LayoutManager.ts index eed12333..3d92baac 100644 --- a/front/src/WebRtc/LayoutManager.ts +++ b/front/src/WebRtc/LayoutManager.ts @@ -1,4 +1,4 @@ -import { UserInputManager } from "../Phaser/UserInput/UserInputManager"; +import type { UserInputManager } from "../Phaser/UserInput/UserInputManager"; import {HtmlUtils} from "./HtmlUtils"; export enum LayoutMode { @@ -324,7 +324,7 @@ class LayoutManager { public addActionButton(id: string, text: string, callBack: Function, userInputManager: UserInputManager){ //delete previous element this.removeActionButton(id, userInputManager); - + //create div and text html component const p = document.createElement('p'); p.classList.add('action-body'); diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 2bed2c68..0f88e743 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -1,9 +1,9 @@ import {DivImportance, layoutManager} from "./LayoutManager"; import {HtmlUtils} from "./HtmlUtils"; import {discussionManager, SendMessageCallback} from "./DiscussionManager"; -import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; +import type {UserInputManager} from "../Phaser/UserInput/UserInputManager"; import {localUserStore} from "../Connexion/LocalUserStore"; -import {UserSimplePeerInterface} from "./SimplePeer"; +import type {UserSimplePeerInterface} from "./SimplePeer"; import {SoundMeter} from "../Phaser/Components/SoundMeter"; declare const navigator:any; // eslint-disable-line @typescript-eslint/no-explicit-any diff --git a/front/src/WebRtc/ScreenSharingPeer.ts b/front/src/WebRtc/ScreenSharingPeer.ts index cb48e7be..f1786ef3 100644 --- a/front/src/WebRtc/ScreenSharingPeer.ts +++ b/front/src/WebRtc/ScreenSharingPeer.ts @@ -1,9 +1,9 @@ -import * as SimplePeerNamespace from "simple-peer"; +import type * as SimplePeerNamespace from "simple-peer"; import {mediaManager} from "./MediaManager"; import {STUN_SERVER, TURN_SERVER, TURN_USER, TURN_PASSWORD} from "../Enum/EnvironmentVariable"; -import {RoomConnection} from "../Connexion/RoomConnection"; +import type {RoomConnection} from "../Connexion/RoomConnection"; import {MESSAGE_TYPE_CONSTRAINT} from "./VideoPeer"; -import {UserSimplePeerInterface} from "./SimplePeer"; +import type {UserSimplePeerInterface} from "./SimplePeer"; const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer'); diff --git a/front/src/WebRtc/SimplePeer.ts b/front/src/WebRtc/SimplePeer.ts index 3a56d20b..67e72c6d 100644 --- a/front/src/WebRtc/SimplePeer.ts +++ b/front/src/WebRtc/SimplePeer.ts @@ -1,4 +1,4 @@ -import { +import type { WebRtcDisconnectMessageInterface, WebRtcSignalReceivedMessageInterface, } from "../Connexion/ConnexionModels"; @@ -10,7 +10,7 @@ import { } from "./MediaManager"; import {ScreenSharingPeer} from "./ScreenSharingPeer"; import {MESSAGE_TYPE_BLOCKED, MESSAGE_TYPE_CONSTRAINT, MESSAGE_TYPE_MESSAGE, VideoPeer} from "./VideoPeer"; -import {RoomConnection} from "../Connexion/RoomConnection"; +import type {RoomConnection} from "../Connexion/RoomConnection"; import {connectionManager} from "../Connexion/ConnectionManager"; import {GameConnexionTypes} from "../Url/UrlManager"; import {blackListManager} from "./BlackListManager"; diff --git a/front/src/WebRtc/VideoPeer.ts b/front/src/WebRtc/VideoPeer.ts index 2952ea62..503ca0de 100644 --- a/front/src/WebRtc/VideoPeer.ts +++ b/front/src/WebRtc/VideoPeer.ts @@ -1,10 +1,10 @@ -import * as SimplePeerNamespace from "simple-peer"; +import type * as SimplePeerNamespace from "simple-peer"; import {mediaManager} from "./MediaManager"; import {STUN_SERVER, TURN_PASSWORD, TURN_SERVER, TURN_USER} from "../Enum/EnvironmentVariable"; -import {RoomConnection} from "../Connexion/RoomConnection"; +import type {RoomConnection} from "../Connexion/RoomConnection"; import {blackListManager} from "./BlackListManager"; -import {Subscription} from "rxjs"; -import {UserSimplePeerInterface} from "./SimplePeer"; +import type {Subscription} from "rxjs"; +import type {UserSimplePeerInterface} from "./SimplePeer"; const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer'); diff --git a/front/src/iframe_api.ts b/front/src/iframe_api.ts index 0bef1cc7..df37e53d 100644 --- a/front/src/iframe_api.ts +++ b/front/src/iframe_api.ts @@ -1,14 +1,14 @@ -import { ChatEvent } from "./Api/Events/ChatEvent"; +import type { ChatEvent } from "./Api/Events/ChatEvent"; import { isIframeResponseEventWrapper } from "./Api/Events/IframeEvent"; import { isUserInputChatEvent, UserInputChatEvent } from "./Api/Events/UserInputChatEvent"; import { Subject } from "rxjs"; import { EnterLeaveEvent, isEnterLeaveEvent } from "./Api/Events/EnterLeaveEvent"; -import { OpenPopupEvent } from "./Api/Events/OpenPopupEvent"; +import type { OpenPopupEvent } from "./Api/Events/OpenPopupEvent"; import { isButtonClickedEvent } from "./Api/Events/ButtonClickedEvent"; -import { ClosePopupEvent } from "./Api/Events/ClosePopupEvent"; -import { OpenTabEvent } from "./Api/Events/OpenTabEvent"; -import { GoToPageEvent } from "./Api/Events/GoToPageEvent"; -import { OpenCoWebSiteEvent } from "./Api/Events/OpenCoWebSiteEvent"; +import type { ClosePopupEvent } from "./Api/Events/ClosePopupEvent"; +import type { OpenTabEvent } from "./Api/Events/OpenTabEvent"; +import type { GoToPageEvent } from "./Api/Events/GoToPageEvent"; +import type { OpenCoWebSiteEvent } from "./Api/Events/OpenCoWebSiteEvent"; interface WorkAdventureApi { sendChatMessage(message: string, author: string): void; diff --git a/front/src/types.ts b/front/src/types.ts index 6b99434d..6b9e97e6 100644 --- a/front/src/types.ts +++ b/front/src/types.ts @@ -1,4 +1,4 @@ -import Phaser from "phaser"; +import type Phaser from "phaser"; export type CursorKey = { isDown: boolean diff --git a/front/tsconfig.json b/front/tsconfig.json index ce16ffb5..1845ee40 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -11,6 +11,8 @@ "allowJs": true, "esModuleInterop": true, + "importsNotUsedAsValues": "error", + "strict": true, /* Enable all strict type-checking options. */ "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "strictNullChecks": true, /* Enable strict null checks. */