This commit is contained in:
Bill 2021-07-22 01:10:13 -04:00
parent 28804ba67a
commit 936c9ee2b7
16 changed files with 110 additions and 67 deletions

View File

@ -162,7 +162,7 @@ export class AvatarEditorUtilities
partItems.sort(this.clubItemsFirst ? this.clubSorter : this.noobSorter);
// if(this._forceSellableClothingVisibility || Nitro.instance.getConfiguration<boolean>("avatareditor.support.sellablefurni", false))
// if(this._forceSellableClothingVisibility || GetNitroInstance().getConfiguration<boolean>("avatareditor.support.sellablefurni", false))
// {
// _local_31 = (this._manager.windowManager.assets.getAssetByName("camera_zoom_in") as BitmapDataAsset);
// _local_32 = (_local_31.content as BitmapData).clone();

View File

@ -1,4 +1,4 @@
import { Nitro } from 'nitro-renderer';
import { GetNitroInstance } from '../../../api';
import { IPurse } from './IPurse';
export class Purse implements IPurse
@ -22,7 +22,7 @@ export class Purse implements IPurse
public set credits(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._credits = k;
}
@ -33,7 +33,7 @@ export class Purse implements IPurse
public set clubDays(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._clubDays = k;
}
@ -44,7 +44,7 @@ export class Purse implements IPurse
public set clubPeriods(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._clubPeriods = k;
}
@ -80,7 +80,7 @@ export class Purse implements IPurse
public set _Str_6288(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._pastClubDays = k;
}
@ -91,7 +91,7 @@ export class Purse implements IPurse
public set _Str_4605(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._pastVipDays = k;
}
@ -102,7 +102,7 @@ export class Purse implements IPurse
public set _Str_18527(k: Map<number, number>)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._activityPoints = k;
}
@ -113,14 +113,14 @@ export class Purse implements IPurse
public set _Str_4458(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._minutesUntilExpiration = k;
}
public get _Str_4458(): number
{
const k = ((Nitro.instance.time - this._lastUpdated) / (1000 * 60));
const k = ((GetNitroInstance().time - this._lastUpdated) / (1000 * 60));
const _local_2 = (this._minutesUntilExpiration - k);
return (_local_2 > 0) ? _local_2 : 0;
@ -128,7 +128,7 @@ export class Purse implements IPurse
public set _Str_6312(k: number)
{
this._lastUpdated = Nitro.instance.time;
this._lastUpdated = GetNitroInstance().time;
this._minutesSinceLastModified = k;
}

View File

@ -1,5 +1,5 @@
import { CatalogPageComposer } from 'nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { GetCatalogPageComposer } from '../../../../../api/catalog/GetCatalogPageComposer';
import { SendMessageHook } from '../../../../../hooks/messages/message-event';
import { CatalogMode } from '../../../CatalogView.types';
import { CatalogIconView } from '../../catalog-icon/CatalogIconView';
@ -17,7 +17,7 @@ export const CatalogNavigationItemView: FC<CatalogNavigationItemViewProps> = pro
setIsExpanded(true);
SendMessageHook(GetCatalogPageComposer(page.pageId, -1, CatalogMode.MODE_NORMAL));
SendMessageHook(new CatalogPageComposer(page.pageId, -1, CatalogMode.MODE_NORMAL));
}, [ isActive, page ]);
const select = useCallback(() =>
@ -28,7 +28,7 @@ export const CatalogNavigationItemView: FC<CatalogNavigationItemViewProps> = pro
{
if(prevValue === page)
{
SendMessageHook(GetCatalogPageComposer(page.pageId, -1, CatalogMode.MODE_NORMAL));
SendMessageHook(new CatalogPageComposer(page.pageId, -1, CatalogMode.MODE_NORMAL));
}
return page;

View File

@ -1,6 +1,6 @@
import { Nitro, RoomSessionEvent } from 'nitro-renderer';
import { RoomSessionEvent } from 'nitro-renderer';
import { FC, useCallback, useState } from 'react';
import { GetConfiguration } from '../../api';
import { GetConfiguration, GetNitroInstance } from '../../api';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
import { HotelViewProps } from './HotelView.types';
@ -27,12 +27,12 @@ export const HotelView: FC<HotelViewProps> = props =>
if(!isVisible) return null;
const backgroundColor = GetConfiguration('hotelview')['images']['background.colour'];
const background = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['background']);
const sun = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['sun']);
const drape = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['drape']);
const left = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['left']);
const rightRepeat = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['right.repeat']);
const right = Nitro.instance.core.configuration.interpolate(GetConfiguration('hotelview')['images']['right']);
const background = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['background']);
const sun = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['sun']);
const drape = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['drape']);
const left = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['left']);
const rightRepeat = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['right.repeat']);
const right = GetNitroInstance().core.configuration.interpolate(GetConfiguration('hotelview')['images']['right']);
return (
<div className="nitro-hotel-view" style={ (backgroundColor && backgroundColor) ? { background: backgroundColor } : {} }>

View File

@ -1,4 +1,5 @@
import { IFurnitureItemData, IObjectData, Nitro } from 'nitro-renderer';
import { IFurnitureItemData, IObjectData } from 'nitro-renderer';
import { GetNitroInstance } from '../../../api';
import { IFurnitureItem } from './IFurnitureItem';
export class FurnitureItem implements IFurnitureItem
@ -122,7 +123,7 @@ export class FurnitureItem implements IFurnitureItem
if(this._hasRentPeriodStarted)
{
time = (this._secondsToExpiration - ((Nitro.instance.time - this._expirationTimeStamp) / 1000));
time = (this._secondsToExpiration - ((GetNitroInstance().time - this._expirationTimeStamp) / 1000));
if(time < 0) time = 0;
}

View File

@ -1,5 +1,6 @@
import { Nitro, RoomSessionEvent } from 'nitro-renderer';
import { RoomSessionEvent } from 'nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { GetCommunication } from '../../api';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
import { AchievementsView } from '../achievements/AchievementsView';
import { AvatarEditorView } from '../avatar-editor/AvatarEditorView';
@ -41,7 +42,7 @@ export const MainView: FC<MainViewProps> = props =>
{
setIsReady(true);
Nitro.instance.communication.connection.onReady();
GetCommunication().connection.onReady();
}, []);
return (

View File

@ -1,5 +1,6 @@
import { NavigatorInitComposer, NavigatorSearchComposer, RoomSessionEvent } from 'nitro-renderer';
import { ILinkEventTracker, NavigatorInitComposer, NavigatorSearchComposer, RoomSessionEvent } from 'nitro-renderer';
import { FC, useCallback, useEffect, useReducer, useState } from 'react';
import { AddEventLinkTracker, RemoveLinkEventTracker } from '../../api';
import { NavigatorEvent } from '../../events';
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
import { useUiEvent } from '../../hooks/events/ui/ui-event';
@ -73,6 +74,45 @@ export const NavigatorView: FC<NavigatorViewProps> = props =>
SendMessageHook(new NavigatorSearchComposer(contextCode, searchValue));
}, []);
const linkReceived = useCallback((url: string) =>
{
const parts = url.split('/');
if(parts.length < 2) return;
switch(parts[1])
{
case 'goto':
if(parts.length > 2)
{
switch(parts[2])
{
case 'home':
//goToHomeRoom();
break;
default: {
const roomId = parseInt(parts[2]);
//if(roomId > 0) this.goToPrivateRoom(roomId);
}
}
}
return;
}
}, []);
useEffect(() =>
{
const linkTracker: ILinkEventTracker = {
linkReceived,
eventUrlPrefix: 'navigator'
};
AddEventLinkTracker(linkTracker);
return () => RemoveLinkEventTracker(linkTracker);
}, [ linkReceived]);
useEffect(() =>
{
if(!isVisible || !needsNavigatorUpdate) return;

View File

@ -1,6 +1,5 @@
import { Nitro } from 'nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { GetConfiguration } from '../../../../api';
import { GetConfiguration, GetNitroInstance } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout';
import { LocalizeText } from '../../../../utils/LocalizeText';
import { useNavigatorContext } from '../../context/NavigatorContext';
@ -26,7 +25,7 @@ export const NavigatorRoomLinkView: FC<NavigatorRoomLinkViewProps> = props =>
setRoomThumbnail(GetConfiguration<string>('image.library.url') + roomInfoData.enteredGuestRoom.officialRoomPicRef);
}
const roomLinkRaw = Nitro.instance.core.configuration.interpolate(LocalizeText('navigator.embed.src', ['roomId'], [roomInfoData.enteredGuestRoom.roomId.toString()]));
const roomLinkRaw = GetNitroInstance().core.configuration.interpolate(LocalizeText('navigator.embed.src', ['roomId'], [roomInfoData.enteredGuestRoom.roomId.toString()]));
setRoomLink(roomLinkRaw);
}, [ roomInfoData ]);

