New select woka scene (#1997)

* animated grid tiles
* change woka's category with arrow buttons
* added some dynamic effects to woka's list
* add some drag distance treshold
* do not show arrows if only one collection
* WSAD and arrow keys movement through WOKA models
* Adapting end to end tests

Co-authored-by: Piotr 'pwh' Hanusiak <p.hanusiak@workadventu.re>
Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
Piotr Hanusiak
2022-04-22 17:56:28 +02:00
committed by GitHub
parent 4ffcc3139f
commit bb3f52df37
11 changed files with 362 additions and 356 deletions
@@ -0,0 +1,35 @@
import { GridItem } from "@home-based-studio/phaser3-utils";
export class WokaSlot extends GridItem {
private sprite: Phaser.GameObjects.Sprite;
private selection: Phaser.GameObjects.Rectangle;
private readonly SIZE: number = 50;
constructor(scene: Phaser.Scene, spriteKey: string, id?: string) {
super(scene, id);
this.sprite = this.scene.add.sprite(0, 0, spriteKey);
this.selection = this.scene.add
.rectangle(0, 0, this.SIZE, this.SIZE)
.setStrokeStyle(1, 0xffffff)
.setVisible(false);
this.add([this.selection, this.sprite]);
this.setSize(this.SIZE, this.SIZE);
this.setInteractive({ cursor: "pointer" });
this.scene.input.setDraggable(this);
this.bindEventHandlers();
this.scene.add.existing(this);
}
public getSprite(): Phaser.GameObjects.Sprite {
return this.sprite;
}
public select(select: boolean = true): void {
this.selection.setVisible(select);
}
}