From 10bb7c5aa745f58128ffab71c494419e315d5e47 Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 13 Mar 2022 20:48:10 -0400 Subject: [PATCH] Wait for AvatarRenderManager --- src/App.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index a440354d..8a507fd0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,10 +1,10 @@ -import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer'; +import { AvatarRenderEvent, ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { GetCommunication, GetConfiguration, GetNitroInstance } from './api'; +import { GetAvatarRenderManager, GetCommunication, GetConfiguration, GetNitroInstance } from './api'; import { Base, TransitionAnimation, TransitionAnimationTypes } from './common'; import { LoadingView } from './components/loading/LoadingView'; import { MainView } from './components/main/MainView'; -import { DispatchUiEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks'; +import { DispatchUiEvent, UseAvatarEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks'; export const App: FC<{}> = props => { @@ -64,7 +64,7 @@ export const App: FC<{}> = props => case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED: setMessage('Finishing Up'); - GetNitroInstance().init(); + GetAvatarRenderManager().init(); if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); return; @@ -80,6 +80,9 @@ export const App: FC<{}> = props => HabboWebTools.send(-1, 'client.init.handshake.fail'); return; + case AvatarRenderEvent.AVATAR_RENDER_READY: + GetNitroInstance().init(); + return; case RoomEngineEvent.ENGINE_INITIALIZED: setIsReady(true); return; @@ -113,6 +116,7 @@ export const App: FC<{}> = props => UseLocalizationEvent(NitroLocalizationEvent.LOADED, handler); UseConfigurationEvent(ConfigurationEvent.LOADED, handler); UseConfigurationEvent(ConfigurationEvent.FAILED, handler); + UseAvatarEvent(AvatarRenderEvent.AVATAR_RENDER_READY, handler); if(!WebGL.isWebGLAvailable()) {