View File

@ -1,6 +1,6 @@
import { ColorConverter, Nitro, NitroAdjustmentFilter, NitroContainer, NitroSprite, NitroTexture, RoomBackgroundColorEvent, RoomEngineEvent, RoomId, RoomObjectHSLColorEnabledEvent } from 'nitro-renderer';
import { ColorConverter, NitroAdjustmentFilter, NitroContainer, NitroSprite, NitroTexture, RoomBackgroundColorEvent, RoomEngineEvent, RoomId, RoomObjectHSLColorEnabledEvent } from 'nitro-renderer';
import { FC, useCallback, useState } from 'react';
import { GetRoomEngine } from '../../api';
import { GetNitroInstance, GetRoomEngine } from '../../api';
import { UseMountEffect } from '../../hooks';
import { CreateEventDispatcherHook, useRoomEngineEvent } from '../../hooks/events';
import { useRoomContext } from './context/RoomContext';
@ -48,8 +48,8 @@ export const RoomColorView: FC<{}> = props =>
if(color === undefined) color = 0x000000;
background.tint = color;
background.width = Nitro.instance.width;
background.height = Nitro.instance.height;
background.width = GetNitroInstance().width;
background.height = GetNitroInstance().height;
}, [ getRoomBackground ]);
const updateRoomBackgroundColor = useCallback((hue: number, saturation: number, lightness: number, original: boolean = false) =>

View File

@ -1,7 +1,7 @@
import { EventDispatcher, Nitro, NitroRectangle, RoomGeometry, RoomVariableEnum, Vector3d } from 'nitro-renderer';
import { EventDispatcher, NitroRectangle, RoomGeometry, RoomVariableEnum, Vector3d } from 'nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';
import { InitializeRoomInstanceRenderingCanvas } from '../../api';
import { GetNitroInstance, InitializeRoomInstanceRenderingCanvas } from '../../api';
import { DispatchMouseEvent } from '../../api/nitro/room/DispatchMouseEvent';
import { DispatchTouchEvent } from '../../api/nitro/room/DispatchTouchEvent';
import { GetRoomEngine } from '../../api/nitro/room/GetRoomEngine';
@ -47,11 +47,11 @@ export const RoomView: FC<RoomViewProps> = props =>
setWidgetHandler(widgetHandlerManager);
Nitro.instance.renderer.resize(window.innerWidth, window.innerHeight);
GetNitroInstance().renderer.resize(window.innerWidth, window.innerHeight);
const canvasId = 1;
const displayObject = GetRoomEngine().getRoomInstanceDisplay(roomSession.roomId, canvasId, Nitro.instance.width, Nitro.instance.height, RoomGeometry.SCALE_ZOOMED_IN);
const displayObject = GetRoomEngine().getRoomInstanceDisplay(roomSession.roomId, canvasId, GetNitroInstance().width, GetNitroInstance().height, RoomGeometry.SCALE_ZOOMED_IN);
if(!displayObject) return;
@ -77,13 +77,13 @@ export const RoomView: FC<RoomViewProps> = props =>
geometry.location = new Vector3d(x, y, z);
}
const stage = Nitro.instance.stage;
const stage = GetNitroInstance().stage;
if(!stage) return;
stage.addChild(displayObject);
const canvas = Nitro.instance.renderer.view;
const canvas = GetNitroInstance().renderer.view;
if(!canvas) return;
@ -99,16 +99,16 @@ export const RoomView: FC<RoomViewProps> = props =>
window.onresize = () =>
{
Nitro.instance.renderer.resize(window.innerWidth, window.innerHeight);
GetNitroInstance().renderer.resize(window.innerWidth, window.innerHeight);
InitializeRoomInstanceRenderingCanvas(roomSession.roomId, canvasId, Nitro.instance.width, Nitro.instance.height);
InitializeRoomInstanceRenderingCanvas(roomSession.roomId, canvasId, GetNitroInstance().width, GetNitroInstance().height);
const bounds = canvas.getBoundingClientRect();
const rectangle = new NitroRectangle((bounds.x || 0), (bounds.y || 0), (bounds.width || 0), (bounds.height || 0));
widgetHandlerManager.eventDispatcher.dispatchEvent(new RoomWidgetUpdateRoomViewEvent(RoomWidgetUpdateRoomViewEvent.SIZE_CHANGED, rectangle));
Nitro.instance.render();
GetNitroInstance().render();
}
setRoomCanvas(canvas);

