Select first Woka (#2180)

* Select first Woka

 - Select the first Woka in the scene

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
grégoire parant 2022-05-11 11:41:43 +02:00 committed by GitHub
parent 2ba1dad8e8
commit aea8f92e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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