Updates for renderer changes

This commit is contained in:
Bill 2022-11-08 17:09:35 -05:00
parent f13eb1fed4
commit b286288dbf
14 changed files with 43 additions and 43 deletions

View File

@ -1,4 +1,4 @@
import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer';
import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroConfiguration, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { DispatchUiEvent, GetCommunication, GetConfiguration, GetNitroInstance, GetUIVersion } from './api';
import { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
@ -86,7 +86,7 @@ export const App: FC<{}> = props =>
const assetUrls = GetConfiguration<string[]>('preload.assets.urls');
const urls: string[] = [];
if(assetUrls && assetUrls.length) for(const url of assetUrls) urls.push(GetNitroInstance().core.configuration.interpolate(url));
if(assetUrls && assetUrls.length) for(const url of assetUrls) urls.push(NitroConfiguration.interpolate(url));
GetNitroInstance().core.asset.downloadAssets(urls, (status: boolean) =>
{

View File

@ -3,5 +3,5 @@ import { GetNitroInstance } from './GetNitroInstance';
export function GetCommunication(): INitroCommunicationManager
{
return GetNitroInstance().communication;
return GetNitroInstance()?.communication;
}

View File

@ -1,6 +1,6 @@
import { GetNitroInstance } from './GetNitroInstance';
import { NitroConfiguration } from '@nitrots/nitro-renderer';
export function GetConfiguration<T>(key: string, value: T = null): T
{
return GetNitroInstance().getConfiguration(key, value);
return NitroConfiguration.getValue(key, value);
}

View File

@ -3,5 +3,5 @@ import { GetCommunication } from './GetCommunication';
export function GetConnection(): IConnection
{
return GetCommunication().connection;
return GetCommunication()?.connection;
}

View File

@ -1,4 +1,4 @@
import { PollQuestion } from '@nitrots/nitro-renderer';
import { IPollQuestion } from '@nitrots/nitro-renderer';
import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
export class RoomWidgetPollUpdateEvent extends RoomWidgetUpdateEvent
@ -13,7 +13,7 @@ export class RoomWidgetPollUpdateEvent extends RoomWidgetUpdateEvent
private _numQuestions = 0;
private _startMessage = '';
private _endMessage = '';
private _questionArray: PollQuestion[] = null;
private _questionArray: IPollQuestion[] = null;
private _pollType = '';
private _npsPoll = false;
@ -78,12 +78,12 @@ export class RoomWidgetPollUpdateEvent extends RoomWidgetUpdateEvent
this._endMessage = k;
}
public get questionArray(): PollQuestion[]
public get questionArray(): IPollQuestion[]
{
return this._questionArray;
}
public set questionArray(k: PollQuestion[])
public set questionArray(k: IPollQuestion[])
{
this._questionArray = k;
}

View File

@ -1,4 +1,4 @@
import { IFurnitureData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomPetData, RoomTradingLevelEnum, RoomUserData, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer';
import { IFurnitureData, IRoomModerationSettings, IRoomPetData, IRoomUserData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer';
import { GetNitroInstance, GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../nitro';
import { LocalizeText } from '../../utils';
import { AvatarInfoFurni } from './AvatarInfoFurni';
@ -170,7 +170,7 @@ export class AvatarInfoUtilities
return furniInfo;
}
public static getUserInfo(category: number, userData: RoomUserData): AvatarInfoUser
public static getUserInfo(category: number, userData: IRoomUserData): AvatarInfoUser
{
const roomSession = GetRoomSession();
@ -267,7 +267,7 @@ export class AvatarInfoUtilities
return userInfo;
}
public static getBotInfo(category: number, userData: RoomUserData): AvatarInfoUser
public static getBotInfo(category: number, userData: IRoomUserData): AvatarInfoUser
{
const roomSession = GetRoomSession();
const userInfo = new AvatarInfoUser(AvatarInfoUser.BOT);
@ -293,7 +293,7 @@ export class AvatarInfoUtilities
return userInfo;
}
public static getRentableBotInfo(category: number, userData: RoomUserData): AvatarInfoRentableBot
public static getRentableBotInfo(category: number, userData: IRoomUserData): AvatarInfoRentableBot
{
const roomSession = GetRoomSession();
const botInfo = new AvatarInfoRentableBot(AvatarInfoRentableBot.RENTABLE_BOT);
@ -319,7 +319,7 @@ export class AvatarInfoUtilities
return botInfo;
}
public static getPetInfo(petData: RoomPetData): AvatarInfoPet
public static getPetInfo(petData: IRoomPetData): AvatarInfoPet
{
const roomSession = GetRoomSession();
const userData = roomSession.userDataManager.getPetData(petData.id);
@ -387,7 +387,7 @@ export class AvatarInfoUtilities
return (userInfo.roomControllerLevel >= RoomControllerLevel.GUEST);
}
private static isValidSetting(userInfo: AvatarInfoUser, checkSetting: (userInfo: AvatarInfoUser, moderation: RoomModerationSettings) => boolean): boolean
private static isValidSetting(userInfo: AvatarInfoUser, checkSetting: (userInfo: AvatarInfoUser, moderation: IRoomModerationSettings) => boolean): boolean
{
const roomSession = GetRoomSession();
@ -404,7 +404,7 @@ export class AvatarInfoUtilities
private static canBeMuted(userInfo: AvatarInfoUser): boolean
{
const checkSetting = (userInfo: AvatarInfoUser, moderation: RoomModerationSettings) =>
const checkSetting = (userInfo: AvatarInfoUser, moderation: IRoomModerationSettings) =>
{
switch(moderation.allowMute)
{
@ -420,7 +420,7 @@ export class AvatarInfoUtilities
private static canBeKicked(userInfo: AvatarInfoUser): boolean
{
const checkSetting = (userInfo: AvatarInfoUser, moderation: RoomModerationSettings) =>
const checkSetting = (userInfo: AvatarInfoUser, moderation: IRoomModerationSettings) =>
{
switch(moderation.allowKick)
{
@ -438,7 +438,7 @@ export class AvatarInfoUtilities
private static canBeBanned(userInfo: AvatarInfoUser): boolean
{
const checkSetting = (userInfo: AvatarInfoUser, moderation: RoomModerationSettings) =>
const checkSetting = (userInfo: AvatarInfoUser, moderation: IRoomModerationSettings) =>
{
switch(moderation.allowBan)
{

View File

@ -1,4 +1,4 @@
import { PetCustomPart, PetFigureData, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
import { IPetCustomPart, PetFigureData, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
import { CSSProperties, FC, useEffect, useMemo, useRef, useState } from 'react';
import { GetRoomEngine } from '../../api';
import { Base, BaseProps } from '../Base';
@ -9,7 +9,7 @@ interface LayoutPetImageViewProps extends BaseProps<HTMLDivElement>
typeId?: number;
paletteId?: number;
petColor?: number;
customParts?: PetCustomPart[];
customParts?: IPetCustomPart[];
posture?: string;
headOnly?: boolean;
direction?: number;

View File

@ -1,6 +1,6 @@
import { RoomSessionEvent } from '@nitrots/nitro-renderer';
import { NitroConfiguration, RoomSessionEvent } from '@nitrots/nitro-renderer';
import { FC, useState } from 'react';
import { GetConfiguration, GetConfigurationManager } from '../../api';
import { GetConfiguration } from '../../api';
import { LayoutAvatarImageView } from '../../common';
import { useRoomSessionManagerEvent, useSessionInfo } from '../../hooks';
import { WidgetSlotView } from './views/widgets/WidgetSlotView';
@ -30,12 +30,12 @@ export const HotelView: FC<{}> = props =>
if(!isVisible) return null;
const backgroundColor = GetConfiguration('hotelview')['images']['background.colour'];
const background = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['background']);
const sun = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['sun']);
const drape = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['drape']);
const left = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['left']);
const rightRepeat = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['right.repeat']);
const right = GetConfigurationManager().interpolate(GetConfiguration('hotelview')['images']['right']);
const background = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['background']);
const sun = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['sun']);
const drape = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['drape']);
const left = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['left']);
const rightRepeat = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['right.repeat']);
const right = NitroConfiguration.interpolate(GetConfiguration('hotelview')['images']['right']);
return (
<div className="nitro-hotel-view" style={ (backgroundColor && backgroundColor) ? { background: backgroundColor } : {} }>

View File

@ -1,5 +1,6 @@
import { NitroConfiguration } from '@nitrots/nitro-renderer';
import { FC } from 'react';
import { GetConfigurationManager, LocalizeText, OpenUrl } from '../../../../../api';
import { LocalizeText, OpenUrl } from '../../../../../api';
export interface WidgetContainerViewProps
{
@ -19,7 +20,7 @@ export const WidgetContainerView: FC<WidgetContainerViewProps> = props =>
switch(key)
{
case 'image':
return GetConfigurationManager().interpolate(option);
return NitroConfiguration.interpolate(option);
}
return option;

View File

@ -12,7 +12,7 @@ export const RoomView: FC<{}> = props =>
useEffect(() =>
{
const canvas = GetNitroInstance().renderer.view;
const canvas = GetNitroInstance().application.renderer.view;
if(!canvas) return;

View File

@ -1,4 +1,4 @@
import { IFurnitureData, PetCustomPart, PetFigureData, RoomObjectCategory, RoomObjectVariable, RoomUserData } from '@nitrots/nitro-renderer';
import { IFurnitureData, IPetCustomPart, IRoomUserData, PetCustomPart, PetFigureData, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { FC, useEffect, useMemo, useState } from 'react';
import { FurniCategory, GetFurnitureDataForRoomObject, GetRoomEngine, LocalizeText, UseProductItem } from '../../../../api';
import { Base, Button, Column, Flex, LayoutPetImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
@ -23,7 +23,7 @@ export const AvatarInfoUseProductConfirmView: FC<AvatarInfoUseProductConfirmView
{
const { item = null, onClose = null } = props;
const [ mode, setMode ] = useState(_Str_5091);
const [ petData, setPetData ] = useState<RoomUserData>(null);
const [ petData, setPetData ] = useState<IRoomUserData>(null);
const [ furniData, setFurniData ] = useState<IFurnitureData>(null);
const { roomSession = null } = useRoom();
@ -74,7 +74,7 @@ export const AvatarInfoUseProductConfirmView: FC<AvatarInfoUseProductConfirmView
case FurniCategory.PET_CUSTOM_PART: {
if(customParts.length < 4) return null;
const newCustomParts: PetCustomPart[] = [];
const newCustomParts: IPetCustomPart[] = [];
const _local_6 = customParts[1].split(',').map(piece => parseInt(piece));
const _local_7 = customParts[2].split(',').map(piece => parseInt(piece));
@ -101,7 +101,7 @@ export const AvatarInfoUseProductConfirmView: FC<AvatarInfoUseProductConfirmView
case FurniCategory.PET_CUSTOM_PART_SHAMPOO: {
if(customParts.length < 3) return null;
const newCustomParts: PetCustomPart[] = [];
const newCustomParts: IPetCustomPart[] = [];
const _local_6 = customParts[1].split(',').map(piece => parseInt(piece));
const _local_8 = customParts[2].split(',').map(piece => parseInt(piece));
@ -127,7 +127,7 @@ export const AvatarInfoUseProductConfirmView: FC<AvatarInfoUseProductConfirmView
case FurniCategory.PET_SADDLE: {
if(customParts.length < 4) return null;
const newCustomParts: PetCustomPart[] = [];
const newCustomParts: IPetCustomPart[] = [];
const _local_6 = customParts[1].split(',').map(piece => parseInt(piece));
const _local_7 = customParts[2].split(',').map(piece => parseInt(piece));

View File

@ -199,7 +199,7 @@ const useRoomState = () =>
const canvasId = 1;
const width = Math.floor(window.innerWidth);
const height = Math.floor(window.innerHeight);
const renderer = nitroInstance.renderer;
const renderer = nitroInstance.application.renderer;
if(renderer)
{
@ -250,7 +250,7 @@ const useRoomState = () =>
geometry.location = new Vector3d(x, y, z);
}
const stage = nitroInstance.stage;
const stage = nitroInstance.application.stage;
if(!stage) return;
@ -273,7 +273,7 @@ const useRoomState = () =>
InitializeRoomInstanceRenderingCanvas(width, height, 1);
nitroInstance.render();
nitroInstance.application.render();
}
window.addEventListener('resize', resize);

View File

@ -1,6 +1,6 @@
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, GetGuestRoomResultEvent, NitroPoint, PetFigureData, RoomChatSettings, RoomChatSettingsEvent, RoomDragEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionChatEvent, RoomUserData, SystemChatStyleEnum, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
import { useEffect, useMemo, useRef, useState } from 'react';
import { ChatBubbleMessage, ChatEntryType, ChatHistoryCurrentDate, GetAvatarRenderManager, GetConfigurationManager, GetRoomEngine, GetRoomObjectScreenLocation, IRoomChatSettings, LocalizeText, PlaySound, RoomChatFormatter } from '../../../api';
import { ChatBubbleMessage, ChatEntryType, ChatHistoryCurrentDate, GetAvatarRenderManager, GetConfiguration, GetRoomEngine, GetRoomObjectScreenLocation, IRoomChatSettings, LocalizeText, PlaySound, RoomChatFormatter } from '../../../api';
import { useMessageEvent, useRoomEngineEvent, useRoomSessionManagerEvent } from '../../events';
import { useRoom } from '../useRoom';
import { useChatHistory } from './../../chat-history/useChatHistory';
@ -180,7 +180,7 @@ const useChatWidgetState = () =>
case RoomSessionChatEvent.CHAT_TYPE_RESPECT:
text = LocalizeText('widgets.chatbubble.respect', [ 'username' ], [ username ]);
if(GetConfigurationManager().getValue('respect.options')['enabled']) PlaySound(GetConfigurationManager().getValue('respect.options')['sound']);
if(GetConfiguration('respect.options')['enabled']) PlaySound(GetConfiguration('respect.options')['sound']);
break;
case RoomSessionChatEvent.CHAT_TYPE_PETREVIVE:

View File

@ -1,6 +1,5 @@
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import React from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './App';
import './index.scss';