View File

@ -1,5 +1,5 @@
import { IFurnitureData, Nitro, NitroEvent, ObjectDataFactory, PetFigureData, PetRespectComposer, PetSupplementComposer, PetType, RoomAdsUpdateComposer, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnum, RoomWidgetEnumItemExtradataParameter, SecurityLevel, Vector3d } from 'nitro-renderer';
import { GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api';
import { IFurnitureData, NitroEvent, ObjectDataFactory, PetFigureData, PetRespectComposer, PetSupplementComposer, PetType, RoomAdsUpdateComposer, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnum, RoomWidgetEnumItemExtradataParameter, SecurityLevel, Vector3d } from 'nitro-renderer';
import { GetNitroInstance, GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api';
import { InventoryTradeRequestEvent, WiredSelectObjectEvent } from '../../../events';
import { FriendListSendFriendRequestEvent } from '../../../events/friend-list/FriendListSendFriendRequestEvent';
import { dispatchUiEvent } from '../../../hooks/events';
@ -400,7 +400,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
const expiryTime = model.getValue<number>(RoomObjectVariable.FURNITURE_EXPIRY_TIME);
const expiryTimestamp = model.getValue<number>(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP);
event.expiration = ((expiryTime < 0) ? expiryTime : Math.max(0, (expiryTime - ((Nitro.instance.time - expiryTimestamp) / 1000))));
event.expiration = ((expiryTime < 0) ? expiryTime : Math.max(0, (expiryTime - ((GetNitroInstance().time - expiryTimestamp) / 1000))));
let roomObjectImage = GetRoomEngine().getRoomObjectImage(roomId, message.id, message.category, new Vector3d(180), 64, null);

View File

@ -1,5 +1,6 @@
import { BotCommandConfigurationEvent, BotRemoveComposer, BotSkillSaveComposer, Nitro, RequestBotCommandConfigurationComposer, RoomObjectCategory, RoomObjectType } from 'nitro-renderer';
import { BotCommandConfigurationEvent, BotRemoveComposer, BotSkillSaveComposer, RequestBotCommandConfigurationComposer, RoomObjectCategory, RoomObjectType } from 'nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { GetNitroInstance } from '../../../../../../api';
import { CreateMessageHook, SendMessageHook } from '../../../../../../hooks/messages';
import { LocalizeText } from '../../../../../../utils/LocalizeText';
import { useRoomContext } from '../../../../context/RoomContext';
@ -119,7 +120,7 @@ export const AvatarInfoWidgetRentableBotView: FC<AvatarInfoWidgetRentableBotView
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DANCE, ''));
break;
case 'nux_take_tour':
Nitro.instance.createLinkEvent('help/tour');
GetNitroInstance().createLinkEvent('help/tour');
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.NUX_TAKE_TOUR, ''));
break;
case 'pick':

