From aea8f92e68dbd53e002356d25f93bdc30cadeab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gr=C3=A9goire=20parant?= Date: Wed, 11 May 2022 11:41:43 +0200 Subject: [PATCH] Select first Woka (#2180) * Select first Woka - Select the first Woka in the scene Signed-off-by: Gregoire Parant --- front/src/Phaser/Login/SelectCharacterScene.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index 4f1316b0..b6d0b207 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -193,7 +193,6 @@ export class SelectCharacterScene extends AbstractCharacterScene { } catch (error) { console.warn(error); } - this.charactersDraggableGrid.setItemsInRow(this.gridRowsCount); this.populateGrid(); } @@ -203,12 +202,20 @@ export class SelectCharacterScene extends AbstractCharacterScene { this.selectedWoka = null; this.charactersDraggableGrid.clearAllItems(); const textures = this.playerTextures.getWokaCollectionTextures(this.getSelectedCollectionName()); + + let currentSelectedItem = null; for (let i = 0; i < textures.length; i += 1) { const slot = new WokaSlot(this, textures[i].id).setDisplaySize(wokaDimension, wokaDimension); + + //ini current Select Item to the first + if (i === 0) currentSelectedItem = slot; + this.charactersDraggableGrid.addItem(slot); } this.charactersDraggableGrid.moveContentToBeginning(); - void this.charactersDraggableGrid.moveContentTo(0.5, textures.length * 50); + + //Select the first Woka + if (currentSelectedItem) this.selectGridItem(currentSelectedItem); } private bindEventHandlers(): void {