added basic WA.camera commands

This commit is contained in:
Hanusiak Piotr 2021-12-16 13:41:28 +01:00
parent 99ffb7b450
commit 5f26a39a5d
9 changed files with 112 additions and 4 deletions

View file

@ -79,10 +79,10 @@ export class CameraManager extends Phaser.Events.EventEmitter {
);
}
public leaveFocusMode(player: Player): void {
public leaveFocusMode(player: Player, duration: number = 1000): void {
this.waScaleManager.setFocusTarget();
this.startFollow(player, 1000);
this.restoreZoom(1000);
this.startFollow(player, duration);
this.restoreZoom(duration);
}
public startFollow(target: object | Phaser.GameObjects.GameObject, duration: number = 0): void {

View file

@ -1070,6 +1070,29 @@ ${escapedMessage}
})
);
this.iframeSubscriptionList.push(
iframeListener.cameraSetPositionStream.subscribe((cameraSetPositionEvent) => {
// this.cameraManager.enterFocusMode({ ...cameraSetPositionEvent }, undefined, cameraSetPositionEvent.smooth ? 1000 : 0);
console.log("camera set position");
})
);
this.iframeSubscriptionList.push(
iframeListener.cameraFocusOnStream.subscribe((cameraFocusOnEvent) => {
this.cameraManager.enterFocusMode(
{ ...cameraFocusOnEvent },
undefined,
cameraFocusOnEvent.smooth ? 1000 : 0
);
})
);
this.iframeSubscriptionList.push(
iframeListener.cameraFollowPlayerStream.subscribe((cameraFollowPlayerEvent) => {
this.cameraManager.leaveFocusMode(this.CurrentPlayer, cameraFollowPlayerEvent.smooth ? 1000 : 0);
})
);
this.iframeSubscriptionList.push(
iframeListener.playSoundStream.subscribe((playSoundEvent) => {
const url = new URL(playSoundEvent.url, this.MapUrlFile);