zooming was breaking CustomizationScene on second entry

This commit is contained in:
Piotr 'pwh' Hanusiak 2022-04-04 17:17:24 +02:00 committed by David Négrier
parent 2e28303c30
commit deaf6cd3f9
2 changed files with 5 additions and 8 deletions

View File

@ -9,7 +9,6 @@ import { areCharacterLayersValid } from "../../Connexion/LocalUser";
import { SelectCharacterSceneName } from "./SelectCharacterScene"; import { SelectCharacterSceneName } from "./SelectCharacterScene";
import { waScaleManager } from "../Services/WaScaleManager"; import { waScaleManager } from "../Services/WaScaleManager";
import { analyticsClient } from "../../Administration/AnalyticsClient"; import { analyticsClient } from "../../Administration/AnalyticsClient";
import { isMediaBreakpointUp } from "../../Utils/BreakpointsUtils";
import { PUSHER_URL } from "../../Enum/EnvironmentVariable"; import { PUSHER_URL } from "../../Enum/EnvironmentVariable";
import { import {
CustomWokaBodyPart, CustomWokaBodyPart,
@ -95,6 +94,7 @@ export class CustomizeScene extends AbstractCharacterScene {
} }
public create(): void { public create(): void {
waScaleManager.zoomModifier = 1;
this.createSlotBackgroundTextures(); this.createSlotBackgroundTextures();
this.initializeCustomWokaPreviewer(); this.initializeCustomWokaPreviewer();
this.initializeBodyPartsDraggableGrid(); this.initializeBodyPartsDraggableGrid();
@ -141,18 +141,19 @@ export class CustomizeScene extends AbstractCharacterScene {
gameManager.setCharacterLayers(layers); gameManager.setCharacterLayers(layers);
this.scene.stop(CustomizeSceneName); this.scene.stop(CustomizeSceneName);
waScaleManager.restoreZoom();
gameManager.tryResumingGame(EnableCameraSceneName); gameManager.tryResumingGame(EnableCameraSceneName);
} }
public backToPreviousScene() { public backToPreviousScene() {
this.scene.stop(CustomizeSceneName); this.scene.stop(CustomizeSceneName);
waScaleManager.restoreZoom();
this.scene.run(SelectCharacterSceneName); this.scene.run(SelectCharacterSceneName);
} }
private createSlotBackgroundTextures(): void { private createSlotBackgroundTextures(): void {
for (let i = 0; i < 4; i += 1) { for (let i = 0; i < 4; i += 1) {
if (this.textures.getTextureKeys().includes(`floorTexture${i}`)) {
continue;
}
TexturesHelper.createFloorRectangleTexture(this, `floorTexture${i}`, 50, 50, "floorTiles", i); TexturesHelper.createFloorRectangleTexture(this, `floorTexture${i}`, 50, 50, "floorTiles", i);
} }
} }
@ -467,11 +468,6 @@ export class CustomizeScene extends AbstractCharacterScene {
private bindEventHandlers(): void { private bindEventHandlers(): void {
this.bindKeyboardEventHandlers(); this.bindKeyboardEventHandlers();
this.events.addListener("wake", () => {
waScaleManager.saveZoom();
waScaleManager.zoomModifier = isMediaBreakpointUp("md") ? 3 : 1;
});
this.randomizeButton.on(Phaser.Input.Events.POINTER_UP, () => { this.randomizeButton.on(Phaser.Input.Events.POINTER_UP, () => {
this.randomizeOutfit(); this.randomizeOutfit();
this.clearGrid(); this.clearGrid();

View File

@ -9,6 +9,7 @@ import { get } from "svelte/store";
import { localeDetector } from "../../i18n/locales"; import { localeDetector } from "../../i18n/locales";
import { PlayerTextures } from "../Entity/PlayerTextures"; import { PlayerTextures } from "../Entity/PlayerTextures";
import { PUSHER_URL } from "../../Enum/EnvironmentVariable"; import { PUSHER_URL } from "../../Enum/EnvironmentVariable";
import { CustomizeSceneName } from "./CustomizeScene";
export const EntrySceneName = "EntryScene"; export const EntrySceneName = "EntryScene";