diff --git a/src/App.tsx b/src/App.tsx index 2c7cbc1..b7ca530 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,39 +1,18 @@ -import -{ - GetAssetManager, - GetAvatarRenderManager, - GetCommunication, - GetConfiguration, - GetLocalizationManager, - GetRoomCameraWidgetManager, - GetRoomEngine, - GetRoomSessionManager, - GetSessionDataManager, - GetSoundManager, - GetStage, - GetTexturePool, - GetTicker, - HabboWebTools, - LegacyExternalInterface, - LoadGameUrlEvent, - NitroLogger, - NitroVersion, - PrepareRenderer, -} from '@nitrots/nitro-renderer'; +import { GetAssetManager, GetAvatarRenderManager, GetCommunication, GetConfiguration, GetLocalizationManager, GetRoomEngine, GetRoomSessionManager, GetSessionDataManager, GetSoundManager, GetStage, GetTexturePool, GetTicker, HabboWebTools, LegacyExternalInterface, LoadGameUrlEvent, NitroLogger, NitroVersion, PrepareRenderer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { GetUIVersion } from './api'; -import { MainView } from './components/MainView'; +import { Base } from './common'; import { LoadingView } from './components/loading/LoadingView'; +import { MainView } from './components/MainView'; import { useMessageEvent } from './hooks'; -import { classNames } from './layout'; NitroVersion.UI_VERSION = GetUIVersion(); -export const App: FC<{}> = (props) => +export const App: FC<{}> = props => { - const [isReady, setIsReady] = useState(false); + const [ isReady, setIsReady ] = useState(false); - useMessageEvent(LoadGameUrlEvent, (event) => + useMessageEvent(LoadGameUrlEvent, event => { const parser = event.getParser(); @@ -48,91 +27,60 @@ export const App: FC<{}> = (props) => { try { - if(!window.NitroConfig) - throw new Error('NitroConfig is not defined!'); + if(!window.NitroConfig) throw new Error('NitroConfig is not defined!'); const renderer = await PrepareRenderer({ - width: Math.floor(width), - height: Math.floor(height), - resolution: window.devicePixelRatio, + width, + height, autoDensity: true, backgroundAlpha: 0, - preference: 'webgl', - eventMode: 'none', - failIfMajorPerformanceCaveat: false, - roundPixels: true + preference: 'webgl' }); await GetConfiguration().init(); - GetTicker().maxFPS = GetConfiguration().getValue( - 'system.fps.max', - 24, - ); - NitroLogger.LOG_DEBUG = GetConfiguration().getValue( - 'system.log.debug', - true, - ); - NitroLogger.LOG_WARN = GetConfiguration().getValue( - 'system.log.warn', - false, - ); - NitroLogger.LOG_ERROR = GetConfiguration().getValue( - 'system.log.error', - false, - ); - NitroLogger.LOG_EVENTS = GetConfiguration().getValue( - 'system.log.events', - false, - ); - NitroLogger.LOG_PACKETS = GetConfiguration().getValue( - 'system.log.packets', - false, - ); + GetTicker().maxFPS = GetConfiguration().getValue('system.fps.max', 24); + NitroLogger.LOG_DEBUG = GetConfiguration().getValue('system.log.debug', true); + NitroLogger.LOG_WARN = GetConfiguration().getValue('system.log.warn', false); + NitroLogger.LOG_ERROR = GetConfiguration().getValue('system.log.error', false); + NitroLogger.LOG_EVENTS = GetConfiguration().getValue('system.log.events', false); + NitroLogger.LOG_PACKETS = GetConfiguration().getValue('system.log.packets', false); - const assetUrls = - GetConfiguration() - .getValue('preload.assets.urls') - .map((url) => GetConfiguration().interpolate(url)) ?? - []; + const assetUrls = GetConfiguration().getValue('preload.assets.urls').map(url => GetConfiguration().interpolate(url)) ?? []; - await Promise.all([ - GetRoomCameraWidgetManager().init(), - GetAssetManager().downloadAssets(assetUrls), - GetLocalizationManager().init(), - GetAvatarRenderManager().init(), - GetSoundManager().init(), - GetSessionDataManager().init(), - GetRoomSessionManager().init(), - GetCommunication().init(), - ]); + await Promise.all( + [ + GetAssetManager().downloadAssets(assetUrls), + GetLocalizationManager().init(), + GetAvatarRenderManager().init(), + GetSoundManager().init(), + GetSessionDataManager().init(), + GetRoomSessionManager().init() + ] + ); await GetRoomEngine().init(); + await GetCommunication().init(); // new GameMessageHandler(); - if(LegacyExternalInterface.available) - LegacyExternalInterface.call( - 'legacyTrack', - 'authentication', - 'authok', - [], - ); + if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); HabboWebTools.sendHeartBeat(); setInterval(() => HabboWebTools.sendHeartBeat(), 10000); - GetTicker().add((ticker) => GetRoomEngine().update(ticker)); - GetTicker().add((ticker) => renderer.render(GetStage())); - GetTicker().add((ticker) => GetTexturePool().run()); + GetTicker().add(ticker => GetRoomEngine().update(ticker)); + GetTicker().add(ticker => renderer.render(GetStage())); + GetTicker().add(ticker => GetTexturePool().run()); setIsReady(true); // handle socket close //canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST))); } - catch (err) + + catch(err) { NitroLogger.error(err); } @@ -142,15 +90,11 @@ export const App: FC<{}> = (props) => }, []); return ( -
- {!isReady && } - {isReady && } -
-
+ + { !isReady && + } + { isReady && } + + ); -}; +}; \ No newline at end of file diff --git a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx index cda9f19..0b891a7 100644 --- a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx +++ b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx @@ -19,9 +19,6 @@ export const CameraWidgetEffectListItemView: FC - asassa - (!isActive && selectEffect()) }> { isActive &&