🆙 Updates

- Added Test Coverage
- Fix Potential Memory Leaks
This commit is contained in:
DuckieTM
2026-01-31 13:21:59 +01:00
parent e263ce59bf
commit eb4fe80612
18 changed files with 1689 additions and 110 deletions
+20 -2
View File
@@ -24,6 +24,7 @@ export class AvatarRenderManager implements IAvatarRenderManager
private _effectAssetDownloadManager: EffectAssetDownloadManager = new EffectAssetDownloadManager(GetAssetManager(), this._structure);
private _placeHolderFigure: AvatarFigureContainer = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE);
private _aliasResetCallback: () => void = null;
public async init(): Promise<void>
{
@@ -37,13 +38,30 @@ export class AvatarRenderManager implements IAvatarRenderManager
this._aliasCollection.init();
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_ASSET_LOADED, () => this._aliasCollection.reset());
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_EFFECT_LOADED, () => this._aliasCollection.reset());
// Store callback for cleanup
this._aliasResetCallback = () => this._aliasCollection.reset();
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_ASSET_LOADED, this._aliasResetCallback);
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_EFFECT_LOADED, this._aliasResetCallback);
await this._avatarAssetDownloadManager.init();
await this._effectAssetDownloadManager.init();
}
public dispose(): void
{
// Remove event listeners
if(this._aliasResetCallback)
{
GetEventDispatcher().removeEventListener(NitroEventType.AVATAR_ASSET_LOADED, this._aliasResetCallback);
GetEventDispatcher().removeEventListener(NitroEventType.AVATAR_EFFECT_LOADED, this._aliasResetCallback);
this._aliasResetCallback = null;
}
// Dispose download managers
this._avatarAssetDownloadManager?.dispose();
this._effectAssetDownloadManager?.dispose();
}
private async loadActions(): Promise<void>
{
const defaultActions = GetConfiguration().getValue<string>('avatar.default.actions');