From cfcea786fa6be12ab2b487d2acf7336b399cc7ad Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 13 Aug 2021 02:56:26 -0400 Subject: [PATCH] Update API --- src/App.tsx | 8 ++++++-- src/api/navigator/VisitRoom.ts | 6 ------ src/api/nitro/session/CreateRoomSession.ts | 6 ++++++ src/api/nitro/session/GoToDesktop.ts | 7 +++++++ src/api/nitro/session/index.ts | 2 ++ src/views/toolbar/ToolbarView.tsx | 10 +++++----- 6 files changed, 26 insertions(+), 13 deletions(-) delete mode 100644 src/api/navigator/VisitRoom.ts create mode 100644 src/api/nitro/session/CreateRoomSession.ts create mode 100644 src/api/nitro/session/GoToDesktop.ts diff --git a/src/App.tsx b/src/App.tsx index 8a9c2f2c..6b759d0e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { ConfigurationEvent, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer'; +import { ConfigurationEvent, 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 { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event'; @@ -17,7 +17,11 @@ export const App: FC<{}> = props => //@ts-ignore if(!NitroConfig) throw new Error('NitroConfig is not defined!'); - if(!GetNitroInstance()) Nitro.bootstrap(); + if(!GetNitroInstance()) + { + NitroVersion.UI_VERSION = '2.0.0'; + Nitro.bootstrap(); + } const getPreloadAssetUrls = useCallback(() => { diff --git a/src/api/navigator/VisitRoom.ts b/src/api/navigator/VisitRoom.ts deleted file mode 100644 index 9448f66d..00000000 --- a/src/api/navigator/VisitRoom.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { GetRoomSessionManager } from '../nitro'; - -export function VisitRoom(roomId: number, password: string = null): void -{ - GetRoomSessionManager().createSession(roomId, password); -} diff --git a/src/api/nitro/session/CreateRoomSession.ts b/src/api/nitro/session/CreateRoomSession.ts new file mode 100644 index 00000000..3be6a8ab --- /dev/null +++ b/src/api/nitro/session/CreateRoomSession.ts @@ -0,0 +1,6 @@ +import { GetRoomSessionManager } from './GetRoomSessionManager'; + +export function CreateRoomSession(roomId: number, password: string = null): void +{ + GetRoomSessionManager().createSession(roomId, password); +} diff --git a/src/api/nitro/session/GoToDesktop.ts b/src/api/nitro/session/GoToDesktop.ts new file mode 100644 index 00000000..4617043c --- /dev/null +++ b/src/api/nitro/session/GoToDesktop.ts @@ -0,0 +1,7 @@ +import { DesktopViewComposer } from '@nitrots/nitro-renderer'; +import { SendMessageHook } from '../../../hooks'; + +export function GoToDesktop(): void +{ + SendMessageHook(new DesktopViewComposer()); +} diff --git a/src/api/nitro/session/index.ts b/src/api/nitro/session/index.ts index 31861a96..5409266d 100644 --- a/src/api/nitro/session/index.ts +++ b/src/api/nitro/session/index.ts @@ -1,4 +1,5 @@ export * from './CanManipulateFurniture'; +export * from './CreateRoomSession'; export * from './GetCanStandUp'; export * from './GetCanUseExpression'; export * from './GetClubMemberLevel'; @@ -9,6 +10,7 @@ export * from './GetProductDataForLocalization'; export * from './GetRoomSession'; export * from './GetRoomSessionManager'; export * from './GetSessionDataManager'; +export * from './GoToDesktop'; export * from './HasHabboClub'; export * from './HasHabboVip'; export * from './IsOwnerOfFurniture'; diff --git a/src/views/toolbar/ToolbarView.tsx b/src/views/toolbar/ToolbarView.tsx index 0fcd77a0..7445958f 100644 --- a/src/views/toolbar/ToolbarView.tsx +++ b/src/views/toolbar/ToolbarView.tsx @@ -1,12 +1,12 @@ -import { DesktopViewComposer, Dispose, DropBounce, EaseOut, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserFigureEvent, UserInfoDataParser, UserInfoEvent, Wait } from '@nitrots/nitro-renderer'; +import { Dispose, DropBounce, EaseOut, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserFigureEvent, UserInfoDataParser, UserInfoEvent, Wait } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { GetRoomSession, GetRoomSessionManager } from '../../api'; +import { GetRoomSession, GetRoomSessionManager, GoToDesktop } from '../../api'; import { AvatarEditorEvent, CatalogEvent, FriendListEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events'; import { AchievementsUIEvent } from '../../events/achievements'; import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent'; import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent'; import { dispatchUiEvent, useRoomEngineEvent, useUiEvent } from '../../hooks'; -import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; +import { CreateMessageHook } from '../../hooks/messages/message-event'; import { TransitionAnimation } from '../../layout/transitions/TransitionAnimation'; import { TransitionAnimationTypes } from '../../layout/transitions/TransitionAnimation.types'; import { AvatarImageView } from '../shared/avatar-image/AvatarImageView'; @@ -128,8 +128,8 @@ export const ToolbarView: FC = props => const visitDesktop = useCallback(() => { if(!GetRoomSession()) return; - - SendMessageHook(new DesktopViewComposer()); + + GoToDesktop(); GetRoomSessionManager().removeSession(-1); }, []);