Customise characters with admin console
- Add new characters choise - Display on 3 line of 6 pers - Add custom characters from admin console wilth level -1
This commit is contained in:
parent
648e6aef97
commit
f8d4b696e8
@ -18,6 +18,7 @@ export const PLAYER_RESOURCES: BodyResourceDescriptionListInterface = {
|
||||
"male6": {name: "male6", img: "resources/characters/pipoya/Male 17-2.png"},
|
||||
"male7": {name: "male7", img: "resources/characters/pipoya/Male 18-1.png"},
|
||||
"male8": {name: "male8", img: "resources/characters/pipoya/Male 16-4.png"},
|
||||
"male9": {name: "male9", img: "resources/characters/pipoya/Teacher male 02.png"},
|
||||
"Female1": {name: "Female1", img: "resources/characters/pipoya/Female 01-1.png"},
|
||||
"Female2": {name: "Female2", img: "resources/characters/pipoya/Female 02-2.png"},
|
||||
"Female3": {name: "Female3", img: "resources/characters/pipoya/Female 03-4.png"},
|
||||
@ -25,7 +26,8 @@ export const PLAYER_RESOURCES: BodyResourceDescriptionListInterface = {
|
||||
"Female5": {name: "Female5", img: "resources/characters/pipoya/Female 10-3.png"},
|
||||
"Female6": {name: "Female6", img: "resources/characters/pipoya/Female 17-2.png"},
|
||||
"Female7": {name: "Female7", img: "resources/characters/pipoya/Female 18-1.png"},
|
||||
"Female8": {name: "Female8", img: "resources/characters/pipoya/Female 16-4.png"}
|
||||
"Female8": {name: "Female8", img: "resources/characters/pipoya/Female 16-4.png"},
|
||||
"Female9": {name: "Female9", img: "resources/characters/pipoya/Female 07-2.png"}
|
||||
};
|
||||
|
||||
export const COLOR_RESOURCES: BodyResourceDescriptionListInterface = {
|
||||
|
@ -26,9 +26,9 @@ export const loadAllDefaultModels = (load: LoaderPlugin): BodyResourceDescriptio
|
||||
export const loadCustomTexture = (load: LoaderPlugin, texture: CharacterTexture) => {
|
||||
const name = 'customCharacterTexture'+texture.id;
|
||||
load.spritesheet(name,texture.url,{frameWidth: 32, frameHeight: 32});
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
export const lazyLoadPlayerCharacterTextures = (loadPlugin: LoaderPlugin, texturePlugin: TextureManager, texturekeys:Array<string|BodyResourceDescriptionInterface>): Promise<string[]> => {
|
||||
const promisesList:Promise<void>[] = [];
|
||||
texturekeys.forEach((textureKey: string|BodyResourceDescriptionInterface) => {
|
||||
|
@ -60,6 +60,9 @@ export class CustomizeScene extends ResizableScene {
|
||||
const textures = localUser?.textures;
|
||||
if (textures) {
|
||||
for (const texture of textures) {
|
||||
if(texture.level === -1){
|
||||
continue;
|
||||
}
|
||||
loadCustomTexture(this.load, texture);
|
||||
const name = 'customCharacterTexture'+texture.id;
|
||||
this.layers[texture.level].unshift({
|
||||
|
@ -6,7 +6,7 @@ import {EnableCameraSceneName} from "./EnableCameraScene";
|
||||
import {CustomizeSceneName} from "./CustomizeScene";
|
||||
import {ResizableScene} from "./ResizableScene";
|
||||
import {localUserStore} from "../../Connexion/LocalUserStore";
|
||||
import {loadAllDefaultModels} from "../Entity/PlayerTexturesLoadingManager";
|
||||
import {loadAllDefaultModels, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
||||
import {addLoader} from "../Components/Loader";
|
||||
import {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures";
|
||||
|
||||
@ -22,7 +22,7 @@ enum LoginTextures {
|
||||
}
|
||||
|
||||
export class SelectCharacterScene extends ResizableScene {
|
||||
private readonly nbCharactersPerRow = 4;
|
||||
private readonly nbCharactersPerRow = 6;
|
||||
private textField!: TextField;
|
||||
private pressReturnField!: TextField;
|
||||
private logo!: Image;
|
||||
@ -51,6 +51,18 @@ export class SelectCharacterScene extends ResizableScene {
|
||||
this.playerModels = loadAllDefaultModels(this.load);
|
||||
this.load.image(LoginTextures.customizeButton, 'resources/objects/customize.png');
|
||||
this.load.image(LoginTextures.customizeButtonSelected, 'resources/objects/customize_selected.png');
|
||||
|
||||
const localUser = localUserStore.getLocalUser();
|
||||
const textures = localUser?.textures;
|
||||
if (textures) {
|
||||
for (const texture of textures) {
|
||||
if(texture.level !== -1){
|
||||
continue;
|
||||
}
|
||||
const name = loadCustomTexture(this.load, texture);
|
||||
this.playerModels.push({name: name, img: texture.url});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user