start normally

This commit is contained in:
Piotr 'pwh' Hanusiak 2022-03-22 16:49:20 +01:00
parent dae8619a6b
commit f446918e42
3 changed files with 39 additions and 14 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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);