This commit is contained in:
Layne 2022-03-17 19:35:56 -04:00
commit 08d071b204
4 changed files with 38 additions and 5 deletions

View File

@ -14,6 +14,7 @@
"camera.publish.disabled": false, "camera.publish.disabled": false,
"hc.disabled": false, "hc.disabled": false,
"hotelview": { "hotelview": {
"show.avatar": true,
"widgets": { "widgets": {
"slot.1.widget": "promoarticle", "slot.1.widget": "promoarticle",
"slot.1.conf": "", "slot.1.conf": "",

View File

@ -8,7 +8,7 @@
.avatar-image { .avatar-image {
bottom: 12px; bottom: 12px;
left: 63px; left: 57px;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
} }

View File

@ -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 { FC, useCallback, useState } from 'react';
import { GetConfiguration, GetConfigurationManager } from '../../api'; 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'; import { WidgetSlotView } from './views/widget-slot/WidgetSlotView';
export const HotelView: FC<{}> = props => export const HotelView: FC<{}> = props =>
{ {
const [isVisible, setIsVisible] = useState(true); const [isVisible, setIsVisible] = useState(true);
const widgetSlotCount = 7; const widgetSlotCount = 7;
const [ userFigure, setUserFigure ] = useState<string>(null);
const [ userInfo, setUserInfo ] = useState<UserInfoDataParser>(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) => const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
{ {
@ -94,6 +120,11 @@ export const HotelView: FC<{}> = props =>
<div className="left position-absolute" style={(left && left.length) ? { backgroundImage: `url(${left})` } : {}} /> <div className="left position-absolute" style={(left && left.length) ? { backgroundImage: `url(${left})` } : {}} />
<div className="right-repeat position-absolute" style={(rightRepeat && rightRepeat.length) ? { backgroundImage: `url(${rightRepeat})` } : {}} /> <div className="right-repeat position-absolute" style={(rightRepeat && rightRepeat.length) ? { backgroundImage: `url(${rightRepeat})` } : {}} />
<div className="right position-absolute" style={(right && right.length) ? { backgroundImage: `url(${right})` } : {}} /> <div className="right position-absolute" style={(right && right.length) ? { backgroundImage: `url(${right})` } : {}} />
{GetConfiguration("hotelview")["show.avatar"] && (
<div className="avatar-image">
<LayoutAvatarImageView figure={userFigure} direction={2} />
</div>
)}
</div> </div>
); );
} }

View File

@ -155,8 +155,9 @@ export const ChatInputView: FC<{}> = props =>
const value = (event.target as HTMLInputElement).value; const value = (event.target as HTMLInputElement).value;
switch(event.code) switch(event.key)
{ {
case ' ':
case 'Space': case 'Space':
checkSpecialKeywordForInput(); checkSpecialKeywordForInput();
return; return;