mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Update trophy
This commit is contained in:
parent
86e316a559
commit
b54e18bf01
@ -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 { GetRoomEngine, RoomWidgetRoomObjectUpdateEvent } from '../../../../../api';
|
import { GetRoomEngine, 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 { NitroLayoutTrophyView } from '../../../../../layout';
|
import { NitroLayoutTrophyView } from '../../../../../layout';
|
||||||
@ -9,6 +9,7 @@ import { FurnitureTrophyData } from './FurnitureTrophyData';
|
|||||||
|
|
||||||
export const FurnitureTrophyView: FC<{}> = props =>
|
export const FurnitureTrophyView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
|
|
||||||
const { eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
const { eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
||||||
const [ trophyData, setTrophyData ] = useState<FurnitureTrophyData>(null);
|
const [ trophyData, setTrophyData ] = useState<FurnitureTrophyData>(null);
|
||||||
|
|
||||||
@ -39,8 +40,8 @@ export const FurnitureTrophyView: FC<{}> = props =>
|
|||||||
setTrophyData(new FurnitureTrophyData(widgetEvent.objectId, widgetEvent.category, color, ownerName, trophyDate, trophyText));
|
setTrophyData(new FurnitureTrophyData(widgetEvent.objectId, widgetEvent.category, color, ownerName, trophyDate, trophyText));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED: {
|
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
|
||||||
const widgetEvent = (event as RoomWidgetRoomObjectUpdateEvent);
|
const widgetEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
||||||
|
|
||||||
setTrophyData(prevState =>
|
setTrophyData(prevState =>
|
||||||
{
|
{
|
||||||
@ -54,7 +55,7 @@ export const FurnitureTrophyView: FC<{}> = props =>
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_TROPHY, onNitroEvent);
|
useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_TROPHY, 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) =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user