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:
parent
2ba1dad8e8
commit
aea8f92e68
@ -193,7 +193,6 @@ export class SelectCharacterScene extends AbstractCharacterScene {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
}
|
}
|
||||||
this.charactersDraggableGrid.setItemsInRow(this.gridRowsCount);
|
|
||||||
this.populateGrid();
|
this.populateGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,12 +202,20 @@ export class SelectCharacterScene extends AbstractCharacterScene {
|
|||||||
this.selectedWoka = null;
|
this.selectedWoka = null;
|
||||||
this.charactersDraggableGrid.clearAllItems();
|
this.charactersDraggableGrid.clearAllItems();
|
||||||
const textures = this.playerTextures.getWokaCollectionTextures(this.getSelectedCollectionName());
|
const textures = this.playerTextures.getWokaCollectionTextures(this.getSelectedCollectionName());
|
||||||
|
|
||||||
|
let currentSelectedItem = null;
|
||||||
for (let i = 0; i < textures.length; i += 1) {
|
for (let i = 0; i < textures.length; i += 1) {
|
||||||
const slot = new WokaSlot(this, textures[i].id).setDisplaySize(wokaDimension, wokaDimension);
|
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.addItem(slot);
|
||||||
}
|
}
|
||||||
this.charactersDraggableGrid.moveContentToBeginning();
|
this.charactersDraggableGrid.moveContentToBeginning();
|
||||||
void this.charactersDraggableGrid.moveContentTo(0.5, textures.length * 50);
|
|
||||||
|
//Select the first Woka
|
||||||
|
if (currentSelectedItem) this.selectGridItem(currentSelectedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bindEventHandlers(): void {
|
private bindEventHandlers(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user