View File

@ -1,6 +1,6 @@
import { FixedSizeStack, Nitro, NitroPoint, NitroRectangle, RoomObjectType } from 'nitro-renderer';
import { FixedSizeStack, NitroPoint, NitroRectangle, RoomObjectType } from 'nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { GetRoomEngine, GetRoomObjectBounds, GetRoomSession, GetTicker } from '../../../../api';
import { GetNitroInstance, GetRoomEngine, GetRoomObjectBounds, GetRoomSession, GetTicker } from '../../../../api';
import { ContextMenuViewProps } from './ContextMenuView.types';
const LOCATION_STACK_SIZE: number = 25;
@ -83,8 +83,8 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
let x = (location.x - (elementRef.current.offsetWidth / 2));
let y = (deltaY + offset);
const maxLeft = ((Nitro.instance.width - elementRef.current.offsetWidth) - SPACE_AROUND_EDGES);
const maxTop = ((Nitro.instance.height - elementRef.current.offsetHeight) - SPACE_AROUND_EDGES);
const maxLeft = ((GetNitroInstance().width - elementRef.current.offsetWidth) - SPACE_AROUND_EDGES);
const maxTop = ((GetNitroInstance().height - elementRef.current.offsetHeight) - SPACE_AROUND_EDGES);
if(x < SPACE_AROUND_EDGES) x = SPACE_AROUND_EDGES;
else if(x > maxLeft) x = maxLeft;

View File

