mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Add event for game mode
This commit is contained in:
parent
606b3ad965
commit
2cd39f8121
@ -8,7 +8,7 @@ import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-ev
|
|||||||
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
|
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
|
||||||
import { RoomErrorHandler } from '../room-error-handler/RoomErrorHandler';
|
import { RoomErrorHandler } from '../room-error-handler/RoomErrorHandler';
|
||||||
import { RoomView } from '../room/RoomView';
|
import { RoomView } from '../room/RoomView';
|
||||||
import { RoomWidgetRoomObjectUpdateEvent } from '../room/widgets/events';
|
import { RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectUpdateEvent } from '../room/widgets/events';
|
||||||
import { RoomHostViewProps } from './RoomHostView.types';
|
import { RoomHostViewProps } from './RoomHostView.types';
|
||||||
import { CanManipulateFurniture } from './utils/CanManipulateFurniture';
|
import { CanManipulateFurniture } from './utils/CanManipulateFurniture';
|
||||||
import { IsFurnitureSelectionDisabled } from './utils/IsFurnitureSelectionDisabled';
|
import { IsFurnitureSelectionDisabled } from './utils/IsFurnitureSelectionDisabled';
|
||||||
@ -35,8 +35,14 @@ export const RoomHostView: FC<RoomHostViewProps> = props =>
|
|||||||
case RoomEngineEvent.DISPOSED:
|
case RoomEngineEvent.DISPOSED:
|
||||||
setRoomSession(null);
|
setRoomSession(null);
|
||||||
return;
|
return;
|
||||||
|
case RoomEngineEvent.NORMAL_MODE:
|
||||||
|
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.RWREUE_NORMAL_MODE, event.roomId));
|
||||||
|
return;
|
||||||
|
case RoomEngineEvent.GAME_MODE:
|
||||||
|
eventDispatcher.dispatchEvent(new RoomWidgetRoomEngineUpdateEvent(RoomWidgetRoomEngineUpdateEvent.RWREUE_GAME_MODE, event.roomId));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}, []);
|
}, [ eventDispatcher ]);
|
||||||
|
|
||||||
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
||||||
{
|
{
|
||||||
@ -102,7 +108,6 @@ export const RoomHostView: FC<RoomHostViewProps> = 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:
|
||||||
console.log('yaaa')
|
|
||||||
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
if(CanManipulateFurniture(roomSession, objectId, category)) updateEvent = new RoomWidgetRoomObjectUpdateEvent(RoomWidgetRoomObjectUpdateEvent.OBJECT_REQUEST_MANIPULATION, objectId, category, event.roomId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -144,6 +149,10 @@ export const RoomHostView: FC<RoomHostViewProps> = props =>
|
|||||||
|
|
||||||
useRoomEngineEvent(RoomEngineEvent.INITIALIZED, onRoomEngineEvent);
|
useRoomEngineEvent(RoomEngineEvent.INITIALIZED, onRoomEngineEvent);
|
||||||
useRoomEngineEvent(RoomEngineEvent.DISPOSED, onRoomEngineEvent);
|
useRoomEngineEvent(RoomEngineEvent.DISPOSED, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.NORMAL_MODE, onRoomEngineEvent);
|
||||||
|
useRoomEngineEvent(RoomEngineEvent.GAME_MODE, onRoomEngineEvent);
|
||||||
useRoomEngineEvent(RoomZoomEvent.ROOM_ZOOM, onRoomEngineEvent);
|
useRoomEngineEvent(RoomZoomEvent.ROOM_ZOOM, onRoomEngineEvent);
|
||||||
useRoomEngineEvent(RoomObjectHSLColorEnabledEvent.ROOM_BACKGROUND_COLOR, onRoomEngineEvent);
|
useRoomEngineEvent(RoomObjectHSLColorEnabledEvent.ROOM_BACKGROUND_COLOR, onRoomEngineEvent);
|
||||||
useRoomEngineEvent(RoomBackgroundColorEvent.ROOM_COLOR, onRoomEngineEvent);
|
useRoomEngineEvent(RoomBackgroundColorEvent.ROOM_COLOR, onRoomEngineEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user