addressed some of the requests

This commit is contained in:
Piotr 'pwh' Hanusiak 2022-04-25 14:36:05 +02:00 committed by David Négrier
parent 9e0f43d542
commit a50f7a7e9b
4 changed files with 10 additions and 7 deletions

View File

@ -62,8 +62,7 @@ export class CustomWokaPreviewer extends Phaser.GameObjects.Container {
this.turnIcon = this.scene.add this.turnIcon = this.scene.add
.image(this.background.displayWidth * 0.35, this.background.displayHeight * 0.35, "iconTurn") .image(this.background.displayWidth * 0.35, this.background.displayHeight * 0.35, "iconTurn")
.setScale(0.25) .setScale(0.25)
.setTintFill(0xffffff) .setAlpha(0.75);
.setAlpha(0.5);
this.drawFrame(); this.drawFrame();
this.setSize(this.SIZE, this.SIZE); this.setSize(this.SIZE, this.SIZE);

View File

@ -6,6 +6,7 @@ export interface IconButtonConfig {
hover: IconButtonAppearanceConfig; hover: IconButtonAppearanceConfig;
pressed: IconButtonAppearanceConfig; pressed: IconButtonAppearanceConfig;
selected: IconButtonAppearanceConfig; selected: IconButtonAppearanceConfig;
iconScale?: number;
} }
export interface IconButtonAppearanceConfig { export interface IconButtonAppearanceConfig {
@ -34,7 +35,7 @@ export class IconButton extends Phaser.GameObjects.Container {
this.config = config; this.config = config;
this.background = this.scene.add.graphics(); this.background = this.scene.add.graphics();
this.icon = this.scene.add.image(0, 0, this.config.iconTextureKey); this.icon = this.scene.add.image(0, 0, this.config.iconTextureKey).setScale(config.iconScale ?? 1);
this.drawBackground(this.config.idle); this.drawBackground(this.config.idle);
this.add([this.background, this.icon]); this.add([this.background, this.icon]);

View File

@ -213,15 +213,16 @@ export class CustomizeScene extends AbstractCharacterScene {
), ),
[CustomWokaBodyPart.Body]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconBody")), [CustomWokaBodyPart.Body]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconBody")),
[CustomWokaBodyPart.Clothes]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconClothes")), [CustomWokaBodyPart.Clothes]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconClothes")),
[CustomWokaBodyPart.Eyes]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconEyes")), [CustomWokaBodyPart.Eyes]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconEyes", 0.7)),
[CustomWokaBodyPart.Hair]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconHair")), [CustomWokaBodyPart.Hair]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconHair")),
[CustomWokaBodyPart.Hat]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconHat")), [CustomWokaBodyPart.Hat]: new IconButton(this, 0, 0, this.getDefaultIconButtonConfig("iconHat")),
}; };
} }
private getDefaultIconButtonConfig(iconTextureKey: string): IconButtonConfig { private getDefaultIconButtonConfig(iconTextureKey: string, iconScale?: number): IconButtonConfig {
return { return {
iconTextureKey, iconTextureKey,
iconScale,
width: 25, width: 25,
height: 25, height: 25,
idle: { idle: {
@ -420,7 +421,7 @@ export class CustomizeScene extends AbstractCharacterScene {
private handleRandomizeButtonOnResize(): void { private handleRandomizeButtonOnResize(): void {
const x = const x =
this.customWokaPreviewer.x + this.customWokaPreviewer.x -
(this.customWokaPreviewer.displayWidth - this.randomizeButton.displayWidth) * 0.5; (this.customWokaPreviewer.displayWidth - this.randomizeButton.displayWidth) * 0.5;
const y = const y =
this.customWokaPreviewer.y + this.customWokaPreviewer.y +
@ -431,7 +432,7 @@ export class CustomizeScene extends AbstractCharacterScene {
private handleFinishButtonOnResize(): void { private handleFinishButtonOnResize(): void {
const x = const x =
this.customWokaPreviewer.x - this.customWokaPreviewer.x +
(this.customWokaPreviewer.displayWidth - this.randomizeButton.displayWidth) * 0.5; (this.customWokaPreviewer.displayWidth - this.randomizeButton.displayWidth) * 0.5;
const y = const y =
this.customWokaPreviewer.y + this.customWokaPreviewer.y +

View File

@ -18,6 +18,7 @@ import { DraggableGrid } from "@home-based-studio/phaser3-utils";
import { WokaSlot } from "../Components/SelectWoka/WokaSlot"; import { WokaSlot } from "../Components/SelectWoka/WokaSlot";
import { DraggableGridEvent } from "@home-based-studio/phaser3-utils/lib/utils/gui/containers/grids/DraggableGrid"; import { DraggableGridEvent } from "@home-based-studio/phaser3-utils/lib/utils/gui/containers/grids/DraggableGrid";
import { wokaList } from "../../Messages/JsonMessages/PlayerTextures"; import { wokaList } from "../../Messages/JsonMessages/PlayerTextures";
import { myCameraVisibilityStore } from "../../Stores/MyCameraStoreVisibility";
//todo: put this constants in a dedicated file //todo: put this constants in a dedicated file
export const SelectCharacterSceneName = "SelectCharacterScene"; export const SelectCharacterSceneName = "SelectCharacterScene";
@ -133,6 +134,7 @@ export class SelectCharacterScene extends AbstractCharacterScene {
return; return;
} }
this.selectedWoka = null; this.selectedWoka = null;
myCameraVisibilityStore.set(false);
this.scene.sleep(SelectCharacterSceneName); this.scene.sleep(SelectCharacterSceneName);
this.scene.run(CustomizeSceneName); this.scene.run(CustomizeSceneName);
selectCharacterSceneVisibleStore.set(false); selectCharacterSceneVisibleStore.set(false);