@ -1,5 +1,6 @@
import { AvatarFigurePartType, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, IAvatarFigureContainer, Nitro, NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from 'nitro-renderer';
import { AvatarFigurePartType, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, IAvatarFigureContainer, NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from 'nitro-renderer';
import { FC, KeyboardEvent, useCallback, useEffect, useState } from 'react';
import { GetNitroInstance } from '../../../../../api';
import { GetRoomEngine } from '../../../../../api/nitro/room/GetRoomEngine';
import { GetRoomSession } from '../../../../../api/nitro/session/GetRoomSession';
import { GetSessionDataManager } from '../../../../../api/nitro/session/GetSessionDataManager';
@ -49,7 +50,7 @@ export const FurnitureMannequinView: FC<{}> = props =>
{
if(mannequinData && !mannequinData.renderedFigure)
{
const figureContainer = Nitro.instance.avatar.createFigureContainer(mannequinData.figure);
const figureContainer = GetNitroInstance().avatar.createFigureContainer(mannequinData.figure);
loadMannequinFigure(figureContainer);
}
}, [loadMannequinFigure, mannequinData]);
@ -59,8 +60,8 @@ export const FurnitureMannequinView: FC<{}> = props =>
if(!mannequinData) return;
const userCanEdit = (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator);
const userGender = Nitro.instance.sessionDataManager.gender;
const userClubLevel = Nitro.instance.sessionDataManager.clubLevel;
const userGender = GetNitroInstance().sessionDataManager.gender;
const userClubLevel = GetNitroInstance().sessionDataManager.clubLevel;
if(userCanEdit)
{
@ -100,8 +101,8 @@ export const FurnitureMannequinView: FC<{}> = props =>
const gender = roomObject.model.getValue<string>(RoomObjectVariable.FURNITURE_MANNEQUIN_GENDER);
const name = roomObject.model.getValue<string>(RoomObjectVariable.FURNITURE_MANNEQUIN_NAME);
const figureContainer = Nitro.instance.avatar.createFigureContainer(figure);
const clubLevel = Nitro.instance.avatar.getFigureClubLevel(figureContainer, gender, parts);
const figureContainer = GetNitroInstance().avatar.createFigureContainer(figure);
const clubLevel = GetNitroInstance().avatar.getFigureClubLevel(figureContainer, gender, parts);
const mannequinData = new FurnitureMannequinData(widgetEvent.objectId, widgetEvent.category, name, figure, gender, clubLevel);
@ -137,11 +138,11 @@ export const FurnitureMannequinView: FC<{}> = props =>
setMannequinData(mannequinData => new FurnitureMannequinData(mannequinData.objectId, mannequinData.category, value, mannequinData.figure, mannequinData.gender, mannequinData.clubLevel, mannequinData.renderedFigure));
return;
case 'load_figure':
loadMannequinFigure(Nitro.instance.avatar.createFigureContainer(Nitro.instance.sessionDataManager.figure));
loadMannequinFigure(GetNitroInstance().avatar.createFigureContainer(GetNitroInstance().sessionDataManager.figure));
setViewMode(MannequinViewMode.SAVE);
return;
case 'back':
loadMannequinFigure(Nitro.instance.avatar.createFigureContainer(mannequinData.figure));
loadMannequinFigure(GetNitroInstance().avatar.createFigureContainer(mannequinData.figure));
setViewMode(MannequinViewMode.EDIT);
return;
case 'save_name':

View File

@ -1,6 +1,5 @@
import { Nitro } from 'nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { GetRoomEngine, GetRoomSession } from '../../../../api';
import { GetNitroInstance, GetRoomEngine, GetRoomSession } from '../../../../api';
import { ObjectLocationViewProps } from './ObjectLocationView.types';
export const ObjectLocationView: FC<ObjectLocationViewProps> = props =>
@ -41,12 +40,12 @@ export const ObjectLocationView: FC<ObjectLocationViewProps> = props =>
{
remove = true;
Nitro.instance.ticker.add(updatePosition);
GetNitroInstance().ticker.add(updatePosition);
}
return () =>
{
if(remove) Nitro.instance.ticker.remove(updatePosition);
if(remove) GetNitroInstance().ticker.remove(updatePosition);
}
}, [ updatePosition, noFollow ]);

View File

@ -1,5 +1,6 @@
import { ColorConverter, IRoomRenderingCanvas, Nitro, TextureUtils } from 'nitro-renderer';
import { ColorConverter, IRoomRenderingCanvas, TextureUtils } from 'nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { GetNitroInstance } from '../../../api';
import { RoomPreviewerViewProps } from './RoomPreviewerView.types';
export const RoomPreviewerView: FC<RoomPreviewerViewProps> = props =>
@ -56,7 +57,7 @@ export const RoomPreviewerView: FC<RoomPreviewerViewProps> = props =>
if(!renderingCanvas) setupPreviewer();
Nitro.instance.ticker.add(update);
GetNitroInstance().ticker.add(update);
function resize(): void
{
@ -76,7 +77,7 @@ export const RoomPreviewerView: FC<RoomPreviewerViewProps> = props =>
return () =>
{
Nitro.instance.ticker.remove(update);
GetNitroInstance().ticker.remove(update);
window.removeEventListener('resize', resize);
}