🆙 Even more updates

This commit is contained in:
DuckieTM
2025-03-09 11:56:32 +01:00
parent 791309ff73
commit beac15e20a
5 changed files with 36 additions and 45 deletions
+19 -22
View File
@@ -99,37 +99,34 @@ export class AssetManager implements IAssetManager
{
if(!url || !url.length) return false;
const response = await fetch(url);
if(!response || response.status !== 200) return false;
const contentType = response.headers.get('Content-Type');
switch(contentType)
if(url.endsWith('.nitro') || url.endsWith('.gif'))
{
case 'application/octet-stream': {
const buffer = await response.arrayBuffer();
const nitroBundle = await NitroBundle.from(buffer);
const response = await fetch(url);
if(!response || response.status !== 200) return false;
const arrayBuffer = await response.arrayBuffer();
if(url.endsWith('.nitro'))
{
const nitroBundle = await NitroBundle.from(arrayBuffer);
await this.processAsset(nitroBundle.texture, nitroBundle.jsonFile as IAssetData);
break;
}
case 'image/png':
case 'image/jpeg': {
const texture = await Assets.load<Texture>(url);
if(texture) this.setTexture(url, texture);
break;
}
case 'image/gif': {
const buffer = await response.arrayBuffer();
const animatedGif = AnimatedGIF.fromBuffer(buffer);
else
{
const animatedGif = AnimatedGIF.fromBuffer(arrayBuffer);
const texture = animatedGif.texture;
if(texture) this.setTexture(url, texture);
break;
}
}
else
{
const texture = await Assets.load<Texture>(url);
if(texture) this.setTexture(url, texture);
}
return true;
}