created interface to implement for UserInputManager

This commit is contained in:
Hanusiak Piotr 2022-01-17 11:16:42 +01:00
parent b1cad1e5d3
commit 173d10738d
4 changed files with 90 additions and 44 deletions

View file

@ -90,6 +90,7 @@ import FILE_LOAD_ERROR = Phaser.Loader.Events.FILE_LOAD_ERROR;
import { MapStore } from "../../Stores/Utils/MapStore";
import { followUsersColorStore } from "../../Stores/FollowStore";
import Camera = Phaser.Cameras.Scene2D.Camera;
import { GameSceneUserInputHandler } from "../UserInput/GameSceneUserInputHandler";
export interface GameSceneInitInterface {
initPosition: PointInterface | null;
@ -548,7 +549,7 @@ export class GameScene extends DirtyScene {
this.MapPlayers = this.physics.add.group({ immovable: true });
//create input to move
this.userInputManager = new UserInputManager(this);
this.userInputManager = new UserInputManager(this, new GameSceneUserInputHandler(this));
mediaManager.setUserInputManager(this.userInputManager);
if (localUserStore.getFullscreen()) {
@ -607,10 +608,6 @@ export class GameScene extends DirtyScene {
scriptPromises.push(iframeListener.registerScript(script, !disableModuleMode));
}
this.userInputManager.spaceEvent(() => {
this.outlinedItem?.activate();
});
this.reposition();
// From now, this game scene will be notified of reposition events
@ -679,6 +676,10 @@ export class GameScene extends DirtyScene {
);
}
public activateOutlinedItem(): void {
this.outlinedItem?.activate();
}
/**
* Initializes the connection to Pusher.
*/