independent parts preview
This commit is contained in:
@@ -10,12 +10,12 @@ export enum CustomWokaBodyPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum CustomWokaBodyPartOrder {
|
export enum CustomWokaBodyPartOrder {
|
||||||
Body = 0,
|
Body,
|
||||||
Eyes = 1,
|
Eyes,
|
||||||
Hair = 2,
|
Hair,
|
||||||
Clothes = 3,
|
Clothes,
|
||||||
Hat = 4,
|
Hat,
|
||||||
Accessory = 5,
|
Accessory,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomWokaPreviewerConfig {
|
export interface CustomWokaPreviewerConfig {
|
||||||
@@ -87,7 +87,6 @@ export class CustomWokaPreviewer extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
public updateSprite(textureKey: string, bodyPart: CustomWokaBodyPart): void {
|
public updateSprite(textureKey: string, bodyPart: CustomWokaBodyPart): void {
|
||||||
this.sprites[bodyPart].setTexture(textureKey).setVisible(textureKey !== "");
|
this.sprites[bodyPart].setTexture(textureKey).setVisible(textureKey !== "");
|
||||||
console.log(this.sprites[bodyPart].texture.key);
|
|
||||||
if (textureKey === "") {
|
if (textureKey === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export class CustomizeScene extends AbstractCharacterScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public preload(): void {
|
public preload(): void {
|
||||||
|
this.input.dragDistanceThreshold = 10;
|
||||||
const wokaMetadataKey = "woka-list";
|
const wokaMetadataKey = "woka-list";
|
||||||
this.cache.json.remove(wokaMetadataKey);
|
this.cache.json.remove(wokaMetadataKey);
|
||||||
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
// FIXME: window.location.href is wrong. We need the URL of the main room (so we need to apply any redirect before!)
|
||||||
@@ -335,33 +336,17 @@ export class CustomizeScene extends AbstractCharacterScene {
|
|||||||
|
|
||||||
this.input.keyboard.on("keydown-R", () => {
|
this.input.keyboard.on("keydown-R", () => {
|
||||||
this.randomizeOutfit();
|
this.randomizeOutfit();
|
||||||
|
this.setPlayerCurrentOutfit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private randomizeOutfit(): void {
|
private randomizeOutfit(): void {
|
||||||
this.customWokaPreviewer.updateSprite(
|
for (let i = 0; i < 6; i += 1) {
|
||||||
this.layers[0][Math.floor(Math.random() * this.layers[0].length)].id,
|
this.selectedLayers[i] = Math.floor(Math.random() * this.layers[i].length);
|
||||||
CustomWokaBodyPart.Body
|
this.customWokaPreviewer.updateSprite(
|
||||||
);
|
this.layers[i][Math.floor(Math.random() * this.layers[i].length)].id,
|
||||||
this.customWokaPreviewer.updateSprite(
|
CustomWokaBodyPart[CustomWokaBodyPartOrder[i] as CustomWokaBodyPart]
|
||||||
this.layers[1][Math.floor(Math.random() * this.layers[1].length)].id,
|
);
|
||||||
CustomWokaBodyPart.Eyes
|
}
|
||||||
);
|
|
||||||
this.customWokaPreviewer.updateSprite(
|
|
||||||
this.layers[2][Math.floor(Math.random() * this.layers[2].length)].id,
|
|
||||||
CustomWokaBodyPart.Hair
|
|
||||||
);
|
|
||||||
this.customWokaPreviewer.updateSprite(
|
|
||||||
this.layers[3][Math.floor(Math.random() * this.layers[3].length)].id,
|
|
||||||
CustomWokaBodyPart.Clothes
|
|
||||||
);
|
|
||||||
this.customWokaPreviewer.updateSprite(
|
|
||||||
this.layers[4][Math.floor(Math.random() * this.layers[4].length)].id,
|
|
||||||
CustomWokaBodyPart.Hat
|
|
||||||
);
|
|
||||||
this.customWokaPreviewer.updateSprite(
|
|
||||||
this.layers[5][Math.floor(Math.random() * this.layers[5].length)].id,
|
|
||||||
CustomWokaBodyPart.Accessory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user