populating grid

This commit is contained in:
Piotr 'pwh' Hanusiak
2022-03-17 13:58:54 +01:00
parent 701c5f65cd
commit a3fcf2dc3f
3 changed files with 85 additions and 79 deletions
@@ -52,13 +52,6 @@ export class CustomWokaPreviewer extends Phaser.GameObjects.Container {
[CustomWokaBodyPart.Hat]: this.scene.add.sprite(this.config.bodyPartsOffsetX, 0, "").setVisible(false),
};
// this.updateSprite("accessory1", CustomWokaBodyPart.Accessory);
// this.updateSprite("body1", CustomWokaBodyPart.Body);
// this.updateSprite("clothes4", CustomWokaBodyPart.Clothes);
// this.updateSprite("eyes5", CustomWokaBodyPart.Eyes);
// this.updateSprite("hair3", CustomWokaBodyPart.Hair);
// this.updateSprite("hat2", CustomWokaBodyPart.Hat);
this.background = this.scene.add.graphics();
this.drawBackground();
this.setSize(this.SIZE, this.SIZE);
@@ -13,6 +13,10 @@ export interface WokaBodyPartSlotConfig {
selected?: boolean;
}
export enum WokaBodyPartSlotEvent {
Clicked = "WokaBodyPartSlotEvent:Clicked",
}
export class WokaBodyPartSlot extends GridItem {
private background: Phaser.GameObjects.Rectangle;
private bodyImage: Phaser.GameObjects.Image;
@@ -92,8 +96,7 @@ export class WokaBodyPartSlot extends GridItem {
super.bindEventHandlers();
this.on(GridItemEvent.Clicked, () => {
this.select(!this.selected);
// this.emit(CategoryGridItemEvent.Selected, this.categoryName);
this.emit(WokaBodyPartSlotEvent.Clicked, this.selected);
});
}