This commit is contained in:
billsonnn 2024-03-30 17:39:35 -04:00
parent 0a15fcd926
commit 036a03f7d0
10 changed files with 22 additions and 28 deletions

View File

@ -40,6 +40,8 @@ export class AssetManager implements IAssetManager
return existing;
}
NitroLogger.warn(`AssetManager: Asset not found: ${name}`);
return null;
}
@ -76,13 +78,9 @@ export class AssetManager implements IAssetManager
{
if(!urls || !urls.length) return Promise.resolve(true);
const promises: Promise<boolean>[] = [];
for(const url of urls) promises.push(this.downloadAsset(url));
try
{
await Promise.all(promises);
await Promise.all(urls.map(url => this.downloadAsset(url)));
return true;
}
@ -112,22 +110,12 @@ export class AssetManager implements IAssetManager
const response = await fetch(url);
if(response.status !== 200) return false;
if(response.status !== 200 || !response.headers.has('Content-Type') || response.headers.get('Content-Type') !== 'application/octet-stream') return false;
let contentType = 'application/octet-stream';
const buffer = await response.arrayBuffer();
const nitroBundle = await NitroBundle.from(buffer);
if(response.headers.has('Content-Type')) contentType = response.headers.get('Content-Type');
switch(contentType)
{
case 'application/octet-stream': {
const buffer = await response.arrayBuffer();
const nitroBundle = await NitroBundle.from(buffer);
await this.processAsset(nitroBundle.texture, nitroBundle.jsonFile as IAssetData);
break;
}
}
await this.processAsset(nitroBundle.texture, nitroBundle.jsonFile as IAssetData);
return true;
}

View File

@ -3,8 +3,6 @@ import { AvatarRenderLibraryEvent, GetEventDispatcher, NitroEventType } from '@n
export class AvatarAssetDownloadLibrary implements IAvatarAssetDownloadLibrary
{
public static DOWNLOAD_COMPLETE: string = 'AADL_DOWNLOAD_COMPLETE';
private static NOT_LOADED: number = 0;
private static LOADING: number = 1;
private static LOADED: number = 2;

View File

@ -7,7 +7,8 @@ export class ExpressionAddition implements IExpressionAddition
constructor(
private _id: number,
private _type: number,
private _visualization: AvatarVisualization) {}
private _visualization: AvatarVisualization)
{}
public dispose(): void
{

View File

@ -21,7 +21,8 @@ export class FloatingIdleZAddition implements IAvatarAddition
constructor(
private _id: number,
private _visualization: AvatarVisualization) {}
private _visualization: AvatarVisualization)
{}
public dispose(): void
{

View File

@ -13,7 +13,8 @@ export class GameClickTargetAddition implements IAvatarAddition
private _asset: Texture = null;
constructor(
private _id: number) {}
private _id: number)
{}
public dispose(): void
{

View File

@ -12,7 +12,8 @@ export class GuideStatusBubbleAddition implements IAvatarAddition
constructor(
private _id: number,
private _visualization: AvatarVisualization,
private _status: number) {}
private _status: number)
{}
public dispose(): void
{

View File

@ -10,7 +10,8 @@ export class MutedBubbleAddition implements IAvatarAddition
constructor(
private _id: number,
private _visualization: AvatarVisualization) {}
private _visualization: AvatarVisualization)
{}
public dispose(): void
{

View File

@ -15,7 +15,8 @@ export class NumberBubbleAddition implements IAvatarAddition
constructor(
private _id: number,
private _number: number,
private _visualization: AvatarVisualization) {}
private _visualization: AvatarVisualization)
{}
public dispose(): void
{

View File

@ -11,7 +11,8 @@ export class TypingBubbleAddition implements IAvatarAddition
constructor(
private _id: number,
private _visualization: AvatarVisualization) {}
private _visualization: AvatarVisualization)
{}
public dispose(): void
{

View File

@ -114,6 +114,7 @@ export class RoomPlane implements IRoomPlane
{
//@ts-ignore
if(this._planeTexture.source?.hitMap) this._planeTexture.source.hitMap = null;
this._planeTexture.destroy(true);
this._planeTexture = null;