Fix: crash while lazy loading player textures upstream#591

This commit is contained in:
Ludwig Behm 2021-01-14 14:04:58 +01:00
parent dbc4736282
commit 35c1013bbb

View file

@ -35,7 +35,7 @@ export const lazyLoadPlayerCharacterTextures = (loadPlugin: LoaderPlugin, textur
const textureName = typeof textureKey === 'string' ? textureKey : textureKey.name;
if(!texturePlugin.exists(textureName)) {
console.log('Loading '+textureName)
const playerResourceDescriptor = typeof textureKey !== 'string' && textureKey.img ? textureKey : getRessourceDescriptor(textureKey as unknown as string);
const playerResourceDescriptor = typeof textureKey !== 'string' && textureKey.img ? textureKey : getRessourceDescriptor((typeof textureKey == 'object') ? textureKey.name : textureKey as unknown as string);
promisesList.push(createLoadingPromise(loadPlugin, playerResourceDescriptor));
}
})
@ -68,4 +68,4 @@ const createLoadingPromise = (loadPlugin: LoaderPlugin, playerResourceDescriptor
loadPlugin.spritesheet(playerResourceDescriptor.name, playerResourceDescriptor.img, {frameWidth: 32, frameHeight: 32});
loadPlugin.once('filecomplete-spritesheet-'+playerResourceDescriptor.name, () => res());
});
}
}