Turning the "importsNotUsedAsValues" TS config value to "error". This will require us to use `import type` instead of `import` when we are importing a value that is only used as a type (and therefore that is dropped by the Typescript compiler). Why this change? This is a requirement to be able to use Svelte in the future. See https://github.com/sveltejs/svelte-preprocess/issues/206#issuecomment-663193798
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import {ResizableScene} from "./ResizableScene";
|
|
import {localUserStore} from "../../Connexion/LocalUserStore";
|
|
import type {BodyResourceDescriptionInterface} from "../Entity/PlayerTextures";
|
|
import {loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
|
import type {CharacterTexture} from "../../Connexion/LocalUser";
|
|
|
|
export abstract class AbstractCharacterScene extends ResizableScene {
|
|
|
|
loadCustomSceneSelectCharacters() : Promise<BodyResourceDescriptionInterface[]> {
|
|
const textures = this.getTextures();
|
|
const promises : Promise<BodyResourceDescriptionInterface>[] = [];
|
|
if (textures) {
|
|
for (const texture of textures) {
|
|
if (texture.level === -1) {
|
|
continue;
|
|
}
|
|
promises.push(loadCustomTexture(this.load, texture));
|
|
}
|
|
}
|
|
return Promise.all(promises)
|
|
}
|
|
|
|
loadSelectSceneCharacters() : Promise<BodyResourceDescriptionInterface[]> {
|
|
const textures = this.getTextures();
|
|
const promises: Promise<BodyResourceDescriptionInterface>[] = [];
|
|
if (textures) {
|
|
for (const texture of textures) {
|
|
if (texture.level !== -1) {
|
|
continue;
|
|
}
|
|
promises.push(loadCustomTexture(this.load, texture));
|
|
}
|
|
}
|
|
return Promise.all(promises)
|
|
}
|
|
|
|
private getTextures() : CharacterTexture[]|undefined{
|
|
const localUser = localUserStore.getLocalUser();
|
|
return localUser?.textures;
|
|
}
|
|
}
|