Wait for AvatarRenderManager

This commit is contained in:
Bill 2022-03-13 20:48:10 -04:00
parent c2762cc0d0
commit 10bb7c5aa7

View File

@ -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 { 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 { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
import { LoadingView } from './components/loading/LoadingView'; import { LoadingView } from './components/loading/LoadingView';
import { MainView } from './components/main/MainView'; 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 => export const App: FC<{}> = props =>
{ {
@ -64,7 +64,7 @@ export const App: FC<{}> = props =>
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED: case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
setMessage('Finishing Up'); setMessage('Finishing Up');
GetNitroInstance().init(); GetAvatarRenderManager().init();
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
return; return;
@ -80,6 +80,9 @@ export const App: FC<{}> = props =>
HabboWebTools.send(-1, 'client.init.handshake.fail'); HabboWebTools.send(-1, 'client.init.handshake.fail');
return; return;
case AvatarRenderEvent.AVATAR_RENDER_READY:
GetNitroInstance().init();
return;
case RoomEngineEvent.ENGINE_INITIALIZED: case RoomEngineEvent.ENGINE_INITIALIZED:
setIsReady(true); setIsReady(true);
return; return;
@ -113,6 +116,7 @@ export const App: FC<{}> = props =>
UseLocalizationEvent(NitroLocalizationEvent.LOADED, handler); UseLocalizationEvent(NitroLocalizationEvent.LOADED, handler);
UseConfigurationEvent(ConfigurationEvent.LOADED, handler); UseConfigurationEvent(ConfigurationEvent.LOADED, handler);
UseConfigurationEvent(ConfigurationEvent.FAILED, handler); UseConfigurationEvent(ConfigurationEvent.FAILED, handler);
UseAvatarEvent(AvatarRenderEvent.AVATAR_RENDER_READY, handler);
if(!WebGL.isWebGLAvailable()) if(!WebGL.isWebGLAvailable())
{ {