Making a nice "customize" button
This commit is contained in:
parent
866985326b
commit
6d0bccc0e1
8 changed files with 79 additions and 40 deletions
|
@ -5,6 +5,7 @@ import Rectangle = Phaser.GameObjects.Rectangle;
|
|||
import {LAYERS} from "../Entity/body_character";
|
||||
import Sprite = Phaser.GameObjects.Sprite;
|
||||
import Container = Phaser.GameObjects.Container;
|
||||
import {gameManager} from "../Game/GameManager";
|
||||
|
||||
export const CustomizeSceneName = "CustomizeScene";
|
||||
|
||||
|
@ -15,10 +16,6 @@ enum CustomizeTextures{
|
|||
arrowUp = "arrow_up",
|
||||
}
|
||||
|
||||
export interface CustomizeSceneInitDataInterface {
|
||||
name: string
|
||||
}
|
||||
|
||||
export class CustomizeScene extends Phaser.Scene {
|
||||
|
||||
private textField: TextField;
|
||||
|
@ -34,8 +31,6 @@ export class CustomizeScene extends Phaser.Scene {
|
|||
|
||||
private logo: Image;
|
||||
|
||||
private loginName: String;
|
||||
|
||||
private selectedLayers: Array<number> = [0];
|
||||
private containersRow: Array<Array<Container>> = new Array<Array<Container>>();
|
||||
private activeRow = 0;
|
||||
|
@ -48,10 +43,6 @@ export class CustomizeScene extends Phaser.Scene {
|
|||
});
|
||||
}
|
||||
|
||||
init({name}: CustomizeSceneInitDataInterface) {
|
||||
this.loginName = name;
|
||||
}
|
||||
|
||||
preload() {
|
||||
this.load.image(CustomizeTextures.arrowRight, "resources/objects/arrow_right.png");
|
||||
this.load.image(CustomizeTextures.icon, "resources/logos/tcm_full.png");
|
||||
|
@ -111,6 +102,19 @@ export class CustomizeScene extends Phaser.Scene {
|
|||
|
||||
this.moveLayers();
|
||||
this.input.keyboard.on('keyup-ENTER', () => {
|
||||
const layers: string[] = [];
|
||||
let i = 0;
|
||||
for (let layerItem of this.selectedLayers) {
|
||||
console.log(i, layerItem, LAYERS);
|
||||
if (layerItem !== undefined) {
|
||||
layers.push(LAYERS[i][layerItem].name);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
console.log(layers);
|
||||
gameManager.setCharacterLayers(layers);
|
||||
|
||||
return this.scene.start(EnableCameraSceneName);
|
||||
});
|
||||
|
||||
|
@ -251,10 +255,8 @@ export class CustomizeScene extends Phaser.Scene {
|
|||
const children = this.getContainerChildren(i, j);
|
||||
this.containersRow[i][j].removeAll(true);
|
||||
this.containersRow[i][j].add(children);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private reposition() {
|
||||
|
@ -280,4 +282,4 @@ export class CustomizeScene extends Phaser.Scene {
|
|||
this.arrowRight.x = this.game.renderer.width*0.9;
|
||||
this.arrowRight.y = this.game.renderer.height/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue