mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 08:50:51 +01:00
Update room widgets
This commit is contained in:
parent
561a7ae932
commit
c9d76ecf6e
@ -1,6 +1,6 @@
|
|||||||
import { RoomEngineEvent, RoomEngineObjectEvent, RoomEngineRoomAdEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomId, RoomObjectCategory, RoomObjectOperationType, RoomObjectVariable, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomZoomEvent } from '@nitrots/nitro-renderer';
|
import { RoomEngineEvent, RoomEngineObjectEvent, RoomEngineRoomAdEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomId, RoomObjectCategory, RoomObjectOperationType, RoomObjectVariable, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomZoomEvent } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback } from 'react';
|
import { FC, useCallback } from 'react';
|
||||||
import { CanManipulateFurniture, GetRoomEngine, GetSessionDataManager, IsFurnitureSelectionDisabled, LocalizeText, ProcessRoomObjectOperation, RoomWidgetFurniToWidgetMessage, RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectUpdateEvent } from '../../../api';
|
import { CanManipulateFurniture, GetRoomEngine, GetSessionDataManager, IsFurnitureSelectionDisabled, LocalizeText, ProcessRoomObjectOperation, RoomWidgetFurniToWidgetMessage, RoomWidgetUpdateRoomEngineEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../api';
|
||||||
import { useRoomEngineEvent, useRoomSessionManagerEvent } from '../../../hooks/events';
|
import { useRoomEngineEvent, useRoomSessionManagerEvent } from '../../../hooks/events';
|
||||||
import { NotificationAlertType } from '../../notification-center/common/NotificationAlertType';
|
import { NotificationAlertType } from '../../notification-center/common/NotificationAlertType';
|
||||||
import { NotificationUtilities } from '../../notification-center/common/NotificationUtilities';
|
import { NotificationUtilities } from '../../notification-center/common/NotificationUtilities';
|
||||||
@ -27,10 +27,10 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomEngineEvent.NORMAL_MODE:
|
case RoomEngineEvent.NORMAL_MODE:
|
||||||
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, event.roomId));
|
eventDispatcher.dispatchEvent(new RoomWidgetUpdateRoomEngineEvent(RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE, event.roomId));
|
||||||
return;
|
return;
|
||||||
case RoomEngineEvent.GAME_MODE:
|
case RoomEngineEvent.GAME_MODE:
|
||||||
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, event.roomId));
|
eventDispatcher.dispatchEvent(new RoomWidgetUpdateRoomEngineEvent(RoomWidgetUpdateRoomEngineEvent.GAME_MODE, event.roomId));
|
||||||
return;
|
return;
|
||||||
case RoomZoomEvent.ROOM_ZOOM: {
|
case RoomZoomEvent.ROOM_ZOOM: {
|
||||||
const zoomEvent = (event as RoomZoomEvent);
|
const zoomEvent = (event as RoomZoomEvent);
|
||||||
@ -67,15 +67,15 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
const objectId = event.objectId;
|
const objectId = event.objectId;
|
||||||
const category = event.category;
|
const category = event.category;
|
||||||
|
|
||||||
let updateEvent: RoomWidgetRoomObjectUpdateEvent = null;
|
let updateEvent: RoomWidgetUpdateRoomObjectEvent = null;
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomEngineObjectEvent.SELECTED:
|
case RoomEngineObjectEvent.SELECTED:
|
||||||
if(!IsFurnitureSelectionDisabled(event)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED, objectId, category, event.roomId);
|
if(!IsFurnitureSelectionDisabled(event)) updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_SELECTED, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
case RoomEngineObjectEvent.DESELECTED:
|
case RoomEngineObjectEvent.DESELECTED:
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
case RoomEngineObjectEvent.ADDED: {
|
case RoomEngineObjectEvent.ADDED: {
|
||||||
let addedEventType: string = null;
|
let addedEventType: string = null;
|
||||||
@ -84,14 +84,14 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
{
|
{
|
||||||
case RoomObjectCategory.FLOOR:
|
case RoomObjectCategory.FLOOR:
|
||||||
case RoomObjectCategory.WALL:
|
case RoomObjectCategory.WALL:
|
||||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED;
|
addedEventType = RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED;
|
||||||
break;
|
break;
|
||||||
case RoomObjectCategory.UNIT:
|
case RoomObjectCategory.UNIT:
|
||||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.USER_ADDED;
|
addedEventType = RoomWidgetUpdateRoomObjectEvent.USER_ADDED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(addedEventType, objectId, category, event.roomId);
|
if(addedEventType) updateEvent = new RoomWidgetUpdateRoomObjectEvent(addedEventType, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RoomEngineObjectEvent.REMOVED: {
|
case RoomEngineObjectEvent.REMOVED: {
|
||||||
@ -101,14 +101,14 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
{
|
{
|
||||||
case RoomObjectCategory.FLOOR:
|
case RoomObjectCategory.FLOOR:
|
||||||
case RoomObjectCategory.WALL:
|
case RoomObjectCategory.WALL:
|
||||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED;
|
removedEventType = RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED;
|
||||||
break;
|
break;
|
||||||
case RoomObjectCategory.UNIT:
|
case RoomObjectCategory.UNIT:
|
||||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.USER_REMOVED;
|
removedEventType = RoomWidgetUpdateRoomObjectEvent.USER_REMOVED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(removedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(removedEventType, objectId, category, event.roomId);
|
if(removedEventType) updateEvent = new RoomWidgetUpdateRoomObjectEvent(removedEventType, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RoomEngineObjectEvent.REQUEST_MOVE:
|
case RoomEngineObjectEvent.REQUEST_MOVE:
|
||||||
@ -118,13 +118,13 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE);
|
if(CanManipulateFurniture(roomSession, objectId, category)) ProcessRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE);
|
||||||
break;
|
break;
|
||||||
case RoomEngineObjectEvent.REQUEST_MANIPULATION:
|
case RoomEngineObjectEvent.REQUEST_MANIPULATION:
|
||||||
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
case RoomEngineObjectEvent.MOUSE_ENTER:
|
case RoomEngineObjectEvent.MOUSE_ENTER:
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER, objectId, category, event.roomId);
|
updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
case RoomEngineObjectEvent.MOUSE_LEAVE:
|
case RoomEngineObjectEvent.MOUSE_LEAVE:
|
||||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT, objectId, category, event.roomId);
|
updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
case RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI:
|
case RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI:
|
||||||
widgetHandler.processWidgetMessage(new RoomWidgetFurniToWidgetMessage(RoomWidgetFurniToWidgetMessage.REQUEST_CREDITFURNI, objectId, category, event.roomId));
|
widgetHandler.processWidgetMessage(new RoomWidgetFurniToWidgetMessage(RoomWidgetFurniToWidgetMessage.REQUEST_CREDITFURNI, objectId, category, event.roomId));
|
||||||
@ -202,7 +202,7 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
|||||||
{
|
{
|
||||||
let dispatchEvent = true;
|
let dispatchEvent = true;
|
||||||
|
|
||||||
if(updateEvent instanceof RoomWidgetRoomObjectUpdateEvent) dispatchEvent = (!RoomId.isRoomPreviewerId(updateEvent.roomId));
|
if(updateEvent instanceof RoomWidgetUpdateRoomObjectEvent) dispatchEvent = (!RoomId.isRoomPreviewerId(updateEvent.roomId));
|
||||||
|
|
||||||
if(dispatchEvent) widgetHandler.eventDispatcher.dispatchEvent(updateEvent);
|
if(dispatchEvent) widgetHandler.eventDispatcher.dispatchEvent(updateEvent);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RoomEnterEffect, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
import { RoomEnterEffect, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useMemo, useState } from 'react';
|
import { FC, useCallback, useMemo, useState } from 'react';
|
||||||
import { GetRoomSession, GetSessionDataManager, RoomWidgetObjectNameEvent, RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectMessage, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateInfostandEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRentableBotChatEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../../../../api';
|
import { GetRoomSession, GetSessionDataManager, RoomWidgetObjectNameEvent, RoomWidgetRoomObjectMessage, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateInfostandEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRentableBotChatEvent, RoomWidgetUpdateRoomEngineEvent, RoomWidgetUpdateRoomObjectEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../hooks/events/event-dispatcher.base';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { AvatarInfoWidgetAvatarView } from './views/avatar/AvatarInfoWidgetAvatarView';
|
import { AvatarInfoWidgetAvatarView } from './views/avatar/AvatarInfoWidgetAvatarView';
|
||||||
@ -73,25 +73,25 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
|||||||
setProductBubbles([]);
|
setProductBubbles([]);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onRoomWidgetRoomEngineUpdateEvent = useCallback((event: RoomWidgetRoomEngineUpdateEvent) =>
|
const onRoomWidgetRoomEngineUpdateEvent = useCallback((event: RoomWidgetUpdateRoomEngineEvent) =>
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE: {
|
case RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE: {
|
||||||
if(isGameMode) setGameMode(false);
|
if(isGameMode) setGameMode(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomEngineUpdateEvent.GAME_MODE: {
|
case RoomWidgetUpdateRoomEngineEvent.GAME_MODE: {
|
||||||
if(!isGameMode) setGameMode(true);
|
if(!isGameMode) setGameMode(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [ isGameMode ]);
|
}, [ isGameMode ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.GAME_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||||
|
|
||||||
const onRoomObjectRemoved = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomObjectRemoved = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
if(name)
|
if(name)
|
||||||
{
|
{
|
||||||
@ -152,15 +152,15 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}, [ name, infoStandEvent, nameBubbles, productBubbles, removeNameBubble, clearInfoStandEvent ]);
|
}, [ name, infoStandEvent, nameBubbles, productBubbles, removeNameBubble, clearInfoStandEvent ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||||
|
|
||||||
const onObjectRolled = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onObjectRolled = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER: {
|
||||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
if(infoStandEvent) return;
|
if(infoStandEvent) return;
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT: {
|
||||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
if(!name || (name.roomIndex !== roomObjectEvent.id)) return;
|
if(!name || (name.roomIndex !== roomObjectEvent.id)) return;
|
||||||
|
|
||||||
@ -180,16 +180,16 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}, [ infoStandEvent, name, widgetHandler ]);
|
}, [ infoStandEvent, name, widgetHandler ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER, eventDispatcher, onObjectRolled);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER, eventDispatcher, onObjectRolled);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT, eventDispatcher, onObjectRolled);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT, eventDispatcher, onObjectRolled);
|
||||||
|
|
||||||
const onObjectDeselected = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onObjectDeselected = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
if(infoStandEvent) clearInfoStandEvent();
|
if(infoStandEvent) clearInfoStandEvent();
|
||||||
if(productBubbles.length) setProductBubbles([]);
|
if(productBubbles.length) setProductBubbles([]);
|
||||||
}, [ infoStandEvent, productBubbles, clearInfoStandEvent ]);
|
}, [ infoStandEvent, productBubbles, clearInfoStandEvent ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onObjectDeselected);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onObjectDeselected);
|
||||||
|
|
||||||
const onRoomWidgetObjectNameEvent = useCallback((event: RoomWidgetObjectNameEvent) =>
|
const onRoomWidgetObjectNameEvent = useCallback((event: RoomWidgetObjectNameEvent) =>
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
max-height: $chat-input-style-selector-widget-height;
|
max-height: $chat-input-style-selector-widget-height;
|
||||||
|
|
||||||
.content-area {
|
.content-area {
|
||||||
max-height: $chat-input-style-selector-widget-height;
|
max-height: $chat-input-style-selector-widget-height !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-item {
|
.grid-item {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { HabboClubLevelEnum, RoomControllerLevel } from '@nitrots/nitro-renderer';
|
import { HabboClubLevelEnum, RoomControllerLevel } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { GetConfiguration, GetSessionDataManager, LocalizeText, RoomWidgetChatMessage, RoomWidgetChatTypingMessage, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateChatInputContentEvent, RoomWidgetUpdateInfostandUserEvent } from '../../../../api';
|
import { GetConfiguration, GetSessionDataManager, LocalizeText, RoomWidgetChatMessage, RoomWidgetChatTypingMessage, RoomWidgetUpdateChatInputContentEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../hooks/events';
|
import { CreateEventDispatcherHook } from '../../../../hooks/events';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { ChatInputStyleSelectorView } from './style-selector/ChatInputStyleSelectorView';
|
import { ChatInputStyleSelectorView } from './style-selector/ChatInputStyleSelectorView';
|
||||||
@ -177,12 +177,12 @@ export const ChatInputView: FC<{}> = props =>
|
|||||||
|
|
||||||
}, [ inputRef, chatModeIdWhisper, anotherInputHasFocus, setInputFocus, checkSpecialKeywordForInput, sendChatValue ]);
|
}, [ inputRef, chatModeIdWhisper, anotherInputHasFocus, setInputFocus, checkSpecialKeywordForInput, sendChatValue ]);
|
||||||
|
|
||||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
setSelectedUsername('');
|
setSelectedUsername('');
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
|
|
||||||
const onRoomWidgetUpdateInfostandUserEvent = useCallback((event: RoomWidgetUpdateInfostandUserEvent) =>
|
const onRoomWidgetUpdateInfostandUserEvent = useCallback((event: RoomWidgetUpdateInfostandUserEvent) =>
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetRoomObjectUpdateEvent } from '../../../../api';
|
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../hooks';
|
import { CreateEventDispatcherHook } from '../../../../hooks';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { ChooserWidgetView } from './ChooserWidgetView';
|
import { ChooserWidgetView } from './ChooserWidgetView';
|
||||||
@ -31,21 +31,21 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
|||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
||||||
|
|
||||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
if(!isVisible) return;
|
if(!isVisible) return;
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED:
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED:
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||||
refreshChooser();
|
refreshChooser();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [ isVisible, refreshChooser ]);
|
}, [ isVisible, refreshChooser ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
|
|
||||||
const close = useCallback(() =>
|
const close = useCallback(() =>
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetRoomObjectUpdateEvent } from '../../../../api';
|
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../hooks';
|
import { CreateEventDispatcherHook } from '../../../../hooks';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { ChooserWidgetView } from './ChooserWidgetView';
|
import { ChooserWidgetView } from './ChooserWidgetView';
|
||||||
@ -31,21 +31,21 @@ export const UserChooserWidgetView: FC<{}> = props =>
|
|||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.USER_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.USER_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
||||||
|
|
||||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
if(!isVisible) return;
|
if(!isVisible) return;
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.USER_ADDED:
|
case RoomWidgetUpdateRoomObjectEvent.USER_ADDED:
|
||||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED:
|
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED:
|
||||||
refreshChooser();
|
refreshChooser();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [ isVisible, refreshChooser ]);
|
}, [ isVisible, refreshChooser ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
|
|
||||||
const close = useCallback(() =>
|
const close = useCallback(() =>
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
font-size: $font-size-sm;
|
font-size: $font-size-sm;
|
||||||
z-index: $context-menu-zindex;
|
z-index: $context-menu-zindex;
|
||||||
|
pointer-events: all;
|
||||||
|
|
||||||
&.name-only {
|
&.name-only {
|
||||||
background-color: rgba($black, 0.5);
|
background-color: rgba($black, 0.5);
|
||||||
@ -34,8 +35,7 @@
|
|||||||
.menu-header {
|
.menu-header {
|
||||||
background-color: $william;
|
background-color: $william;
|
||||||
color: $white;
|
color: $white;
|
||||||
width: 117px;
|
min-width: 117px;
|
||||||
max-width: 117px;
|
|
||||||
height: 25px;
|
height: 25px;
|
||||||
max-height: 25px;
|
max-height: 25px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
.nitro-room-widgets {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import './custom-stack-height/FurnitureCustomStackHeightView';
|
||||||
|
|
||||||
@import './dimmer/FurnitureDimmerView';
|
@import './dimmer/FurnitureDimmerView';
|
||||||
@import './exchange-credit/FurnitureExchangeCreditView';
|
@import './exchange-credit/FurnitureExchangeCreditView';
|
||||||
@import './external-image/FurnitureExternalImageView';
|
@import './external-image/FurnitureExternalImageView';
|
||||||
|
@ -17,7 +17,7 @@ import { FurnitureTrophyView } from './trophy/FurnitureTrophyView';
|
|||||||
export const FurnitureWidgetsView: FC<{}> = props =>
|
export const FurnitureWidgetsView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
<div className="position-absolute nitro-room-widgets top-0 start-0">
|
<div className="position-absolute nitro-room-widgets top-0 start-0 w-100 h-100">
|
||||||
<FurnitureBackgroundColorView />
|
<FurnitureBackgroundColorView />
|
||||||
<FurnitureContextMenuView />
|
<FurnitureContextMenuView />
|
||||||
<FurnitureCustomStackHeightView />
|
<FurnitureCustomStackHeightView />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ApplyTonerComposer, RoomControllerLevel, RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
import { ApplyTonerComposer, RoomControllerLevel, RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import ReactSlider from 'react-slider';
|
import ReactSlider from 'react-slider';
|
||||||
import { GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateBackgroundColorPreviewEvent } from '../../../../../api';
|
import { GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetUpdateBackgroundColorPreviewEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
import { SendMessageHook } from '../../../../../hooks';
|
import { SendMessageHook } from '../../../../../hooks';
|
||||||
import { CreateEventDispatcherHook, useRoomEngineEvent } from '../../../../../hooks/events';
|
import { CreateEventDispatcherHook, useRoomEngineEvent } from '../../../../../hooks/events';
|
||||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout';
|
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout';
|
||||||
@ -48,7 +48,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
if(objectId !== event.objectId) return;
|
if(objectId !== event.objectId) return;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
@ -58,7 +58,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
|
|||||||
}, [ objectId, canOpenBackgroundToner, close ]);
|
}, [ objectId, canOpenBackgroundToner, close ]);
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, onRoomEngineObjectEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, onRoomEngineObjectEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomEngineObjectEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomEngineObjectEvent);
|
||||||
|
|
||||||
const processAction = useCallback((name: string) =>
|
const processAction = useCallback((name: string) =>
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NitroEvent, RoomEngineTriggerWidgetEvent, StringDataType } from '@nitrots/nitro-renderer';
|
import { NitroEvent, RoomEngineTriggerWidgetEvent, StringDataType } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { GetRoomEngine, LocalizeBadgeDescription, LocalizeBadgeName, RoomWidgetRoomObjectUpdateEvent } from '../../../../../api';
|
import { GetRoomEngine, LocalizeBadgeDescription, LocalizeBadgeName, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../../hooks';
|
import { CreateEventDispatcherHook } from '../../../../../hooks';
|
||||||
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||||
import { NitroLayoutTrophyView } from '../../../../../layout';
|
import { NitroLayoutTrophyView } from '../../../../../layout';
|
||||||
@ -36,8 +36,8 @@ export const FurnitureBadgeDisplayView: FC<{}> = props =>
|
|||||||
setTrophyData(new FurnitureTrophyData(widgetEvent.objectId, widgetEvent.category, '1', senderName, date, badgeDesc, badgeName));
|
setTrophyData(new FurnitureTrophyData(widgetEvent.objectId, widgetEvent.category, '1', senderName, date, badgeDesc, badgeName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
setTrophyData(prevState =>
|
setTrophyData(prevState =>
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ export const FurnitureBadgeDisplayView: FC<{}> = props =>
|
|||||||
|
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_ENGRAVING, onNitroEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_ENGRAVING, onNitroEvent);
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING, onNitroEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING, onNitroEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, widgetHandler.eventDispatcher, onNitroEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, widgetHandler.eventDispatcher, onNitroEvent);
|
||||||
|
|
||||||
const processAction = useCallback((type: string, value: string = null) =>
|
const processAction = useCallback((type: string, value: string = null) =>
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
.nitro-exchange-credit {
|
.nitro-widget-exchange-credit {
|
||||||
|
width: $nitro-widget-exchange-credit-width;
|
||||||
|
height: $nitro-widget-exchange-credit-height;
|
||||||
|
|
||||||
.exchange-image {
|
.exchange-image {
|
||||||
background-image: url('../../../../../assets/images/room-widgets/exchange-credit/exchange-credit-image.png');
|
background-image: url('../../../../../assets/images/room-widgets/exchange-credit/exchange-credit-image.png');
|
||||||
|
@ -39,7 +39,7 @@ export const FurnitureExchangeCreditView: FC<{}> = props =>
|
|||||||
if(objectId === -1) return null;
|
if(objectId === -1) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardView className="nitro-exchange-credit" simple={ true }>
|
<NitroCardView className="nitro-widget-exchange-credit" simple={ true }>
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('catalog.redeem.dialog.title') } onCloseClick={ close } />
|
<NitroCardHeaderView headerText={ LocalizeText('catalog.redeem.dialog.title') } onCloseClick={ close } />
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
<NitroLayoutGrid>
|
<NitroLayoutGrid>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { FriendFurniConfirmLockMessageComposer, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
import { FriendFurniConfirmLockMessageComposer, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { GetRoomEngine, GetRoomSession, LocalizeText, RoomWidgetRoomObjectUpdateEvent } from '../../../../../api';
|
import { GetRoomEngine, GetRoomSession, LocalizeText, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
||||||
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||||
import { CreateMessageHook } from '../../../../../hooks/messages/message-event';
|
import { CreateMessageHook } from '../../../../../hooks/messages/message-event';
|
||||||
@ -37,8 +37,8 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
setEngravingLockData(prevState =>
|
setEngravingLockData(prevState =>
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, onNitroEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, onNitroEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
||||||
|
|
||||||
const onLoveLockFurniStartEvent = useCallback((event: LoveLockFurniStartEvent) =>
|
const onLoveLockFurniStartEvent = useCallback((event: LoveLockFurniStartEvent) =>
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { RoomObjectCategory, RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
import { RoomObjectCategory, RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useMemo, useState } from 'react';
|
import { FC, useCallback, useMemo, useState } from 'react';
|
||||||
import { CreateLinkEvent, GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetPresentOpenMessage, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdatePresentDataEvent } from '../../../../../api';
|
import { CreateLinkEvent, GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetPresentOpenMessage, RoomWidgetUpdatePresentDataEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
|
import { BatchUpdates } from '../../../../../hooks';
|
||||||
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
||||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutGiftCardView } from '../../../../../layout';
|
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutButton, NitroLayoutFlex, NitroLayoutFlexColumn, NitroLayoutGiftCardView, NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../layout';
|
||||||
|
import { NitroLayoutBase } from '../../../../../layout/base';
|
||||||
import { ProductTypeEnum } from '../../../../catalog/common/ProductTypeEnum';
|
import { ProductTypeEnum } from '../../../../catalog/common/ProductTypeEnum';
|
||||||
import { useRoomContext } from '../../../context/RoomContext';
|
import { useRoomContext } from '../../../context/RoomContext';
|
||||||
|
|
||||||
@ -10,6 +12,11 @@ const FLOOR: string = 'floor';
|
|||||||
const WALLPAPER: string = 'wallpaper';
|
const WALLPAPER: string = 'wallpaper';
|
||||||
const LANDSCAPE: string = 'landscape';
|
const LANDSCAPE: string = 'landscape';
|
||||||
|
|
||||||
|
const ACTION_GIVE_GIFT = 0;
|
||||||
|
const ACTION_OPEN = 1;
|
||||||
|
const ACTION_PLACE = 2;
|
||||||
|
const ACTION_INVENTORY = 3;
|
||||||
|
|
||||||
export const FurnitureGiftOpeningView: FC<{}> = props =>
|
export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const [ objectId, setObjectId ] = useState(-1);
|
const [ objectId, setObjectId ] = useState(-1);
|
||||||
@ -44,6 +51,8 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetUpdatePresentDataEvent.PACKAGEINFO: {
|
case RoomWidgetUpdatePresentDataEvent.PACKAGEINFO: {
|
||||||
|
BatchUpdates(() =>
|
||||||
|
{
|
||||||
setOpenRequested(false);
|
setOpenRequested(false);
|
||||||
setObjectId(event.objectId);
|
setObjectId(event.objectId);
|
||||||
setText(event.giftMessage);
|
setText(event.giftMessage);
|
||||||
@ -51,41 +60,20 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
setSenderName(event.purchaserName);
|
setSenderName(event.purchaserName);
|
||||||
setSenderFigure(event.purchaserFigure);
|
setSenderFigure(event.purchaserFigure);
|
||||||
setImageUrl(event.imageUrl);
|
setImageUrl(event.imageUrl);
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR:
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR:
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE:
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE:
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_WALLPAPER: {
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS_WALLPAPER: {
|
||||||
setObjectId(event.objectId);
|
|
||||||
setClassId(event.classId);
|
|
||||||
setItemType(event.itemType);
|
|
||||||
setText(event.giftMessage);
|
|
||||||
setIsOwnerOfFurniture(event.isController);
|
|
||||||
setPlacedItemId(event.placedItemId);
|
|
||||||
setPlacedItemType(event.placedItemType);
|
|
||||||
setPlacedInRoom(event.placedInRoom);
|
|
||||||
|
|
||||||
let imageType: string = null;
|
let imageType: string = null;
|
||||||
|
|
||||||
if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR) imageType = 'packagecard_icon_floor';
|
if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR) imageType = 'packagecard_icon_floor';
|
||||||
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE) imageType = 'packagecard_icon_landscape';
|
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE) imageType = 'packagecard_icon_landscape';
|
||||||
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_WALLPAPER) imageType = 'packagecard_icon_wallpaper';
|
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_WALLPAPER) imageType = 'packagecard_icon_wallpaper';
|
||||||
|
|
||||||
setImageUrl(getGiftImageUrl(imageType));
|
BatchUpdates(() =>
|
||||||
return;
|
{
|
||||||
}
|
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB: {
|
|
||||||
setObjectId(event.objectId);
|
|
||||||
setClassId(event.classId);
|
|
||||||
setItemType(event.itemType);
|
|
||||||
setText(event.giftMessage);
|
|
||||||
setIsOwnerOfFurniture(event.isController);
|
|
||||||
setImageUrl(getGiftImageUrl('packagecard_icon_hc'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS: {
|
|
||||||
if(!openRequested) return;
|
|
||||||
|
|
||||||
setObjectId(event.objectId);
|
setObjectId(event.objectId);
|
||||||
setClassId(event.classId);
|
setClassId(event.classId);
|
||||||
setItemType(event.itemType);
|
setItemType(event.itemType);
|
||||||
@ -94,7 +82,36 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
setPlacedItemId(event.placedItemId);
|
setPlacedItemId(event.placedItemId);
|
||||||
setPlacedItemType(event.placedItemType);
|
setPlacedItemType(event.placedItemType);
|
||||||
setPlacedInRoom(event.placedInRoom);
|
setPlacedInRoom(event.placedInRoom);
|
||||||
|
setImageUrl(getGiftImageUrl(imageType));
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB: {
|
||||||
|
BatchUpdates(() =>
|
||||||
|
{
|
||||||
|
setObjectId(event.objectId);
|
||||||
|
setClassId(event.classId);
|
||||||
|
setItemType(event.itemType);
|
||||||
|
setText(event.giftMessage);
|
||||||
|
setIsOwnerOfFurniture(event.isController);
|
||||||
|
setImageUrl(getGiftImageUrl('packagecard_icon_hc'));
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS: {
|
||||||
|
if(!openRequested) return;
|
||||||
|
|
||||||
|
BatchUpdates(() =>
|
||||||
|
{
|
||||||
|
setObjectId(event.objectId);
|
||||||
|
setClassId(event.classId);
|
||||||
|
setItemType(event.itemType);
|
||||||
|
setText(event.giftMessage);
|
||||||
|
setIsOwnerOfFurniture(event.isController);
|
||||||
|
setPlacedItemId(event.placedItemId);
|
||||||
|
setPlacedItemType(event.placedItemType);
|
||||||
|
setPlacedInRoom(event.placedInRoom);
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE: {
|
case RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE: {
|
||||||
@ -113,7 +130,7 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
||||||
|
|
||||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
if(event.id === objectId) clearGift();
|
if(event.id === objectId) clearGift();
|
||||||
|
|
||||||
@ -123,9 +140,11 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}, [ objectId, placedItemId, placedInRoom, clearGift ]);
|
}, [ objectId, placedItemId, placedInRoom, clearGift ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
|
|
||||||
const close = useCallback(() =>
|
const close = useCallback(() =>
|
||||||
|
{
|
||||||
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
setObjectId(-1);
|
setObjectId(-1);
|
||||||
setOpenRequested(false);
|
setOpenRequested(false);
|
||||||
@ -133,7 +152,8 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
setPlacedInRoom(false);
|
setPlacedInRoom(false);
|
||||||
setText(null);
|
setText(null);
|
||||||
setIsOwnerOfFurniture(false);
|
setIsOwnerOfFurniture(false);
|
||||||
}, [ clearGift ]);
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
const isSpaces = useMemo(() =>
|
const isSpaces = useMemo(() =>
|
||||||
{
|
{
|
||||||
@ -152,26 +172,25 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
if(objectId === -1) return '';
|
if(objectId === -1) return '';
|
||||||
|
|
||||||
if(isSpaces)
|
if(isSpaces) return 'widget.furni.present.spaces.message_opened';
|
||||||
return 'widget.furni.present.spaces.message_opened';
|
|
||||||
|
|
||||||
return 'widget.furni.present.message_opened';
|
return 'widget.furni.present.message_opened';
|
||||||
}, [ objectId, isSpaces ]);
|
}, [ objectId, isSpaces ]);
|
||||||
|
|
||||||
const handleAction = useCallback((action: string) =>
|
const handleAction = useCallback((action: number) =>
|
||||||
{
|
{
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
case 'give_gift':
|
case ACTION_GIVE_GIFT:
|
||||||
CreateLinkEvent('catalog/open');
|
CreateLinkEvent('catalog/open');
|
||||||
return;
|
return;
|
||||||
case 'open':
|
case ACTION_OPEN:
|
||||||
setOpenRequested(true);
|
setOpenRequested(true);
|
||||||
widgetHandler.processWidgetMessage(new RoomWidgetPresentOpenMessage(RoomWidgetPresentOpenMessage.OPEN_PRESENT, objectId));
|
widgetHandler.processWidgetMessage(new RoomWidgetPresentOpenMessage(RoomWidgetPresentOpenMessage.OPEN_PRESENT, objectId));
|
||||||
return;
|
return;
|
||||||
case 'room':
|
case ACTION_PLACE:
|
||||||
return;
|
return;
|
||||||
case 'inventory':
|
case ACTION_INVENTORY:
|
||||||
if((placedItemId > 0) && placedInRoom)
|
if((placedItemId > 0) && placedInRoom)
|
||||||
{
|
{
|
||||||
if(placedItemType === ProductTypeEnum.PET)
|
if(placedItemType === ProductTypeEnum.PET)
|
||||||
@ -195,32 +214,48 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<NitroCardView className="nitro-gift-opening" simple={ true }>
|
<NitroCardView className="nitro-gift-opening" simple={ true }>
|
||||||
<NitroCardHeaderView headerText={ LocalizeText(senderName ? 'widget.furni.present.window.title_from' : 'widget.furni.present.window.title', ['name'], [senderName]) } onCloseClick={ close } />
|
<NitroCardHeaderView headerText={ LocalizeText(senderName ? 'widget.furni.present.window.title_from' : 'widget.furni.present.window.title', [ 'name' ], [ senderName ]) } onCloseClick={ close } />
|
||||||
<NitroCardContentView>
|
<NitroCardContentView>
|
||||||
{ placedItemId === -1 && <>
|
<NitroLayoutGrid>
|
||||||
|
{ (placedItemId === -1) &&
|
||||||
|
<NitroLayoutGridColumn size={ 12 }>
|
||||||
|
<NitroLayoutFlex className="justify-content-center align-items-center" overflow="auto">
|
||||||
<NitroLayoutGiftCardView userName={ senderName } figure={ senderFigure } message={ text } />
|
<NitroLayoutGiftCardView userName={ senderName } figure={ senderFigure } message={ text } />
|
||||||
{ isOwnerOfFurniture && <div className="d-flex gap-2 mt-2">
|
</NitroLayoutFlex>
|
||||||
{ senderName && <button className="btn btn-primary w-100 text-nowrap" onClick={ () => handleAction('give_gift') }>{ LocalizeText('widget.furni.present.give_gift', ['name'], [senderName]) }</button> }
|
<NitroLayoutFlex gap={ 2 }>
|
||||||
<button className="btn btn-success w-100 text-nowrap" onClick={ () => handleAction('open') }>{ LocalizeText('widget.furni.present.open_gift') }</button>
|
{ senderName &&
|
||||||
</div> }
|
<NitroLayoutButton className="text-nowrap w-100" variant="primary" onClick={ event => handleAction(ACTION_GIVE_GIFT) }>
|
||||||
</> }
|
{ LocalizeText('widget.furni.present.give_gift', [ 'name' ], [ senderName ]) }
|
||||||
{ placedItemId !== -1 && <>
|
</NitroLayoutButton> }
|
||||||
<div className="d-flex gap-2 align-items-center">
|
<NitroLayoutButton className="text-nowrap w-100" variant="success" onClick={ event => handleAction(ACTION_OPEN) }>
|
||||||
<div>
|
{ LocalizeText('widget.furni.present.open_gift') }
|
||||||
|
</NitroLayoutButton>
|
||||||
|
</NitroLayoutFlex>
|
||||||
|
</NitroLayoutGridColumn> }
|
||||||
|
{ (placedItemId > -1) &&
|
||||||
|
<NitroLayoutGridColumn size={ 12 }>
|
||||||
|
<NitroLayoutFlex className="justify-content-center align-items-center" overflow="auto" gap={ 2 }>
|
||||||
<img src={ imageUrl } alt="" />
|
<img src={ imageUrl } alt="" />
|
||||||
</div>
|
<NitroLayoutBase className="text-black">
|
||||||
<div className="bg-muted rounded p-2 text-center text-black">
|
{ LocalizeText(productName, [ 'product' ], [ text ]) }
|
||||||
{ LocalizeText(productName, ['product'], [text]) }
|
</NitroLayoutBase>
|
||||||
</div>
|
</NitroLayoutFlex>
|
||||||
</div>
|
<NitroLayoutFlexColumn gap={ 2 }>
|
||||||
<div className="d-flex gap-2 mt-3">
|
<NitroLayoutFlex gap={ 2 }>
|
||||||
<button className="btn btn-primary w-100 text-nowrap" onClick={ () => handleAction('inventory') }>{ LocalizeText('widget.furni.present.put_in_inventory') }</button>
|
<NitroLayoutButton className="w-100" variant="primary" onClick={ event => handleAction(ACTION_INVENTORY) }>
|
||||||
<button className="btn btn-success w-100 text-nowrap" onClick={ () => handleAction('room') }>{ LocalizeText(placedInRoom ? 'widget.furni.present.keep_in_room' : 'widget.furni.present.place_in_room') }</button>
|
{ LocalizeText('widget.furni.present.put_in_inventory') }
|
||||||
</div>
|
</NitroLayoutButton>
|
||||||
{ senderName && <>
|
<NitroLayoutButton className="w-100" variant="success" onClick={ event => handleAction(ACTION_PLACE) }>
|
||||||
<button className="btn btn-primary w-100 text-nowrap mt-2" onClick={ () => handleAction('give_gift') }>{ LocalizeText('widget.furni.present.give_gift', ['name'], [senderName]) }</button>
|
{ LocalizeText(placedInRoom ? 'widget.furni.present.keep_in_room' : 'widget.furni.present.place_in_room') }
|
||||||
</> }
|
</NitroLayoutButton>
|
||||||
</> }
|
</NitroLayoutFlex>
|
||||||
|
{ (senderName && senderName.length) &&
|
||||||
|
<NitroLayoutButton className="w-100" variant="primary" onClick={ event => handleAction(ACTION_GIVE_GIFT) }>
|
||||||
|
{ LocalizeText('widget.furni.present.give_gift', [ 'name' ], [ senderName ]) }
|
||||||
|
</NitroLayoutButton> }
|
||||||
|
</NitroLayoutFlexColumn>
|
||||||
|
</NitroLayoutGridColumn> }
|
||||||
|
</NitroLayoutGrid>
|
||||||
</NitroCardContentView>
|
</NitroCardContentView>
|
||||||
</NitroCardView>
|
</NitroCardView>
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
.highscore-widget
|
.nitro-widget-high-score
|
||||||
{
|
{
|
||||||
width: 150px;
|
width: 250px;
|
||||||
max-width: 150px;
|
max-width: 250px;
|
||||||
|
height: 200px;
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,15 @@ import { HighScoreDataType, ObjectDataFactory, RoomEngineTriggerWidgetEvent, Roo
|
|||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { GetRoomEngine, LocalizeText } from '../../../../../api';
|
import { GetRoomEngine, LocalizeText } from '../../../../../api';
|
||||||
import { useRoomEngineEvent } from '../../../../../hooks';
|
import { useRoomEngineEvent } from '../../../../../hooks';
|
||||||
|
import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../layout';
|
||||||
|
import { NitroLayoutBase } from '../../../../../layout/base';
|
||||||
import { useRoomContext } from '../../../context/RoomContext';
|
import { useRoomContext } from '../../../context/RoomContext';
|
||||||
import { ContextMenuView } from '../../context-menu/ContextMenuView';
|
import { ContextMenuView } from '../../context-menu/ContextMenuView';
|
||||||
import { ContextMenuHeaderView } from '../../context-menu/views/header/ContextMenuHeaderView';
|
import { ContextMenuHeaderView } from '../../context-menu/views/header/ContextMenuHeaderView';
|
||||||
import { ContextMenuListView } from '../../context-menu/views/list/ContextMenuListView';
|
import { ContextMenuListView } from '../../context-menu/views/list/ContextMenuListView';
|
||||||
|
|
||||||
const SCORE_TYPES = ['perteam', 'mostwins', 'classic'];
|
const SCORE_TYPES = [ 'perteam', 'mostwins', 'classic' ];
|
||||||
const CLEAR_TYPES = ['alltime', 'daily', 'weekly', 'monthly'];
|
const CLEAR_TYPES = [ 'alltime', 'daily', 'weekly', 'monthly' ];
|
||||||
|
|
||||||
export const FurnitureHighScoreView: FC<{}> = props =>
|
export const FurnitureHighScoreView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
@ -55,33 +57,48 @@ export const FurnitureHighScoreView: FC<{}> = props =>
|
|||||||
if((objectId === -1) || !stuffData) return null;
|
if((objectId === -1) || !stuffData) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContextMenuView objectId={ objectId } category={ RoomObjectCategory.FLOOR } close={ close } fades={ false } className="highscore-widget">
|
<ContextMenuView objectId={ objectId } category={ RoomObjectCategory.FLOOR } close={ close } fades={ false } className="nitro-widget-high-score">
|
||||||
<ContextMenuHeaderView>
|
<ContextMenuHeaderView>
|
||||||
{ LocalizeText('high.score.display.caption', [ 'scoretype', 'cleartype' ], [LocalizeText(`high.score.display.scoretype.${ SCORE_TYPES[stuffData.scoreType] }`), LocalizeText(`high.score.display.cleartype.${ CLEAR_TYPES[stuffData.clearType] }`) ]) }
|
{ LocalizeText('high.score.display.caption', [ 'scoretype', 'cleartype' ], [LocalizeText(`high.score.display.scoretype.${ SCORE_TYPES[stuffData.scoreType] }`), LocalizeText(`high.score.display.cleartype.${ CLEAR_TYPES[stuffData.clearType] }`) ]) }
|
||||||
</ContextMenuHeaderView>
|
</ContextMenuHeaderView>
|
||||||
<ContextMenuListView>
|
<ContextMenuListView>
|
||||||
<div className="row">
|
<NitroLayoutGrid>
|
||||||
<div className="col-6">{ LocalizeText('high.score.display.users.header') }</div>
|
<NitroLayoutGridColumn size={ 6 }>
|
||||||
<div className="col-6">{ LocalizeText('high.score.display.score.header') }</div>
|
<NitroLayoutBase className="text-center fw-bold">
|
||||||
</div>
|
{ LocalizeText('high.score.display.users.header') }
|
||||||
<div className="row">
|
</NitroLayoutBase>
|
||||||
<div className="col-6">
|
</NitroLayoutGridColumn>
|
||||||
<div className="container h-100">
|
<NitroLayoutGridColumn size={ 6 }>
|
||||||
|
<NitroLayoutBase className="text-center fw-bold">
|
||||||
|
{ LocalizeText('high.score.display.score.header') }
|
||||||
|
</NitroLayoutBase>
|
||||||
|
</NitroLayoutGridColumn>
|
||||||
|
</NitroLayoutGrid>
|
||||||
|
<hr className="m-0 my-1" />
|
||||||
|
<NitroLayoutGrid overflow="hidden">
|
||||||
|
<NitroLayoutGridColumn size={ 6 }>
|
||||||
{ stuffData.entries.map((entry, index) =>
|
{ stuffData.entries.map((entry, index) =>
|
||||||
{
|
{
|
||||||
return <div key={ index }>{entry.users.join()}</div>
|
return (
|
||||||
|
<NitroLayoutBase key={ index } className="text-center">
|
||||||
|
{ entry.users.join(', ') }
|
||||||
|
</NitroLayoutBase>
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</div>
|
</NitroLayoutGridColumn>
|
||||||
</div>
|
<NitroLayoutGridColumn size={ 6 }>
|
||||||
<div className="col-6">
|
|
||||||
{ stuffData.entries.map((entry, index) =>
|
{ stuffData.entries.map((entry, index) =>
|
||||||
{
|
{
|
||||||
return <div key={ index }>{entry.score}</div>
|
return (
|
||||||
|
<NitroLayoutBase key={ index } className="text-center">
|
||||||
|
{ entry.score }
|
||||||
|
</NitroLayoutBase>
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</div>
|
</NitroLayoutGridColumn>
|
||||||
</div>
|
</NitroLayoutGrid>
|
||||||
</ContextMenuListView>
|
</ContextMenuListView>
|
||||||
</ContextMenuView>
|
</ContextMenuView>
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
import { RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { ProcessRoomObjectOperation, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateDecorateModeEvent } from '../../../../../api';
|
import { ProcessRoomObjectOperation, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
import { BatchUpdates } from '../../../../../hooks';
|
import { BatchUpdates } from '../../../../../hooks';
|
||||||
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
||||||
import { useRoomContext } from '../../../context/RoomContext';
|
import { useRoomContext } from '../../../context/RoomContext';
|
||||||
@ -28,11 +28,11 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
|||||||
ProcessRoomObjectOperation(objectId, objectType, RoomObjectOperationType.OBJECT_PICKUP);
|
ProcessRoomObjectOperation(objectId, objectType, RoomObjectOperationType.OBJECT_PICKUP);
|
||||||
}, [ objectId, objectType ]);
|
}, [ objectId, objectType ]);
|
||||||
|
|
||||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION: {
|
||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
setIsVisible(true);
|
setIsVisible(true);
|
||||||
@ -41,7 +41,7 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
if(event.id === objectId)
|
if(event.id === objectId)
|
||||||
{
|
{
|
||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
@ -53,7 +53,7 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED: {
|
||||||
BatchUpdates(() =>
|
BatchUpdates(() =>
|
||||||
{
|
{
|
||||||
setIsVisible(false);
|
setIsVisible(false);
|
||||||
@ -65,8 +65,8 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}, [ objectId ]);
|
}, [ objectId ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||||
|
|
||||||
const onRoomWidgetUpdateDecorateModeEvent = useCallback((event: RoomWidgetUpdateDecorateModeEvent) =>
|
const onRoomWidgetUpdateDecorateModeEvent = useCallback((event: RoomWidgetUpdateDecorateModeEvent) =>
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
top: 25px;
|
top: 25px;
|
||||||
left: 25px;
|
left: 25px;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
|
pointer-events: all;
|
||||||
|
|
||||||
.stickie-header {
|
.stickie-header {
|
||||||
width: 183px;
|
width: 183px;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { ColorUtils, GetRoomEngine, GetRoomSession, GetSessionDataManager, RoomWidgetRoomObjectUpdateEvent } from '../../../../../api';
|
import { ColorUtils, GetRoomEngine, GetRoomSession, GetSessionDataManager, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
||||||
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||||
import { DraggableWindowPosition } from '../../../../../layout';
|
import { DraggableWindowPosition } from '../../../../../layout';
|
||||||
@ -45,8 +45,8 @@ export const FurnitureStickieView: FC<{}> = props =>
|
|||||||
setStickieData(new FurnitureStickieData(widgetEvent.objectId, widgetEvent.category, color, text, (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator), false));
|
setStickieData(new FurnitureStickieData(widgetEvent.objectId, widgetEvent.category, color, text, (GetRoomSession().isRoomOwner || GetSessionDataManager().isModerator), false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
setStickieData(prevState =>
|
setStickieData(prevState =>
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ export const FurnitureStickieView: FC<{}> = props =>
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, onNitroEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, onNitroEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
||||||
|
|
||||||
const processAction = useCallback((type: string, value: string = null) =>
|
const processAction = useCallback((type: string, value: string = null) =>
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { RoomWidgetRoomObjectMessage, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateInfostandEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent } from '../../../../api';
|
import { RoomWidgetRoomObjectMessage, RoomWidgetUpdateEvent, RoomWidgetUpdateInfostandEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||||
import { CreateEventDispatcherHook } from '../../../../hooks/events/event-dispatcher.base';
|
import { CreateEventDispatcherHook } from '../../../../hooks/events/event-dispatcher.base';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { InfoStandWidgetBotView } from './views/bot/InfoStandWidgetBotView';
|
import { InfoStandWidgetBotView } from './views/bot/InfoStandWidgetBotView';
|
||||||
@ -22,33 +22,33 @@ export const InfoStandWidgetView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_SELECTED: {
|
||||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
widgetHandler.processWidgetMessage(new RoomWidgetRoomObjectMessage(RoomWidgetRoomObjectMessage.GET_OBJECT_INFO, roomObjectEvent.id, roomObjectEvent.category));
|
widgetHandler.processWidgetMessage(new RoomWidgetRoomObjectMessage(RoomWidgetRoomObjectMessage.GET_OBJECT_INFO, roomObjectEvent.id, roomObjectEvent.category));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED: {
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED: {
|
||||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
closeInfostand();
|
closeInfostand();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED: {
|
||||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
setInfoStandEvent(prevValue =>
|
setInfoStandEvent(prevValue =>
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||||
if(prevValue instanceof RoomWidgetUpdateInfostandFurniEvent)
|
if(prevValue instanceof RoomWidgetUpdateInfostandFurniEvent)
|
||||||
{
|
{
|
||||||
if(prevValue.id === roomObjectEvent.id) return null;
|
if(prevValue.id === roomObjectEvent.id) return null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED:
|
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED:
|
||||||
if(prevValue instanceof RoomWidgetUpdateInfostandUserEvent || prevValue instanceof RoomWidgetUpdateInfostandRentableBotEvent)
|
if(prevValue instanceof RoomWidgetUpdateInfostandUserEvent || prevValue instanceof RoomWidgetUpdateInfostandRentableBotEvent)
|
||||||
{
|
{
|
||||||
if(prevValue.roomIndex === roomObjectEvent.id) return null;
|
if(prevValue.roomIndex === roomObjectEvent.id) return null;
|
||||||
@ -80,10 +80,10 @@ export const InfoStandWidgetView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}, [ widgetHandler, closeInfostand ]);
|
}, [ widgetHandler, closeInfostand ]);
|
||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_SELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandFurniEvent.FURNI, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandFurniEvent.FURNI, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.OWN_USER, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.OWN_USER, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user