diff --git a/public/ui-config.json.example b/public/ui-config.json.example index 49774722..43902aab 100644 --- a/public/ui-config.json.example +++ b/public/ui-config.json.example @@ -14,6 +14,7 @@ "camera.publish.disabled": false, "hc.disabled": false, "hotelview": { + "show.avatar": true, "widgets": { "slot.1.widget": "promoarticle", "slot.1.conf": "", diff --git a/src/components/hotel-view/HotelView.scss b/src/components/hotel-view/HotelView.scss index 137cbcf1..3c389c5d 100644 --- a/src/components/hotel-view/HotelView.scss +++ b/src/components/hotel-view/HotelView.scss @@ -8,7 +8,7 @@ .avatar-image { bottom: 12px; - left: 63px; + left: 57px; position: absolute; z-index: 1; } diff --git a/src/components/hotel-view/HotelView.tsx b/src/components/hotel-view/HotelView.tsx index f446b0da..dbcb1afa 100644 --- a/src/components/hotel-view/HotelView.tsx +++ b/src/components/hotel-view/HotelView.tsx @@ -1,13 +1,39 @@ -import { RoomSessionEvent } from '@nitrots/nitro-renderer'; +import { FigureUpdateEvent, RoomSessionEvent, UserInfoDataParser, UserInfoEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; import { GetConfiguration, GetConfigurationManager } from '../../api'; -import { UseRoomSessionManagerEvent } from '../../hooks'; +import { LayoutAvatarImageView } from '../../common'; +import { BatchUpdates, UseMessageEventHook, UseRoomSessionManagerEvent } from '../../hooks'; import { WidgetSlotView } from './views/widget-slot/WidgetSlotView'; - export const HotelView: FC<{}> = props => { const [isVisible, setIsVisible] = useState(true); const widgetSlotCount = 7; + const [ userFigure, setUserFigure ] = useState(null); + const [ userInfo, setUserInfo ] = useState(null); + + + const onUserInfoEvent = useCallback((event: UserInfoEvent) => + { + const parser = event.getParser(); + + BatchUpdates(() => + { + setUserInfo(parser.userInfo); + setUserFigure(parser.userInfo.figure); + }); + }, []); + + UseMessageEventHook(UserInfoEvent, onUserInfoEvent); + + const onUserFigureEvent = useCallback((event: FigureUpdateEvent) => + { + const parser = event.getParser(); + + setUserFigure(parser.figure); + }, []); + + UseMessageEventHook(FigureUpdateEvent, onUserFigureEvent); + const onRoomSessionEvent = useCallback((event: RoomSessionEvent) => { @@ -94,6 +120,11 @@ export const HotelView: FC<{}> = props =>
+ {GetConfiguration("hotelview")["show.avatar"] && ( +
+ +
+ )}
); }