mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +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 { 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 { NotificationAlertType } from '../../notification-center/common/NotificationAlertType';
|
||||
import { NotificationUtilities } from '../../notification-center/common/NotificationUtilities';
|
||||
@ -27,10 +27,10 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomEngineEvent.NORMAL_MODE:
|
||||
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, event.roomId));
|
||||
eventDispatcher.dispatchEvent(new RoomWidgetUpdateRoomEngineEvent(RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE, event.roomId));
|
||||
return;
|
||||
case RoomEngineEvent.GAME_MODE:
|
||||
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, event.roomId));
|
||||
eventDispatcher.dispatchEvent(new RoomWidgetUpdateRoomEngineEvent(RoomWidgetUpdateRoomEngineEvent.GAME_MODE, event.roomId));
|
||||
return;
|
||||
case RoomZoomEvent.ROOM_ZOOM: {
|
||||
const zoomEvent = (event as RoomZoomEvent);
|
||||
@ -67,15 +67,15 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||
const objectId = event.objectId;
|
||||
const category = event.category;
|
||||
|
||||
let updateEvent: RoomWidgetRoomObjectUpdateEvent = null;
|
||||
let updateEvent: RoomWidgetUpdateRoomObjectEvent = null;
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
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;
|
||||
case RoomEngineObjectEvent.DESELECTED:
|
||||
updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
||||
updateEvent = new RoomWidgetUpdateRoomObjectEvent(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, objectId, category, event.roomId);
|
||||
break;
|
||||
case RoomEngineObjectEvent.ADDED: {
|
||||
let addedEventType: string = null;
|
||||
@ -84,14 +84,14 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||
{
|
||||
case RoomObjectCategory.FLOOR:
|
||||
case RoomObjectCategory.WALL:
|
||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED;
|
||||
addedEventType = RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED;
|
||||
break;
|
||||
case RoomObjectCategory.UNIT:
|
||||
addedEventType = RoomWidgetRoomObjectUpdateEvent.USER_ADDED;
|
||||
addedEventType = RoomWidgetUpdateRoomObjectEvent.USER_ADDED;
|
||||
break;
|
||||
}
|
||||
|
||||
if(addedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(addedEventType, objectId, category, event.roomId);
|
||||
if(addedEventType) updateEvent = new RoomWidgetUpdateRoomObjectEvent(addedEventType, objectId, category, event.roomId);
|
||||
break;
|
||||
}
|
||||
case RoomEngineObjectEvent.REMOVED: {
|
||||
@ -101,14 +101,14 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||
{
|
||||
case RoomObjectCategory.FLOOR:
|
||||
case RoomObjectCategory.WALL:
|
||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED;
|
||||
removedEventType = RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED;
|
||||
break;
|
||||
case RoomObjectCategory.UNIT:
|
||||
removedEventType = RoomWidgetRoomObjectUpdateEvent.USER_REMOVED;
|
||||
removedEventType = RoomWidgetUpdateRoomObjectEvent.USER_REMOVED;
|
||||
break;
|
||||
}
|
||||
|
||||
if(removedEventType) updateEvent = new RoomWidgetRoomObjectUpdateEvent(removedEventType, objectId, category, event.roomId);
|
||||
if(removedEventType) updateEvent = new RoomWidgetUpdateRoomObjectEvent(removedEventType, objectId, category, event.roomId);
|
||||
break;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
case RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI:
|
||||
widgetHandler.processWidgetMessage(new RoomWidgetFurniToWidgetMessage(RoomWidgetFurniToWidgetMessage.REQUEST_CREDITFURNI, objectId, category, event.roomId));
|
||||
@ -202,7 +202,7 @@ export const RoomWidgetsView: FC<RoomWidgetViewProps> = props =>
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RoomEnterEffect, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
||||
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 { useRoomContext } from '../../context/RoomContext';
|
||||
import { AvatarInfoWidgetAvatarView } from './views/avatar/AvatarInfoWidgetAvatarView';
|
||||
@ -73,25 +73,25 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
||||
setProductBubbles([]);
|
||||
}, []);
|
||||
|
||||
const onRoomWidgetRoomEngineUpdateEvent = useCallback((event: RoomWidgetRoomEngineUpdateEvent) =>
|
||||
const onRoomWidgetRoomEngineUpdateEvent = useCallback((event: RoomWidgetUpdateRoomEngineEvent) =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE: {
|
||||
case RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE: {
|
||||
if(isGameMode) setGameMode(false);
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomEngineUpdateEvent.GAME_MODE: {
|
||||
case RoomWidgetUpdateRoomEngineEvent.GAME_MODE: {
|
||||
if(!isGameMode) setGameMode(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, [ isGameMode ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomEngineUpdateEvent.NORMAL_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomEngineUpdateEvent.GAME_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.GAME_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
||||
|
||||
const onRoomObjectRemoved = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomObjectRemoved = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
if(name)
|
||||
{
|
||||
@ -152,15 +152,15 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
||||
}
|
||||
}, [ name, infoStandEvent, nameBubbles, productBubbles, removeNameBubble, clearInfoStandEvent ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
||||
|
||||
const onObjectRolled = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onObjectRolled = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER: {
|
||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER: {
|
||||
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
if(infoStandEvent) return;
|
||||
|
||||
@ -168,8 +168,8 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
||||
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT: {
|
||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT: {
|
||||
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
if(!name || (name.roomIndex !== roomObjectEvent.id)) return;
|
||||
|
||||
@ -180,16 +180,16 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
||||
}
|
||||
}, [ infoStandEvent, name, widgetHandler ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OVER, eventDispatcher, onObjectRolled);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_ROLL_OUT, eventDispatcher, onObjectRolled);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER, eventDispatcher, onObjectRolled);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT, eventDispatcher, onObjectRolled);
|
||||
|
||||
const onObjectDeselected = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onObjectDeselected = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
if(infoStandEvent) clearInfoStandEvent();
|
||||
if(productBubbles.length) setProductBubbles([]);
|
||||
}, [ infoStandEvent, productBubbles, clearInfoStandEvent ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onObjectDeselected);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onObjectDeselected);
|
||||
|
||||
const onRoomWidgetObjectNameEvent = useCallback((event: RoomWidgetObjectNameEvent) =>
|
||||
{
|
||||
|
@ -71,7 +71,7 @@
|
||||
max-height: $chat-input-style-selector-widget-height;
|
||||
|
||||
.content-area {
|
||||
max-height: $chat-input-style-selector-widget-height;
|
||||
max-height: $chat-input-style-selector-widget-height !important;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { HabboClubLevelEnum, RoomControllerLevel } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
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 { useRoomContext } from '../../context/RoomContext';
|
||||
import { ChatInputStyleSelectorView } from './style-selector/ChatInputStyleSelectorView';
|
||||
@ -177,12 +177,12 @@ export const ChatInputView: FC<{}> = props =>
|
||||
|
||||
}, [ inputRef, chatModeIdWhisper, anotherInputHasFocus, setInputFocus, checkSpecialKeywordForInput, sendChatValue ]);
|
||||
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
setSelectedUsername('');
|
||||
}, []);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
|
||||
const onRoomWidgetUpdateInfostandUserEvent = useCallback((event: RoomWidgetUpdateInfostandUserEvent) =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { useRoomContext } from '../../context/RoomContext';
|
||||
import { ChooserWidgetView } from './ChooserWidgetView';
|
||||
@ -31,21 +31,21 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
||||
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
if(!isVisible) return;
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED:
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||
refreshChooser();
|
||||
return;
|
||||
}
|
||||
}, [ isVisible, refreshChooser ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
|
||||
const close = useCallback(() =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { useRoomContext } from '../../context/RoomContext';
|
||||
import { ChooserWidgetView } from './ChooserWidgetView';
|
||||
@ -31,21 +31,21 @@ export const UserChooserWidgetView: FC<{}> = props =>
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetChooserContentEvent.USER_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
|
||||
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
if(!isVisible) return;
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.USER_ADDED:
|
||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.USER_ADDED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED:
|
||||
refreshChooser();
|
||||
return;
|
||||
}
|
||||
}, [ isVisible, refreshChooser ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_ADDED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
|
||||
const close = useCallback(() =>
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
border-radius: $border-radius;
|
||||
font-size: $font-size-sm;
|
||||
z-index: $context-menu-zindex;
|
||||
pointer-events: all;
|
||||
|
||||
&.name-only {
|
||||
background-color: rgba($black, 0.5);
|
||||
@ -34,8 +35,7 @@
|
||||
.menu-header {
|
||||
background-color: $william;
|
||||
color: $white;
|
||||
width: 117px;
|
||||
max-width: 117px;
|
||||
min-width: 117px;
|
||||
height: 25px;
|
||||
max-height: 25px;
|
||||
font-size: 16px;
|
||||
|
@ -1,3 +1,9 @@
|
||||
.nitro-room-widgets {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@import './custom-stack-height/FurnitureCustomStackHeightView';
|
||||
|
||||
@import './dimmer/FurnitureDimmerView';
|
||||
@import './exchange-credit/FurnitureExchangeCreditView';
|
||||
@import './external-image/FurnitureExternalImageView';
|
||||
|
@ -17,7 +17,7 @@ import { FurnitureTrophyView } from './trophy/FurnitureTrophyView';
|
||||
export const FurnitureWidgetsView: FC<{}> = props =>
|
||||
{
|
||||
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 />
|
||||
<FurnitureContextMenuView />
|
||||
<FurnitureCustomStackHeightView />
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ApplyTonerComposer, RoomControllerLevel, RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
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 { CreateEventDispatcherHook, useRoomEngineEvent } from '../../../../../hooks/events';
|
||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout';
|
||||
@ -48,7 +48,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
|
||||
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||
if(objectId !== event.objectId) return;
|
||||
|
||||
close();
|
||||
@ -58,7 +58,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
|
||||
}, [ objectId, canOpenBackgroundToner, close ]);
|
||||
|
||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, onRoomEngineObjectEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomEngineObjectEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomEngineObjectEvent);
|
||||
|
||||
const processAction = useCallback((name: string) =>
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NitroEvent, RoomEngineTriggerWidgetEvent, StringDataType } from '@nitrots/nitro-renderer';
|
||||
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 { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||
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));
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
setTrophyData(prevState =>
|
||||
{
|
||||
@ -52,7 +52,7 @@ export const FurnitureBadgeDisplayView: FC<{}> = props =>
|
||||
|
||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_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) =>
|
||||
{
|
||||
|
@ -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 {
|
||||
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;
|
||||
|
||||
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 } />
|
||||
<NitroCardContentView>
|
||||
<NitroLayoutGrid>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FriendFurniConfirmLockMessageComposer, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||
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 { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||
import { CreateMessageHook } from '../../../../../hooks/messages/message-event';
|
||||
@ -37,8 +37,8 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
setEngravingLockData(prevState =>
|
||||
{
|
||||
@ -52,7 +52,7 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
|
||||
};
|
||||
|
||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, onNitroEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onNitroEvent);
|
||||
|
||||
const onLoveLockFurniStartEvent = useCallback((event: LoveLockFurniStartEvent) =>
|
||||
{
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { RoomObjectCategory, RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
||||
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 { 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 { useRoomContext } from '../../../context/RoomContext';
|
||||
|
||||
@ -10,6 +12,11 @@ const FLOOR: string = 'floor';
|
||||
const WALLPAPER: string = 'wallpaper';
|
||||
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 =>
|
||||
{
|
||||
const [ objectId, setObjectId ] = useState(-1);
|
||||
@ -44,6 +51,8 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetUpdatePresentDataEvent.PACKAGEINFO: {
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setOpenRequested(false);
|
||||
setObjectId(event.objectId);
|
||||
setText(event.giftMessage);
|
||||
@ -51,41 +60,20 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
setSenderName(event.purchaserName);
|
||||
setSenderFigure(event.purchaserFigure);
|
||||
setImageUrl(event.imageUrl);
|
||||
});
|
||||
return;
|
||||
}
|
||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR:
|
||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE:
|
||||
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;
|
||||
|
||||
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_WALLPAPER) imageType = 'packagecard_icon_wallpaper';
|
||||
|
||||
setImageUrl(getGiftImageUrl(imageType));
|
||||
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;
|
||||
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setObjectId(event.objectId);
|
||||
setClassId(event.classId);
|
||||
setItemType(event.itemType);
|
||||
@ -94,7 +82,36 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
setPlacedItemId(event.placedItemId);
|
||||
setPlacedItemType(event.placedItemType);
|
||||
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;
|
||||
}
|
||||
case RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE: {
|
||||
@ -113,7 +130,7 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE, eventDispatcher, onRoomWidgetUpdatePresentDataEvent);
|
||||
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
if(event.id === objectId) clearGift();
|
||||
|
||||
@ -123,9 +140,11 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
}
|
||||
}, [ objectId, placedItemId, placedInRoom, clearGift ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
|
||||
const close = useCallback(() =>
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setObjectId(-1);
|
||||
setOpenRequested(false);
|
||||
@ -133,7 +152,8 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
setPlacedInRoom(false);
|
||||
setText(null);
|
||||
setIsOwnerOfFurniture(false);
|
||||
}, [ clearGift ]);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const isSpaces = useMemo(() =>
|
||||
{
|
||||
@ -152,26 +172,25 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
{
|
||||
if(objectId === -1) return '';
|
||||
|
||||
if(isSpaces)
|
||||
return 'widget.furni.present.spaces.message_opened';
|
||||
if(isSpaces) return 'widget.furni.present.spaces.message_opened';
|
||||
|
||||
return 'widget.furni.present.message_opened';
|
||||
}, [ objectId, isSpaces ]);
|
||||
|
||||
const handleAction = useCallback((action: string) =>
|
||||
const handleAction = useCallback((action: number) =>
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case 'give_gift':
|
||||
case ACTION_GIVE_GIFT:
|
||||
CreateLinkEvent('catalog/open');
|
||||
return;
|
||||
case 'open':
|
||||
case ACTION_OPEN:
|
||||
setOpenRequested(true);
|
||||
widgetHandler.processWidgetMessage(new RoomWidgetPresentOpenMessage(RoomWidgetPresentOpenMessage.OPEN_PRESENT, objectId));
|
||||
return;
|
||||
case 'room':
|
||||
case ACTION_PLACE:
|
||||
return;
|
||||
case 'inventory':
|
||||
case ACTION_INVENTORY:
|
||||
if((placedItemId > 0) && placedInRoom)
|
||||
{
|
||||
if(placedItemType === ProductTypeEnum.PET)
|
||||
@ -197,30 +216,46 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
|
||||
<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 } />
|
||||
<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 } />
|
||||
{ isOwnerOfFurniture && <div className="d-flex gap-2 mt-2">
|
||||
{ senderName && <button className="btn btn-primary w-100 text-nowrap" onClick={ () => handleAction('give_gift') }>{ LocalizeText('widget.furni.present.give_gift', ['name'], [senderName]) }</button> }
|
||||
<button className="btn btn-success w-100 text-nowrap" onClick={ () => handleAction('open') }>{ LocalizeText('widget.furni.present.open_gift') }</button>
|
||||
</div> }
|
||||
</> }
|
||||
{ placedItemId !== -1 && <>
|
||||
<div className="d-flex gap-2 align-items-center">
|
||||
<div>
|
||||
</NitroLayoutFlex>
|
||||
<NitroLayoutFlex gap={ 2 }>
|
||||
{ senderName &&
|
||||
<NitroLayoutButton className="text-nowrap w-100" variant="primary" onClick={ event => handleAction(ACTION_GIVE_GIFT) }>
|
||||
{ LocalizeText('widget.furni.present.give_gift', [ 'name' ], [ senderName ]) }
|
||||
</NitroLayoutButton> }
|
||||
<NitroLayoutButton className="text-nowrap w-100" variant="success" onClick={ event => handleAction(ACTION_OPEN) }>
|
||||
{ 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="" />
|
||||
</div>
|
||||
<div className="bg-muted rounded p-2 text-center text-black">
|
||||
<NitroLayoutBase className="text-black">
|
||||
{ LocalizeText(productName, [ 'product' ], [ text ]) }
|
||||
</div>
|
||||
</div>
|
||||
<div className="d-flex gap-2 mt-3">
|
||||
<button className="btn btn-primary w-100 text-nowrap" onClick={ () => handleAction('inventory') }>{ LocalizeText('widget.furni.present.put_in_inventory') }</button>
|
||||
<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>
|
||||
</div>
|
||||
{ senderName && <>
|
||||
<button className="btn btn-primary w-100 text-nowrap mt-2" onClick={ () => handleAction('give_gift') }>{ LocalizeText('widget.furni.present.give_gift', ['name'], [senderName]) }</button>
|
||||
</> }
|
||||
</> }
|
||||
</NitroLayoutBase>
|
||||
</NitroLayoutFlex>
|
||||
<NitroLayoutFlexColumn gap={ 2 }>
|
||||
<NitroLayoutFlex gap={ 2 }>
|
||||
<NitroLayoutButton className="w-100" variant="primary" onClick={ event => handleAction(ACTION_INVENTORY) }>
|
||||
{ LocalizeText('widget.furni.present.put_in_inventory') }
|
||||
</NitroLayoutButton>
|
||||
<NitroLayoutButton className="w-100" variant="success" onClick={ event => handleAction(ACTION_PLACE) }>
|
||||
{ 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>
|
||||
</NitroCardView>
|
||||
);
|
||||
|
@ -1,5 +1,6 @@
|
||||
.highscore-widget
|
||||
.nitro-widget-high-score
|
||||
{
|
||||
width: 150px;
|
||||
max-width: 150px;
|
||||
width: 250px;
|
||||
max-width: 250px;
|
||||
height: 200px;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import { HighScoreDataType, ObjectDataFactory, RoomEngineTriggerWidgetEvent, Roo
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { GetRoomEngine, LocalizeText } from '../../../../../api';
|
||||
import { useRoomEngineEvent } from '../../../../../hooks';
|
||||
import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../layout';
|
||||
import { NitroLayoutBase } from '../../../../../layout/base';
|
||||
import { useRoomContext } from '../../../context/RoomContext';
|
||||
import { ContextMenuView } from '../../context-menu/ContextMenuView';
|
||||
import { ContextMenuHeaderView } from '../../context-menu/views/header/ContextMenuHeaderView';
|
||||
@ -55,33 +57,48 @@ export const FurnitureHighScoreView: FC<{}> = props =>
|
||||
if((objectId === -1) || !stuffData) return null;
|
||||
|
||||
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>
|
||||
{ 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>
|
||||
<ContextMenuListView>
|
||||
<div className="row">
|
||||
<div className="col-6">{ LocalizeText('high.score.display.users.header') }</div>
|
||||
<div className="col-6">{ LocalizeText('high.score.display.score.header') }</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-6">
|
||||
<div className="container h-100">
|
||||
<NitroLayoutGrid>
|
||||
<NitroLayoutGridColumn size={ 6 }>
|
||||
<NitroLayoutBase className="text-center fw-bold">
|
||||
{ LocalizeText('high.score.display.users.header') }
|
||||
</NitroLayoutBase>
|
||||
</NitroLayoutGridColumn>
|
||||
<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) =>
|
||||
{
|
||||
return <div key={ index }>{entry.users.join()}</div>
|
||||
return (
|
||||
<NitroLayoutBase key={ index } className="text-center">
|
||||
{ entry.users.join(', ') }
|
||||
</NitroLayoutBase>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-6">
|
||||
</NitroLayoutGridColumn>
|
||||
<NitroLayoutGridColumn size={ 6 }>
|
||||
{ stuffData.entries.map((entry, index) =>
|
||||
{
|
||||
return <div key={ index }>{entry.score}</div>
|
||||
return (
|
||||
<NitroLayoutBase key={ index } className="text-center">
|
||||
{ entry.score }
|
||||
</NitroLayoutBase>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</NitroLayoutGridColumn>
|
||||
</NitroLayoutGrid>
|
||||
</ContextMenuListView>
|
||||
</ContextMenuView>
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RoomObjectOperationType } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { ProcessRoomObjectOperation, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateDecorateModeEvent } from '../../../../../api';
|
||||
import { ProcessRoomObjectOperation, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
|
||||
import { BatchUpdates } from '../../../../../hooks';
|
||||
import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base';
|
||||
import { useRoomContext } from '../../../context/RoomContext';
|
||||
@ -28,11 +28,11 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
||||
ProcessRoomObjectOperation(objectId, objectType, RoomObjectOperationType.OBJECT_PICKUP);
|
||||
}, [ objectId, objectType ]);
|
||||
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetRoomObjectUpdateEvent) =>
|
||||
const onRoomWidgetRoomObjectUpdateEvent = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION: {
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION: {
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setIsVisible(true);
|
||||
@ -41,7 +41,7 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
||||
});
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||
if(event.id === objectId)
|
||||
{
|
||||
BatchUpdates(() =>
|
||||
@ -53,7 +53,7 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED: {
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED: {
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setIsVisible(false);
|
||||
@ -65,8 +65,8 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
|
||||
}
|
||||
}, [ objectId ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetRoomObjectUpdateEvent);
|
||||
|
||||
const onRoomWidgetUpdateDecorateModeEvent = useCallback((event: RoomWidgetUpdateDecorateModeEvent) =>
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
top: 25px;
|
||||
left: 25px;
|
||||
padding: 1px;
|
||||
pointer-events: all;
|
||||
|
||||
.stickie-header {
|
||||
width: 183px;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||
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 { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event';
|
||||
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));
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
setStickieData(prevState =>
|
||||
{
|
||||
@ -60,7 +60,7 @@ export const FurnitureStickieView: FC<{}> = props =>
|
||||
}, []);
|
||||
|
||||
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) =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { useRoomContext } from '../../context/RoomContext';
|
||||
import { InfoStandWidgetBotView } from './views/bot/InfoStandWidgetBotView';
|
||||
@ -22,33 +22,33 @@ export const InfoStandWidgetView: FC<{}> = props =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED: {
|
||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_SELECTED: {
|
||||
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
widgetHandler.processWidgetMessage(new RoomWidgetRoomObjectMessage(RoomWidgetRoomObjectMessage.GET_OBJECT_INFO, roomObjectEvent.id, roomObjectEvent.category));
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED: {
|
||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED: {
|
||||
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
closeInfostand();
|
||||
return;
|
||||
}
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED: {
|
||||
const roomObjectEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED: {
|
||||
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||
|
||||
setInfoStandEvent(prevValue =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED:
|
||||
if(prevValue instanceof RoomWidgetUpdateInfostandFurniEvent)
|
||||
{
|
||||
if(prevValue.id === roomObjectEvent.id) return null;
|
||||
}
|
||||
break;
|
||||
case RoomWidgetRoomObjectUpdateEvent.USER_REMOVED:
|
||||
case RoomWidgetUpdateRoomObjectEvent.USER_REMOVED:
|
||||
if(prevValue instanceof RoomWidgetUpdateInfostandUserEvent || prevValue instanceof RoomWidgetUpdateInfostandRentableBotEvent)
|
||||
{
|
||||
if(prevValue.roomIndex === roomObjectEvent.id) return null;
|
||||
@ -80,10 +80,10 @@ export const InfoStandWidgetView: FC<{}> = props =>
|
||||
}
|
||||
}, [ widgetHandler, closeInfostand ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_SELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.USER_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_SELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandFurniEvent.FURNI, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.OWN_USER, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user