mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Update events
This commit is contained in:
parent
79b0a8e232
commit
bc9d0aa4a1
@ -1,4 +1,4 @@
|
|||||||
import { IRoomSession, RoomEngineEvent, RoomId, RoomSessionErrorMessageEvent, RoomSessionEvent } from 'nitro-renderer';
|
import { IRoomSession, RoomEngineEvent, RoomId, RoomSessionEvent } from 'nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { SetActiveRoomId } from '../../api/nitro/room/SetActiveRoomId';
|
import { SetActiveRoomId } from '../../api/nitro/room/SetActiveRoomId';
|
||||||
import { GetRoomSession } from '../../api/nitro/session/GetRoomSession';
|
import { GetRoomSession } from '../../api/nitro/session/GetRoomSession';
|
||||||
@ -51,24 +51,6 @@ export const RoomHostView: FC<RoomHostViewProps> = props =>
|
|||||||
useRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
|
useRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
|
useRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
|
||||||
|
|
||||||
const onRoomSessionErrorMessageEvent = useCallback((event: RoomSessionErrorMessageEvent) =>
|
|
||||||
{
|
|
||||||
console.log(event);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_KICKED, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_FLAT, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_PETS, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_NUMBER_OF_OWN_PETS, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_NO_FREE_TILES_FOR_PET, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_PET, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_FLAT, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_LIMIT_REACHED, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT, onRoomSessionErrorMessageEvent);
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_NAME_NOT_ACCEPTED, onRoomSessionErrorMessageEvent);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="nitro-room-host w-100 h-100">
|
<div className="nitro-room-host w-100 h-100">
|
||||||
<RoomView roomSession={ roomSession } />
|
<RoomView roomSession={ roomSession } />
|
||||||
|
@ -6,8 +6,6 @@ import { CreateEventDispatcherHook, useRoomEngineEvent } from '../../hooks/event
|
|||||||
import { useRoomContext } from './context/RoomContext';
|
import { useRoomContext } from './context/RoomContext';
|
||||||
import { RoomWidgetUpdateRoomViewEvent } from './events/RoomWidgetUpdateRoomViewEvent';
|
import { RoomWidgetUpdateRoomViewEvent } from './events/RoomWidgetUpdateRoomViewEvent';
|
||||||
|
|
||||||
const ROOM_FILTER: NitroAdjustmentFilter = new NitroAdjustmentFilter();
|
|
||||||
|
|
||||||
export const RoomColorView: FC<{}> = props =>
|
export const RoomColorView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const [ roomBackground, setRoomBackground ] = useState<NitroSprite>(null);
|
const [ roomBackground, setRoomBackground ] = useState<NitroSprite>(null);
|
||||||
@ -82,11 +80,13 @@ export const RoomColorView: FC<{}> = props =>
|
|||||||
|
|
||||||
if(!display) return null;
|
if(!display) return null;
|
||||||
|
|
||||||
setRoomFilter(ROOM_FILTER);
|
const filter = new NitroAdjustmentFilter();
|
||||||
|
|
||||||
display.filters = [ ROOM_FILTER ];
|
setRoomFilter(filter);
|
||||||
|
|
||||||
return ROOM_FILTER;
|
display.filters = [ filter ];
|
||||||
|
|
||||||
|
return filter;
|
||||||
}, [ roomFilter, getRenderingCanvas ]);
|
}, [ roomFilter, getRenderingCanvas ]);
|
||||||
|
|
||||||
const updateRoomFilter = useCallback(() =>
|
const updateRoomFilter = useCallback(() =>
|
||||||
@ -113,7 +113,7 @@ export const RoomColorView: FC<{}> = props =>
|
|||||||
|
|
||||||
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
|
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
|
||||||
{
|
{
|
||||||
if(!RoomId.isRoomPreviewerId(event.roomId)) return;
|
if(RoomId.isRoomPreviewerId(event.roomId)) return;
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { EventDispatcher, Nitro, NitroRectangle, RoomEngineEvent, RoomEngineObjectEvent, RoomGeometry, RoomId, RoomObjectCategory, RoomObjectOperationType, RoomVariableEnum, RoomZoomEvent, Vector3d } from 'nitro-renderer';
|
import { EventDispatcher, Nitro, NitroRectangle, RoomGeometry, RoomVariableEnum, Vector3d } from 'nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { CanManipulateFurniture, InitializeRoomInstanceRenderingCanvas, IsFurnitureSelectionDisabled, ProcessRoomObjectOperation } from '../../api';
|
import { InitializeRoomInstanceRenderingCanvas } from '../../api';
|
||||||
import { DispatchMouseEvent } from '../../api/nitro/room/DispatchMouseEvent';
|
import { DispatchMouseEvent } from '../../api/nitro/room/DispatchMouseEvent';
|
||||||
import { DispatchTouchEvent } from '../../api/nitro/room/DispatchTouchEvent';
|
import { DispatchTouchEvent } from '../../api/nitro/room/DispatchTouchEvent';
|
||||||
import { GetRoomEngine } from '../../api/nitro/room/GetRoomEngine';
|
import { GetRoomEngine } from '../../api/nitro/room/GetRoomEngine';
|
||||||
import { useRoomEngineEvent } from '../../hooks/events';
|
|
||||||
import { RoomContextProvider } from './context/RoomContext';
|
import { RoomContextProvider } from './context/RoomContext';
|
||||||
import { RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectUpdateEvent } from './events';
|
|
||||||
import { RoomWidgetUpdateRoomViewEvent } from './events/RoomWidgetUpdateRoomViewEvent';
|
import { RoomWidgetUpdateRoomViewEvent } from './events/RoomWidgetUpdateRoomViewEvent';
|
||||||
import { FurnitureContextMenuWidgetHandler, IRoomWidgetHandlerManager, RoomWidgetAvatarInfoHandler, RoomWidgetChatHandler, RoomWidgetChatInputHandler, RoomWidgetHandlerManager, RoomWidgetInfostandHandler } from './handlers';
|
import { FurnitureContextMenuWidgetHandler, IRoomWidgetHandlerManager, RoomWidgetAvatarInfoHandler, RoomWidgetChatHandler, RoomWidgetChatInputHandler, RoomWidgetHandlerManager, RoomWidgetInfostandHandler } from './handlers';
|
||||||
import { RoomColorView } from './RoomColorView';
|
import { RoomColorView } from './RoomColorView';
|
||||||
@ -112,125 +110,6 @@ export const RoomView: FC<RoomViewProps> = props =>
|
|||||||
setCanvasId(canvasId);
|
setCanvasId(canvasId);
|
||||||
}, [ roomSession ]);
|
}, [ roomSession ]);
|
||||||
|
|
||||||
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
|
|
||||||
{
|
|
||||||
if(!widgetHandler || RoomId.isRoomPreviewerId(event.roomId)) return;
|
|
||||||
|
|
||||||
switch(event.type)
|
|
||||||
{
|
|
||||||
case RoomEngineEvent.NORMAL_MODE:
|
|
||||||
widgetHandler.eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, event.roomId));
|
|
||||||
return;
|
|
||||||
case RoomEngineEvent.GAME_MODE:
|
|
||||||
widgetHandler.eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, event.roomId));
|
|
||||||
return;
|
|
||||||
case RoomZoomEvent.ROOM_ZOOM: {
|
|
||||||
const zoomEvent = (event as RoomZoomEvent);
|
|
||||||
|
|
||||||
let zoomLevel = ((zoomEvent.level < 1) ? 0.5 : (1 << (Math.floor(zoomEvent.level) - 1)));
|
|
||||||
|
|
||||||
if(zoomEvent.forceFlip || zoomEvent.asDelta) zoomLevel = zoomEvent.level;
|
|
||||||
|
|
||||||
GetRoomEngine().setRoomInstanceRenderingCanvasScale(roomSession.roomId, 1, zoomLevel, null, null, false, zoomEvent.asDelta);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [ widgetHandler, roomSession ]);
|
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineEvent.NORMAL_MODE, onRoomEngineEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineEvent.GAME_MODE, onRoomEngineEvent);
|
|
||||||
useRoomEngineEvent(RoomZoomEvent.ROOM_ZOOM, onRoomEngineEvent);
|
|
||||||
|
|
||||||
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
|
||||||
{
|
|
||||||
if(!roomSession || !widgetHandler) return;
|
|
||||||
|
|
||||||
const objectId = event.objectId;
|
|
||||||
const category = event.category;
|
|
||||||
|
|
||||||
let updateEvent: RoomWidgetRoomObjectUpdateEvent = null;
|
|
||||||
|
|
||||||
switch(event.type)
|
|
||||||
{
|
|
||||||
case RoomEngineObjectEvent.SELECTED:
|
|
||||||
if(!IsFurnitureSelectionDisabled(event)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.DESELECTED:
|
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.ADDED: {
|
|
||||||
let addedEventType: string = null;
|
|
||||||
|
|
||||||
switch(category)
|
|
||||||
{
|
|
||||||
case RoomObjectCategory.FLOOR:
|
|
||||||
case RoomObjectCategory.WALL:
|
|
||||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED;
|
|
||||||
break;
|
|
||||||
case RoomObjectCategory.UNIT:
|
|
||||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.USER_ADDED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(addedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(addedEventType, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RoomEngineObjectEvent.REMOVED: {
|
|
||||||
let removedEventType: string = null;
|
|
||||||
|
|
||||||
switch(category)
|
|
||||||
{
|
|
||||||
case RoomObjectCategory.FLOOR:
|
|
||||||
case RoomObjectCategory.WALL:
|
|
||||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED;
|
|
||||||
break;
|
|
||||||
case RoomObjectCategory.UNIT:
|
|
||||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.USER_REMOVED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(removedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(removedEventType, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RoomEngineObjectEvent.MOUSE_ENTER:
|
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.MOUSE_LEAVE:
|
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.REQUEST_MOVE:
|
|
||||||
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_MOVE);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.REQUEST_ROTATE:
|
|
||||||
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE);
|
|
||||||
break;
|
|
||||||
case RoomEngineObjectEvent.REQUEST_MANIPULATION:
|
|
||||||
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(updateEvent)
|
|
||||||
{
|
|
||||||
let dispatchEvent = true;
|
|
||||||
|
|
||||||
if(updateEvent instanceof RoomWidgetRoomObjectUpdateEvent) dispatchEvent = (!RoomId.isRoomPreviewerId(updateEvent.roomId));
|
|
||||||
|
|
||||||
if(dispatchEvent) widgetHandler.eventDispatcher.dispatchEvent(updateEvent);
|
|
||||||
}
|
|
||||||
}, [ roomSession, widgetHandler ]);
|
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.SELECTED, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.DESELECTED, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.ADDED, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.REMOVED, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.PLACED, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.MOUSE_ENTER, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.MOUSE_LEAVE, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_MOVE, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_ROTATE, onRoomEngineObjectEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, onRoomEngineObjectEvent);
|
|
||||||
|
|
||||||
if(!roomSession) return null;
|
if(!roomSession) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NitroEvent, RoomEngineTriggerWidgetEvent } from 'nitro-renderer';
|
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomWidgetEnum } from 'nitro-renderer';
|
||||||
import { RoomWidgetUpdateEvent } from '../events';
|
import { RoomWidgetUpdateEvent } from '../events';
|
||||||
import { RoomWidgetMessage, RoomWidgetUseProductMessage } from '../messages';
|
import { RoomWidgetMessage, RoomWidgetUseProductMessage } from '../messages';
|
||||||
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
||||||
@ -23,6 +23,11 @@ export class FurnitureContextMenuWidgetHandler extends RoomWidgetHandler
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get type(): string
|
||||||
|
{
|
||||||
|
return RoomWidgetEnum.FURNITURE_CONTEXT_MENU;
|
||||||
|
}
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -8,6 +8,7 @@ export interface IRoomWidgetHandler
|
|||||||
processEvent: (event: NitroEvent) => void;
|
processEvent: (event: NitroEvent) => void;
|
||||||
processWidgetMessage: (message: RoomWidgetMessage) => RoomWidgetUpdateEvent;
|
processWidgetMessage: (message: RoomWidgetMessage) => RoomWidgetUpdateEvent;
|
||||||
container: IRoomWidgetHandlerManager;
|
container: IRoomWidgetHandlerManager;
|
||||||
|
type: string;
|
||||||
eventTypes: string[];
|
eventTypes: string[];
|
||||||
messageTypes: string[];
|
messageTypes: string[];
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionUserDataUpdateEvent } from 'nitro-renderer';
|
import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionUserDataUpdateEvent, RoomWidgetEnum } from 'nitro-renderer';
|
||||||
import { GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api';
|
import { GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api';
|
||||||
import { FurniCategory } from '../../inventory/common/FurniCategory';
|
import { FurniCategory } from '../../inventory/common/FurniCategory';
|
||||||
import { RoomWidgetAvatarInfoEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateUserDataEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../events';
|
import { RoomWidgetAvatarInfoEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateUserDataEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../events';
|
||||||
@ -151,6 +151,11 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler
|
|||||||
if(useProductBubbles.length) this.container.eventDispatcher.dispatchEvent(new RoomWidgetUseProductBubbleEvent(RoomWidgetUseProductBubbleEvent.USE_PRODUCT_BUBBLES, useProductBubbles));
|
if(useProductBubbles.length) this.container.eventDispatcher.dispatchEvent(new RoomWidgetUseProductBubbleEvent(RoomWidgetUseProductBubbleEvent.USE_PRODUCT_BUBBLES, useProductBubbles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get type(): string
|
||||||
|
{
|
||||||
|
return RoomWidgetEnum.AVATAR_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, IAvatarImageListener, INitroPoint, IVector3D, NitroEvent, NitroPoint, PetFigureData, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionChatEvent, SystemChatStyleEnum, TextureUtils, Vector3d } from 'nitro-renderer';
|
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, IAvatarImageListener, INitroPoint, IVector3D, NitroEvent, NitroPoint, PetFigureData, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionChatEvent, RoomWidgetEnum, SystemChatStyleEnum, TextureUtils, Vector3d } from 'nitro-renderer';
|
||||||
import { GetAvatarRenderManager, GetRoomEngine } from '../../../api';
|
import { GetAvatarRenderManager, GetRoomEngine } from '../../../api';
|
||||||
import { LocalizeText } from '../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../utils/LocalizeText';
|
||||||
import { RoomWidgetUpdateChatEvent, RoomWidgetUpdateEvent } from '../events';
|
import { RoomWidgetUpdateChatEvent, RoomWidgetUpdateEvent } from '../events';
|
||||||
@ -191,6 +191,11 @@ export class RoomWidgetChatHandler extends RoomWidgetHandler implements IAvatarI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get type(): string
|
||||||
|
{
|
||||||
|
return RoomWidgetEnum.CHAT_WIDGET;
|
||||||
|
}
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomSessionChatEvent, RoomSettingsComposer, RoomZoomEvent } from 'nitro-renderer';
|
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomSessionChatEvent, RoomSettingsComposer, RoomWidgetEnum, RoomZoomEvent } from 'nitro-renderer';
|
||||||
import { GetRoomEngine, GetSessionDataManager } from '../../../api';
|
import { GetRoomEngine, GetSessionDataManager } from '../../../api';
|
||||||
import { SendMessageHook } from '../../../hooks/messages';
|
import { SendMessageHook } from '../../../hooks/messages';
|
||||||
import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events';
|
import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events';
|
||||||
@ -181,6 +181,11 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get type(): string
|
||||||
|
{
|
||||||
|
return RoomWidgetEnum.CHAT_INPUT_WIDGET;
|
||||||
|
}
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -22,6 +22,8 @@ export abstract class RoomWidgetHandler implements IRoomWidgetHandler
|
|||||||
this._container = container;
|
this._container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract get type(): string;
|
||||||
|
|
||||||
public abstract get eventTypes(): string[];
|
public abstract get eventTypes(): string[];
|
||||||
|
|
||||||
public abstract get messageTypes(): string[];
|
public abstract get messageTypes(): string[];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IEventDispatcher, IRoomSession, NitroEvent } from 'nitro-renderer';
|
import { IEventDispatcher, IRoomSession, NitroEvent, RoomEngineTriggerWidgetEvent } from 'nitro-renderer';
|
||||||
import { RoomWidgetUpdateEvent } from '../events';
|
import { RoomWidgetUpdateEvent } from '../events';
|
||||||
import { RoomWidgetMessage } from '../messages';
|
import { RoomWidgetMessage } from '../messages';
|
||||||
import { IRoomWidgetHandler } from './IRoomWidgetHandler';
|
import { IRoomWidgetHandler } from './IRoomWidgetHandler';
|
||||||
@ -22,6 +22,8 @@ export class RoomWidgetHandlerManager implements IRoomWidgetHandlerManager
|
|||||||
{
|
{
|
||||||
const eventTypes = handler.eventTypes;
|
const eventTypes = handler.eventTypes;
|
||||||
|
|
||||||
|
eventTypes.push(RoomEngineTriggerWidgetEvent.OPEN_WIDGET, RoomEngineTriggerWidgetEvent.CLOSE_WIDGET);
|
||||||
|
|
||||||
if(eventTypes && eventTypes.length)
|
if(eventTypes && eventTypes.length)
|
||||||
{
|
{
|
||||||
for(const name of eventTypes)
|
for(const name of eventTypes)
|
||||||
@ -77,7 +79,17 @@ export class RoomWidgetHandlerManager implements IRoomWidgetHandlerManager
|
|||||||
{
|
{
|
||||||
if(!handler) continue;
|
if(!handler) continue;
|
||||||
|
|
||||||
handler.processEvent(event);
|
let dispatch = true;
|
||||||
|
|
||||||
|
if((event.type === RoomEngineTriggerWidgetEvent.OPEN_WIDGET) || (event.type === RoomEngineTriggerWidgetEvent.CLOSE_WIDGET))
|
||||||
|
{
|
||||||
|
if(event instanceof RoomEngineTriggerWidgetEvent)
|
||||||
|
{
|
||||||
|
dispatch = (handler.type === event.widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dispatch) handler.processEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IFurnitureData, Nitro, NitroEvent, ObjectDataFactory, PetFigureData, PetRespectComposer, PetSupplementComposer, PetType, RoomAdsUpdateComposer, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectOperationType, RoomObjectType, RoomObjectVariable, RoomSessionPetInfoUpdateEvent, RoomSessionUserBadgesEvent, RoomTradingLevelEnum, RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUserData, RoomWidgetEnumItemExtradataParameter, SecurityLevel, Vector3d } from 'nitro-renderer';
|
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 { GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../api';
|
||||||
import { InventoryTradeRequestEvent, WiredSelectObjectEvent } from '../../../events';
|
import { InventoryTradeRequestEvent, WiredSelectObjectEvent } from '../../../events';
|
||||||
import { FriendListSendFriendRequestEvent } from '../../../events/friend-list/FriendListSendFriendRequestEvent';
|
import { FriendListSendFriendRequestEvent } from '../../../events/friend-list/FriendListSendFriendRequestEvent';
|
||||||
@ -757,6 +757,11 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get type(): string
|
||||||
|
{
|
||||||
|
return RoomWidgetEnum.INFOSTAND;
|
||||||
|
}
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
46
src/views/room/messages/RoomWidgetFurniToWidgetMessage.ts
Normal file
46
src/views/room/messages/RoomWidgetFurniToWidgetMessage.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { RoomWidgetMessage } from './RoomWidgetMessage';
|
||||||
|
|
||||||
|
export class RoomWidgetFurniToWidgetMessage extends RoomWidgetMessage
|
||||||
|
{
|
||||||
|
public static REQUEST_CREDITFURNI: string = 'RWFWM_MESSAGE_REQUEST_CREDITFURNI';
|
||||||
|
public static REQUEST_STICKIE: string = 'RWFWM_MESSAGE_REQUEST_STICKIE';
|
||||||
|
public static REQUEST_PRESENT: string = 'RWFWM_MESSAGE_REQUEST_PRESENT';
|
||||||
|
public static REQUEST_TROPHY: string = 'RWFWM_MESSAGE_REQUEST_TROPHY';
|
||||||
|
public static REQUEST_TEASER: string = 'RWFWM_MESSAGE_REQUEST_TEASER';
|
||||||
|
public static REQUEST_ECOTRONBOX: string = 'RWFWM_MESSAGE_REQUEST_ECOTRONBOX';
|
||||||
|
public static REQUEST_DIMMER: string = 'RWFWM_MESSAGE_REQUEST_DIMMER';
|
||||||
|
public static REQUEST_PLACEHOLDER: string = 'RWFWM_MESSAGE_REQUEST_PLACEHOLDER';
|
||||||
|
public static REQUEST_CLOTHING_CHANGE: string = 'RWFWM_MESSAGE_REQUEST_CLOTHING_CHANGE';
|
||||||
|
public static REQUEST_PLAYLIST_EDITOR: string = 'RWFWM_MESSAGE_REQUEST_PLAYLIST_EDITOR';
|
||||||
|
public static REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING: string = 'RWFWM_WIDGET_MESSAGE_REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING';
|
||||||
|
public static REQUEST_ACHIEVEMENT_RESOLUTION_FAILED: string = 'RWFWM_WIDGET_MESSAGE_REQUEST_ACHIEVEMENT_RESOLUTION_FAILED';
|
||||||
|
public static REQUEST_BADGE_DISPLAY_ENGRAVING: string = 'RWFWM_WIDGET_MESSAGE_REQUEST_BADGE_DISPLAY_ENGRAVING';
|
||||||
|
|
||||||
|
private _objectId: number;
|
||||||
|
private _category: number;
|
||||||
|
private _roomId: number;
|
||||||
|
|
||||||
|
constructor(type: string, objectId: number, category: number, roomId: number)
|
||||||
|
{
|
||||||
|
super(type);
|
||||||
|
|
||||||
|
this._objectId = objectId;
|
||||||
|
this._category = category;
|
||||||
|
this._roomId = roomId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get objectId(): number
|
||||||
|
{
|
||||||
|
return this._objectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get category(): number
|
||||||
|
{
|
||||||
|
return this._category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get roomId(): number
|
||||||
|
{
|
||||||
|
return this._roomId;
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ export * from './RoomWidgetChatSelectAvatarMessage';
|
|||||||
export * from './RoomWidgetChatTypingMessage';
|
export * from './RoomWidgetChatTypingMessage';
|
||||||
export * from './RoomWidgetDanceMessage';
|
export * from './RoomWidgetDanceMessage';
|
||||||
export * from './RoomWidgetFurniActionMessage';
|
export * from './RoomWidgetFurniActionMessage';
|
||||||
|
export * from './RoomWidgetFurniToWidgetMessage';
|
||||||
export * from './RoomWidgetMessage';
|
export * from './RoomWidgetMessage';
|
||||||
export * from './RoomWidgetRequestWidgetMessage';
|
export * from './RoomWidgetRequestWidgetMessage';
|
||||||
export * from './RoomWidgetRoomObjectMessage';
|
export * from './RoomWidgetRoomObjectMessage';
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { NitroEvent, RoomEngineDimmerStateEvent, RoomEngineUseProductEvent, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent } from 'nitro-renderer';
|
import { RoomEngineDimmerStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineUseProductEvent, RoomId, RoomObjectCategory, RoomObjectOperationType, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomZoomEvent } from 'nitro-renderer';
|
||||||
import { FC, useCallback } from 'react';
|
import { FC, useCallback } from 'react';
|
||||||
|
import { CanManipulateFurniture, GetRoomEngine, IsFurnitureSelectionDisabled, ProcessRoomObjectOperation } from '../../../api';
|
||||||
import { useRoomEngineEvent, useRoomSessionManagerEvent } from '../../../hooks/events';
|
import { useRoomEngineEvent, useRoomSessionManagerEvent } from '../../../hooks/events';
|
||||||
import { LocalizeText } from '../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../utils/LocalizeText';
|
||||||
import { useRoomContext } from '../context/RoomContext';
|
import { useRoomContext } from '../context/RoomContext';
|
||||||
|
import { RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectUpdateEvent } from '../events';
|
||||||
import { AvatarInfoWidgetView } from './avatar-info/AvatarInfoWidgetView';
|
import { AvatarInfoWidgetView } from './avatar-info/AvatarInfoWidgetView';
|
||||||
import { CameraWidgetView } from './camera/CameraWidgetView';
|
import { CameraWidgetView } from './camera/CameraWidgetView';
|
||||||
import { ChatInputView } from './chat-input/ChatInputView';
|
import { ChatInputView } from './chat-input/ChatInputView';
|
||||||
@ -13,31 +15,157 @@ import { RoomWidgetViewProps } from './RoomWidgets.types';
|
|||||||
|
|
||||||
export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { widgetHandler = null } = useRoomContext();
|
const { roomSession = null, eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
||||||
|
|
||||||
const onNitroEvent = useCallback((event: NitroEvent) =>
|
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
|
||||||
|
{
|
||||||
|
if(!eventDispatcher || RoomId.isRoomPreviewerId(event.roomId)) return;
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case RoomEngineEvent.NORMAL_MODE:
|
||||||
|
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, event.roomId));
|
||||||
|
return;
|
||||||
|
case RoomEngineEvent.GAME_MODE:
|
||||||
|
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, event.roomId));
|
||||||
|
return;
|
||||||
|
case RoomZoomEvent.ROOM_ZOOM: {
|
||||||
|
const zoomEvent = (event as RoomZoomEvent);
|
||||||
|
|
||||||
|
let zoomLevel = ((zoomEvent.level < 1) ? 0.5 : (1 << (Math.floor(zoomEvent.level) - 1)));
|
||||||
|
|
||||||
|
if(zoomEvent.forceFlip || zoomEvent.asDelta) zoomLevel = zoomEvent.level;
|
||||||
|
|
||||||
|
GetRoomEngine().setRoomInstanceRenderingCanvasScale(event.roomId, 1, zoomLevel, null, null, false, zoomEvent.asDelta);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RoomEngineDimmerStateEvent.ROOM_COLOR: {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [ eventDispatcher ]);
|
||||||
|
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.NORMAL_MODE, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.GAME_MODE, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomZoomEvent.ROOM_ZOOM, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineDimmerStateEvent.ROOM_COLOR, onRoomEngineEvent);
|
||||||
|
|
||||||
|
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
||||||
|
{
|
||||||
|
if(!roomSession || !widgetHandler) return;
|
||||||
|
|
||||||
|
const objectId = event.objectId;
|
||||||
|
const category = event.category;
|
||||||
|
|
||||||
|
let updateEvent: RoomWidgetRoomObjectUpdateEvent = null;
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case RoomEngineObjectEvent.SELECTED:
|
||||||
|
if(!IsFurnitureSelectionDisabled(event)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.DESELECTED:
|
||||||
|
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.ADDED: {
|
||||||
|
let addedEventType: string = null;
|
||||||
|
|
||||||
|
switch(category)
|
||||||
|
{
|
||||||
|
case RoomObjectCategory.FLOOR:
|
||||||
|
case RoomObjectCategory.WALL:
|
||||||
|
addedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED;
|
||||||
|
break;
|
||||||
|
case RoomObjectCategory.UNIT:
|
||||||
|
addedEventType = RoomWidgetRoomObjectUpdateEvent.USER_ADDED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(addedEventType, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RoomEngineObjectEvent.REMOVED: {
|
||||||
|
let removedEventType: string = null;
|
||||||
|
|
||||||
|
switch(category)
|
||||||
|
{
|
||||||
|
case RoomObjectCategory.FLOOR:
|
||||||
|
case RoomObjectCategory.WALL:
|
||||||
|
removedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED;
|
||||||
|
break;
|
||||||
|
case RoomObjectCategory.UNIT:
|
||||||
|
removedEventType = RoomWidgetRoomObjectUpdateEvent.USER_REMOVED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(removedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(removedEventType, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RoomEngineObjectEvent.REQUEST_MOVE:
|
||||||
|
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_MOVE);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.REQUEST_ROTATE:
|
||||||
|
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.REQUEST_MANIPULATION:
|
||||||
|
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.MOUSE_ENTER:
|
||||||
|
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
case RoomEngineObjectEvent.MOUSE_LEAVE:
|
||||||
|
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT, objectId, category, event.roomId);
|
||||||
|
break;
|
||||||
|
case RoomEngineUseProductEvent.USE_PRODUCT_FROM_INVENTORY:
|
||||||
|
case RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM:
|
||||||
|
widgetHandler.processEvent(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateEvent)
|
||||||
|
{
|
||||||
|
let dispatchEvent = true;
|
||||||
|
|
||||||
|
if(updateEvent instanceof RoomWidgetRoomObjectUpdateEvent) dispatchEvent = (!RoomId.isRoomPreviewerId(updateEvent.roomId));
|
||||||
|
|
||||||
|
if(dispatchEvent) widgetHandler.eventDispatcher.dispatchEvent(updateEvent);
|
||||||
|
}
|
||||||
|
}, [ roomSession, widgetHandler ]);
|
||||||
|
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.SELECTED, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.DESELECTED, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.ADDED, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.REMOVED, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.PLACED, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_MOVE, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_ROTATE, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.MOUSE_ENTER, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineObjectEvent.MOUSE_LEAVE, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_INVENTORY, onRoomEngineObjectEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, onRoomEngineObjectEvent);
|
||||||
|
|
||||||
|
const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
|
||||||
{
|
{
|
||||||
if(!widgetHandler) return;
|
if(!widgetHandler) return;
|
||||||
|
|
||||||
widgetHandler.processEvent(event);
|
widgetHandler.processEvent(event);
|
||||||
}, [ widgetHandler ]);
|
}, [ widgetHandler ]);
|
||||||
|
|
||||||
useRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionChatEvent.CHAT_EVENT, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionChatEvent.FLOOD_EVENT, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionChatEvent.FLOOD_EVENT, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionDanceEvent.RSDE_DANCE, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionDanceEvent.RSDE_DANCE, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionUserBadgesEvent.RSUBE_BADGES, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionUserBadgesEvent.RSUBE_BADGES, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.DOORBELL, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.DOORBELL, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionDimmerPresetsEvent.ROOM_DIMMER_PRESETS, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionDimmerPresetsEvent.ROOM_DIMMER_PRESETS, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionFriendRequestEvent.RSFRE_FRIEND_REQUEST, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionFriendRequestEvent.RSFRE_FRIEND_REQUEST, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, onRoomSessionEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionPetInfoUpdateEvent.PET_INFO, onNitroEvent);
|
useRoomSessionManagerEvent(RoomSessionPetInfoUpdateEvent.PET_INFO, onRoomSessionEvent);
|
||||||
useRoomEngineEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_INVENTORY, onNitroEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, onNitroEvent);
|
|
||||||
useRoomEngineEvent(RoomEngineDimmerStateEvent.ROOM_COLOR, onNitroEvent);
|
|
||||||
|
|
||||||
const onRoomErrorEvent = useCallback((event: RoomSessionEvent) =>
|
const onRoomSessionErrorMessageEvent = useCallback((event: RoomSessionErrorMessageEvent) =>
|
||||||
{
|
{
|
||||||
if(!event) return;
|
if(!event) return;
|
||||||
|
|
||||||
@ -88,18 +216,18 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_KICKED, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_KICKED, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_FLAT, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_FLAT, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_PETS, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_PETS, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_NUMBER_OF_OWN_PETS, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_MAX_NUMBER_OF_OWN_PETS, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_NO_FREE_TILES_FOR_PET, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_NO_FREE_TILES_FOR_PET, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_PET, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_PET, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_FLAT, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_FLAT, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_LIMIT_REACHED, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_LIMIT_REACHED, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT, onRoomSessionErrorMessageEvent);
|
||||||
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_NAME_NOT_ACCEPTED, onRoomErrorEvent);
|
useRoomSessionManagerEvent(RoomSessionErrorMessageEvent.RSEME_BOT_NAME_NOT_ACCEPTED, onRoomSessionErrorMessageEvent);
|
||||||
|
|
||||||
if(!widgetHandler) return null;
|
if(!widgetHandler) return null;
|
||||||
|
|
||||||
|
@ -116,9 +116,10 @@ export const AvatarInfoWidgetPetView: FC<AvatarInfoWidgetPetViewProps> = props =
|
|||||||
</ContextMenuListItemView> }
|
</ContextMenuListItemView> }
|
||||||
{ (mode === _Str_5818) &&
|
{ (mode === _Str_5818) &&
|
||||||
<>
|
<>
|
||||||
|
{ !!petData.publiclyRideable &&
|
||||||
<ContextMenuListItemView onClick={ event => processAction('mount') }>
|
<ContextMenuListItemView onClick={ event => processAction('mount') }>
|
||||||
{ LocalizeText('infostand.button.mount') }
|
{ LocalizeText('infostand.button.mount') }
|
||||||
</ContextMenuListItemView>
|
</ContextMenuListItemView> }
|
||||||
{ (respectsLeft > 0) &&
|
{ (respectsLeft > 0) &&
|
||||||
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
||||||
{ LocalizeText('infostand.button.petrespect', [ 'count' ], [ respectsLeft.toString() ]) }
|
{ LocalizeText('infostand.button.petrespect', [ 'count' ], [ respectsLeft.toString() ]) }
|
||||||
|
Loading…
Reference in New Issue
Block a user