From f446918e42b62c401d6db0bfdfa296efbe238f89 Mon Sep 17 00:00:00 2001
From: Piotr 'pwh' Hanusiak
Date: Tue, 22 Mar 2022 16:49:20 +0100
Subject: [PATCH] start normally
---
.../CustomizeWoka/WokaBodyPartSlot.ts | 13 +++++++-
front/src/Phaser/Login/CustomizeScene.ts | 32 +++++++++++++++----
front/src/Phaser/Login/EntryScene.ts | 8 ++---
3 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/front/src/Phaser/Components/CustomizeWoka/WokaBodyPartSlot.ts b/front/src/Phaser/Components/CustomizeWoka/WokaBodyPartSlot.ts
index 14fc865b..4370f1d8 100644
--- a/front/src/Phaser/Components/CustomizeWoka/WokaBodyPartSlot.ts
+++ b/front/src/Phaser/Components/CustomizeWoka/WokaBodyPartSlot.ts
@@ -10,6 +10,7 @@ export interface WokaBodyPartSlotConfig {
offsetX: number;
offsetY: number;
bodyImageKey?: string;
+ categoryImageKey?: string;
imageKey?: string;
selected?: boolean;
}
@@ -20,6 +21,7 @@ export enum WokaBodyPartSlotEvent {
export class WokaBodyPartSlot extends GridItem {
private background: Phaser.GameObjects.Graphics;
+ private categoryImage?: Phaser.GameObjects.Image;
private bodyImage: Phaser.GameObjects.Image;
private image: Phaser.GameObjects.Image;
@@ -40,6 +42,15 @@ export class WokaBodyPartSlot extends GridItem {
this.background = this.scene.add.graphics();
this.drawBackground();
+ this.add(this.background);
+
+ if (this.config.categoryImageKey) {
+ this.categoryImage = this.scene.add
+ .image(this.SIZE / 2 - 1, -this.SIZE / 2 + 1, this.config.categoryImageKey)
+ .setDisplaySize(16, 16)
+ .setOrigin(1, 0);
+ this.add(this.categoryImage);
+ }
this.bodyImage = this.scene.add
.image(offsetX, offsetY, config.bodyImageKey ?? "")
@@ -51,7 +62,7 @@ export class WokaBodyPartSlot extends GridItem {
this.setSize(this.SIZE, this.SIZE);
- this.add([this.background, this.bodyImage, this.image]);
+ this.add([this.bodyImage, this.image]);
this.setInteractive({ cursor: "pointer" });
this.scene.input.setDraggable(this);
diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts
index 4b8f141a..011f2ba5 100644
--- a/front/src/Phaser/Login/CustomizeScene.ts
+++ b/front/src/Phaser/Login/CustomizeScene.ts
@@ -137,12 +137,30 @@ export class CustomizeScene extends AbstractCharacterScene {
this.bodyPartsDraggableGridForeground = this.add.graphics();
this.bodyPartsSlots = {
- [CustomWokaBodyPart.Hair]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
- [CustomWokaBodyPart.Body]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
- [CustomWokaBodyPart.Accessory]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
- [CustomWokaBodyPart.Hat]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
- [CustomWokaBodyPart.Clothes]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
- [CustomWokaBodyPart.Eyes]: new WokaBodyPartSlot(this, 0, 0, this.getDefaultWokaBodyPartSlotConfig()),
+ [CustomWokaBodyPart.Hair]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
+ [CustomWokaBodyPart.Body]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
+ [CustomWokaBodyPart.Accessory]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
+ [CustomWokaBodyPart.Hat]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
+ [CustomWokaBodyPart.Clothes]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
+ [CustomWokaBodyPart.Eyes]: new WokaBodyPartSlot(this, 0, 0, {
+ ...this.getDefaultWokaBodyPartSlotConfig(),
+ categoryImageKey: "iconTalk",
+ }),
};
this.initializeRandomizeButton();
@@ -257,7 +275,7 @@ export class CustomizeScene extends AbstractCharacterScene {
borderColor: 0x006bb3,
},
hover: {
- color: 0x209cee,
+ color: 0x0987db,
textColor: "#ffffff",
borderThickness: 3,
borderColor: 0x006bb3,
diff --git a/front/src/Phaser/Login/EntryScene.ts b/front/src/Phaser/Login/EntryScene.ts
index d54272a9..41910f26 100644
--- a/front/src/Phaser/Login/EntryScene.ts
+++ b/front/src/Phaser/Login/EntryScene.ts
@@ -1,14 +1,12 @@
import { gameManager } from "../Game/GameManager";
import { Scene } from "phaser";
-import { ErrorScene, ErrorSceneName } from "../Reconnecting/ErrorScene";
+import { ErrorScene } from "../Reconnecting/ErrorScene";
import { WAError } from "../Reconnecting/WAError";
import { waScaleManager } from "../Services/WaScaleManager";
import { ReconnectingTextures } from "../Reconnecting/ReconnectingScene";
import LL from "../../i18n/i18n-svelte";
import { get } from "svelte/store";
import { localeDetector } from "../../i18n/locales";
-import { CustomizeSceneName } from "./CustomizeScene";
-import { SelectCharacterSceneName } from "./SelectCharacterScene";
export const EntrySceneName = "EntryScene";
@@ -46,9 +44,7 @@ export class EntryScene extends Scene {
// Let's rescale before starting the game
// We can do it at this stage.
waScaleManager.applyNewSize();
- // this.scene.start(nextSceneName);
- this.scene.start(CustomizeSceneName);
- // this.scene.start(SelectCharacterSceneName);
+ this.scene.start(nextSceneName);
})
.catch((err) => {
const $LL = get(LL);