2021-08-06 05:38:57 +02:00
|
|
|
import { RoomEnterEffect, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
2021-06-24 09:58:43 +02:00
|
|
|
import { FC, useCallback, useMemo, useState } from 'react';
|
2021-10-16 07:56:53 +02:00
|
|
|
import { GetRoomSession, GetSessionDataManager, RoomWidgetObjectNameEvent, RoomWidgetRoomObjectMessage, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateInfostandEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRentableBotChatEvent, RoomWidgetUpdateRoomEngineEvent, RoomWidgetUpdateRoomObjectEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../../../../api';
|
2021-06-12 04:53:56 +02:00
|
|
|
import { CreateEventDispatcherHook } from '../../../../hooks/events/event-dispatcher.base';
|
2021-06-17 19:23:34 +02:00
|
|
|
import { useRoomContext } from '../../context/RoomContext';
|
2021-06-24 09:58:43 +02:00
|
|
|
import { AvatarInfoWidgetAvatarView } from './views/avatar/AvatarInfoWidgetAvatarView';
|
|
|
|
import { AvatarInfoWidgetDecorateView } from './views/decorate/AvatarInfoWidgetDecorateView';
|
2021-06-13 10:13:46 +02:00
|
|
|
import { AvatarInfoWidgetNameView } from './views/name/AvatarInfoWidgetNameView';
|
2021-06-24 09:58:43 +02:00
|
|
|
import { AvatarInfoWidgetOwnAvatarView } from './views/own-avatar/AvatarInfoWidgetOwnAvatarView';
|
|
|
|
import { AvatarInfoWidgetOwnPetView } from './views/own-pet/AvatarInfoWidgetOwnPetView';
|
|
|
|
import { AvatarInfoWidgetPetView } from './views/pet/AvatarInfoWidgetPetView';
|
2021-07-01 01:48:24 +02:00
|
|
|
import { AvatarInfoRentableBotChatView } from './views/rentable-bot-chat/AvatarInfoRentableBotChatView';
|
2021-06-24 09:58:43 +02:00
|
|
|
import { AvatarInfoWidgetRentableBotView } from './views/rentable-bot/AvatarInfoWidgetRentableBotView';
|
2021-07-09 19:29:00 +02:00
|
|
|
import { AvatarInfoUseProductConfirmView } from './views/use-product-confirm/AvatarInfoUseProductConfirmView';
|
|
|
|
import { AvatarInfoUseProductView } from './views/use-product/AvatarInfoUseProductView';
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-07-12 09:59:40 +02:00
|
|
|
export const AvatarInfoWidgetView: FC<{}> = props =>
|
2021-06-12 04:53:56 +02:00
|
|
|
{
|
2021-06-17 19:23:34 +02:00
|
|
|
const [ name, setName ] = useState<RoomWidgetObjectNameEvent>(null);
|
2021-07-07 09:56:11 +02:00
|
|
|
const [ nameBubbles, setNameBubbles ] = useState<RoomWidgetObjectNameEvent[]>([]);
|
2021-07-09 19:29:00 +02:00
|
|
|
const [ productBubbles, setProductBubbles ] = useState<UseProductItem[]>([]);
|
|
|
|
const [ confirmingProduct, setConfirmingProduct ] = useState<UseProductItem>(null);
|
2021-06-17 19:23:34 +02:00
|
|
|
const [ infoStandEvent, setInfoStandEvent ] = useState<RoomWidgetUpdateInfostandEvent>(null);
|
2021-06-13 10:13:46 +02:00
|
|
|
const [ isGameMode, setGameMode ] = useState(false);
|
2021-06-24 09:58:43 +02:00
|
|
|
const [ isDancing, setIsDancing ] = useState(false);
|
2021-09-13 18:29:04 +02:00
|
|
|
const [ isDecorating, setIsDecorating ] = useState(false);
|
2021-07-01 01:48:24 +02:00
|
|
|
const [ rentableBotChatEvent, setRentableBotChatEvent ] = useState<RoomWidgetUpdateRentableBotChatEvent>(null);
|
2021-11-17 09:48:41 +01:00
|
|
|
const { roomSession = null, eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
const removeNameBubble = useCallback((index: number) =>
|
|
|
|
{
|
|
|
|
setNameBubbles(prevValue =>
|
|
|
|
{
|
|
|
|
const newValue = [ ...prevValue ];
|
|
|
|
|
|
|
|
newValue.splice(index, 1);
|
|
|
|
|
|
|
|
return newValue;
|
|
|
|
});
|
|
|
|
}, []);
|
|
|
|
|
2021-07-09 19:29:00 +02:00
|
|
|
const removeProductBubble = useCallback((index: number) =>
|
|
|
|
{
|
|
|
|
setProductBubbles(prevValue =>
|
|
|
|
{
|
|
|
|
const newValue = [ ...prevValue ];
|
|
|
|
const item = newValue.splice(index, 1)[0];
|
|
|
|
|
|
|
|
if(confirmingProduct === item) setConfirmingProduct(null);
|
|
|
|
|
|
|
|
return newValue;
|
|
|
|
});
|
|
|
|
}, [ confirmingProduct ]);
|
|
|
|
|
2021-07-11 08:37:56 +02:00
|
|
|
const clearProductBubbles = useCallback(() =>
|
|
|
|
{
|
|
|
|
setProductBubbles([]);
|
|
|
|
}, []);
|
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
const clearInfoStandEvent = useCallback(() =>
|
|
|
|
{
|
|
|
|
setInfoStandEvent(null);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const clearName = useCallback(() =>
|
|
|
|
{
|
|
|
|
setName(null);
|
|
|
|
}, []);
|
|
|
|
|
2021-07-11 08:37:56 +02:00
|
|
|
const updateConfirmingProduct = useCallback((product: UseProductItem) =>
|
|
|
|
{
|
|
|
|
setConfirmingProduct(product);
|
|
|
|
setProductBubbles([]);
|
|
|
|
}, []);
|
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
const onRoomWidgetRoomEngineUpdateEvent = useCallback((event: RoomWidgetUpdateRoomEngineEvent) =>
|
2021-06-12 04:53:56 +02:00
|
|
|
{
|
2021-06-13 10:13:46 +02:00
|
|
|
switch(event.type)
|
2021-06-12 04:53:56 +02:00
|
|
|
{
|
2021-10-16 07:56:53 +02:00
|
|
|
case RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE: {
|
2021-06-24 09:58:43 +02:00
|
|
|
if(isGameMode) setGameMode(false);
|
2021-06-17 19:23:34 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-10-16 07:56:53 +02:00
|
|
|
case RoomWidgetUpdateRoomEngineEvent.GAME_MODE: {
|
2021-06-24 09:58:43 +02:00
|
|
|
if(!isGameMode) setGameMode(true);
|
2021-06-17 19:23:34 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
|
|
|
}, [ isGameMode ]);
|
2021-06-17 19:23:34 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.NORMAL_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomEngineEvent.GAME_MODE, eventDispatcher, onRoomWidgetRoomEngineUpdateEvent);
|
2021-06-17 19:23:34 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
const onRoomObjectRemoved = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
2021-06-24 09:58:43 +02:00
|
|
|
{
|
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
if(event.id === name.id) setName(null);
|
|
|
|
}
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
if(event.category === RoomObjectCategory.UNIT)
|
|
|
|
{
|
|
|
|
const nameBubbleIndex = nameBubbles.findIndex(bubble =>
|
|
|
|
{
|
|
|
|
return (bubble.roomIndex === event.id);
|
|
|
|
});
|
|
|
|
|
|
|
|
if(nameBubbleIndex > -1) removeNameBubble(nameBubbleIndex);
|
2021-07-09 19:29:00 +02:00
|
|
|
|
|
|
|
if(productBubbles.length)
|
|
|
|
{
|
|
|
|
setProductBubbles(prevValue =>
|
|
|
|
{
|
|
|
|
return prevValue.filter(bubble =>
|
|
|
|
{
|
|
|
|
return (bubble.id !== event.id);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(event.category === RoomObjectCategory.FLOOR)
|
|
|
|
{
|
|
|
|
if(productBubbles.length)
|
|
|
|
{
|
|
|
|
setProductBubbles(prevValue =>
|
|
|
|
{
|
|
|
|
return prevValue.filter(bubble =>
|
|
|
|
{
|
|
|
|
return (bubble.requestRoomObjectId !== event.id);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2021-07-07 09:56:11 +02:00
|
|
|
}
|
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
if(infoStandEvent)
|
|
|
|
{
|
|
|
|
if(infoStandEvent instanceof RoomWidgetUpdateInfostandFurniEvent)
|
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
if(infoStandEvent.id === event.id) clearInfoStandEvent();
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
else if((infoStandEvent instanceof RoomWidgetUpdateInfostandUserEvent) || (infoStandEvent instanceof RoomWidgetUpdateInfostandRentableBotEvent))
|
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
if(infoStandEvent.roomIndex === event.id) clearInfoStandEvent();
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
2021-06-17 19:23:34 +02:00
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
else if(infoStandEvent instanceof RoomWidgetUpdateInfostandPetEvent)
|
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
if(infoStandEvent.roomIndex === event.id) clearInfoStandEvent();
|
2021-06-13 10:13:46 +02:00
|
|
|
}
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
2021-07-11 08:37:56 +02:00
|
|
|
}, [ name, infoStandEvent, nameBubbles, productBubbles, removeNameBubble, clearInfoStandEvent ]);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.USER_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED, eventDispatcher, onRoomObjectRemoved);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
const onObjectRolled = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
2021-06-24 09:58:43 +02:00
|
|
|
{
|
|
|
|
switch(event.type)
|
|
|
|
{
|
2021-10-16 07:56:53 +02:00
|
|
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER: {
|
|
|
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
if(infoStandEvent) return;
|
|
|
|
|
2021-06-17 19:23:34 +02:00
|
|
|
widgetHandler.processWidgetMessage(new RoomWidgetRoomObjectMessage(RoomWidgetRoomObjectMessage.GET_OBJECT_NAME, roomObjectEvent.id, roomObjectEvent.category));
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-06-17 19:23:34 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-10-16 07:56:53 +02:00
|
|
|
case RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT: {
|
|
|
|
const roomObjectEvent = (event as RoomWidgetUpdateRoomObjectEvent);
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
if(!name || (name.roomIndex !== roomObjectEvent.id)) return;
|
|
|
|
|
2021-06-17 19:23:34 +02:00
|
|
|
setName(null);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-06-13 10:13:46 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
|
|
|
}, [ infoStandEvent, name, widgetHandler ]);
|
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OVER, eventDispatcher, onObjectRolled);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_ROLL_OUT, eventDispatcher, onObjectRolled);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
const onObjectDeselected = useCallback((event: RoomWidgetUpdateRoomObjectEvent) =>
|
2021-06-24 09:58:43 +02:00
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
if(infoStandEvent) clearInfoStandEvent();
|
2021-07-09 19:29:00 +02:00
|
|
|
if(productBubbles.length) setProductBubbles([]);
|
2021-07-11 08:37:56 +02:00
|
|
|
}, [ infoStandEvent, productBubbles, clearInfoStandEvent ]);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-10-16 07:56:53 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED, eventDispatcher, onObjectDeselected);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
const onRoomWidgetObjectNameEvent = useCallback((event: RoomWidgetObjectNameEvent) =>
|
|
|
|
{
|
|
|
|
if(event.category !== RoomObjectCategory.UNIT) return;
|
|
|
|
|
|
|
|
setName(event);
|
2021-07-11 08:37:56 +02:00
|
|
|
clearProductBubbles();
|
|
|
|
}, [ clearProductBubbles ]);
|
2021-06-12 04:53:56 +02:00
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetObjectNameEvent.TYPE, eventDispatcher, onRoomWidgetObjectNameEvent);
|
2021-06-17 19:23:34 +02:00
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
const onRoomWidgetUpdateInfostandEvent = useCallback((event: RoomWidgetUpdateInfostandEvent) =>
|
|
|
|
{
|
|
|
|
if(name) setName(null);
|
2021-06-26 19:32:32 +02:00
|
|
|
|
2021-07-11 08:37:56 +02:00
|
|
|
if(event.type === RoomWidgetUpdateInfostandFurniEvent.FURNI) clearInfoStandEvent();
|
2021-06-26 19:32:32 +02:00
|
|
|
else setInfoStandEvent(event);
|
2021-07-11 08:37:56 +02:00
|
|
|
|
|
|
|
clearProductBubbles();
|
|
|
|
}, [ name, clearInfoStandEvent, clearProductBubbles ]);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandFurniEvent.FURNI, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.OWN_USER, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.BOT, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandRentableBotEvent.RENTABLE_BOT, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
2021-06-24 18:47:40 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandPetEvent.PET_INFO, eventDispatcher, onRoomWidgetUpdateInfostandEvent);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
const onRoomWidgetUpdateDanceStatusEvent = useCallback((event: RoomWidgetUpdateDanceStatusEvent) =>
|
|
|
|
{
|
|
|
|
setIsDancing(event.isDancing);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateDanceStatusEvent.UPDATE_DANCE, eventDispatcher, onRoomWidgetUpdateDanceStatusEvent);
|
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
const onRoomWidgetUpdateRentableBotChatEvent = useCallback((event: RoomWidgetUpdateRentableBotChatEvent) =>
|
2021-06-24 09:58:43 +02:00
|
|
|
{
|
2021-07-07 09:56:11 +02:00
|
|
|
setRentableBotChatEvent(event);
|
2021-06-24 09:58:43 +02:00
|
|
|
}, []);
|
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateRentableBotChatEvent.UPDATE_CHAT, eventDispatcher, onRoomWidgetUpdateRentableBotChatEvent);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
2021-07-09 19:29:00 +02:00
|
|
|
const onRoomWidgetUseProductBubbleEvent = useCallback((event: RoomWidgetUseProductBubbleEvent) =>
|
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
setConfirmingProduct(null);
|
2021-07-09 19:29:00 +02:00
|
|
|
setProductBubbles(prevValue =>
|
|
|
|
{
|
|
|
|
const newBubbles = [ ...prevValue ];
|
|
|
|
|
|
|
|
for(const item of event.items)
|
|
|
|
{
|
|
|
|
const index = newBubbles.findIndex(bubble => (bubble.id === item.id));
|
|
|
|
|
|
|
|
if(index > -1) newBubbles.splice(index, 1);
|
|
|
|
|
|
|
|
newBubbles.push(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newBubbles;
|
|
|
|
});
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUseProductBubbleEvent.USE_PRODUCT_BUBBLES, eventDispatcher, onRoomWidgetUseProductBubbleEvent);
|
|
|
|
|
2021-08-17 20:30:15 +02:00
|
|
|
// const onFriendEnteredRoomEvent = useCallback((event: FriendEnteredRoomEvent) =>
|
|
|
|
// {
|
|
|
|
// setNameBubbles(prevValue =>
|
|
|
|
// {
|
|
|
|
// return [ ...prevValue, event ];
|
|
|
|
// })
|
|
|
|
// }, []);
|
2021-07-01 01:48:24 +02:00
|
|
|
|
2021-08-17 20:30:15 +02:00
|
|
|
// useUiEvent(FriendEnteredRoomEvent.ENTERED, onFriendEnteredRoomEvent);
|
2021-07-01 01:48:24 +02:00
|
|
|
|
2021-09-23 09:23:17 +02:00
|
|
|
const onRoomWidgetUpdateDecorateModeEvent = useCallback((event: RoomWidgetUpdateDecorateModeEvent) =>
|
|
|
|
{
|
|
|
|
setIsDecorating(event.isDecorating);
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
CreateEventDispatcherHook(RoomWidgetUpdateDecorateModeEvent.UPDATE_DECORATE, eventDispatcher, onRoomWidgetUpdateDecorateModeEvent);
|
|
|
|
|
2021-06-24 09:58:43 +02:00
|
|
|
const decorateView = useMemo(() =>
|
|
|
|
{
|
|
|
|
GetRoomSession().isDecorating = isDecorating;
|
|
|
|
|
|
|
|
if(!isDecorating) return null;
|
|
|
|
|
|
|
|
const userId = GetSessionDataManager().userId;
|
|
|
|
const userName = GetSessionDataManager().userName;
|
|
|
|
const roomIndex = GetRoomSession().ownRoomIndex;
|
|
|
|
|
2021-09-23 09:23:17 +02:00
|
|
|
return <AvatarInfoWidgetDecorateView userId={ userId } userName={ userName } roomIndex={ roomIndex } />;
|
2021-06-24 09:58:43 +02:00
|
|
|
}, [ isDecorating ]);
|
|
|
|
|
|
|
|
const currentView = useMemo(() =>
|
|
|
|
{
|
|
|
|
if(isGameMode) return null;
|
|
|
|
|
|
|
|
if(decorateView) return decorateView;
|
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
if(name)
|
|
|
|
{
|
|
|
|
const nameBubbleIndex = nameBubbles.findIndex(bubble =>
|
|
|
|
{
|
|
|
|
return (bubble.roomIndex === name.roomIndex);
|
|
|
|
});
|
|
|
|
|
|
|
|
if(nameBubbleIndex > -1) removeNameBubble(nameBubbleIndex);
|
|
|
|
|
|
|
|
return <AvatarInfoWidgetNameView nameData={ name } close={ clearName } />;
|
|
|
|
}
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
if(infoStandEvent)
|
|
|
|
{
|
|
|
|
switch(infoStandEvent.type)
|
|
|
|
{
|
|
|
|
case RoomWidgetUpdateInfostandUserEvent.OWN_USER:
|
|
|
|
case RoomWidgetUpdateInfostandUserEvent.PEER: {
|
|
|
|
const event = (infoStandEvent as RoomWidgetUpdateInfostandUserEvent);
|
|
|
|
|
|
|
|
if(event.isSpectatorMode) return null;
|
|
|
|
|
2021-07-07 09:56:11 +02:00
|
|
|
const nameBubbleIndex = nameBubbles.findIndex(bubble =>
|
|
|
|
{
|
|
|
|
return (bubble.roomIndex === event.roomIndex);
|
|
|
|
});
|
|
|
|
|
|
|
|
if(nameBubbleIndex > -1) removeNameBubble(nameBubbleIndex);
|
2021-06-24 09:58:43 +02:00
|
|
|
|
|
|
|
if(event.isOwnUser)
|
|
|
|
{
|
|
|
|
if(RoomEnterEffect.isRunning()) return null;
|
|
|
|
|
2021-09-23 09:23:17 +02:00
|
|
|
return <AvatarInfoWidgetOwnAvatarView userData={ event } isDancing={ isDancing } close={ clearInfoStandEvent } />;
|
2021-06-24 09:58:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return <AvatarInfoWidgetAvatarView userData={ event } close={ clearInfoStandEvent } />;
|
|
|
|
}
|
|
|
|
case RoomWidgetUpdateInfostandPetEvent.PET_INFO: {
|
|
|
|
const event = (infoStandEvent as RoomWidgetUpdateInfostandPetEvent);
|
|
|
|
|
|
|
|
if(event.isOwner)
|
|
|
|
{
|
|
|
|
return <AvatarInfoWidgetOwnPetView petData={ event } close={ clearInfoStandEvent } />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <AvatarInfoWidgetPetView petData={ event } close={ clearInfoStandEvent } />;
|
|
|
|
}
|
|
|
|
case RoomWidgetUpdateInfostandRentableBotEvent.RENTABLE_BOT: {
|
|
|
|
return <AvatarInfoWidgetRentableBotView rentableBotData={ (infoStandEvent as RoomWidgetUpdateInfostandRentableBotEvent) } close={ clearInfoStandEvent } />
|
|
|
|
}
|
|
|
|
case RoomWidgetUpdateInfostandFurniEvent.FURNI: {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2021-07-07 09:56:11 +02:00
|
|
|
}, [ isGameMode, decorateView, name, nameBubbles, isDancing, infoStandEvent, clearName, clearInfoStandEvent, removeNameBubble ]);
|
2021-06-13 10:13:46 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2021-06-24 09:58:43 +02:00
|
|
|
{ currentView }
|
2021-07-07 09:56:11 +02:00
|
|
|
{ (nameBubbles.length > 0) && nameBubbles.map((name, index) =>
|
|
|
|
{
|
2021-07-07 11:05:14 +02:00
|
|
|
return <AvatarInfoWidgetNameView key={ index } nameData={ name } close={ () => removeNameBubble(index) } />;
|
2021-07-07 09:56:11 +02:00
|
|
|
}) }
|
2021-07-09 19:29:00 +02:00
|
|
|
{ (productBubbles.length > 0) && productBubbles.map((item, index) =>
|
|
|
|
{
|
2021-07-11 08:37:56 +02:00
|
|
|
return <AvatarInfoUseProductView key={ item.id } item={ item } updateConfirmingProduct={ updateConfirmingProduct } close={ () => removeProductBubble(index) } />;
|
2021-07-09 19:29:00 +02:00
|
|
|
}) }
|
2021-07-01 01:48:24 +02:00
|
|
|
{ rentableBotChatEvent && <AvatarInfoRentableBotChatView chatEvent={ rentableBotChatEvent } /> }
|
2021-07-09 19:29:00 +02:00
|
|
|
{ confirmingProduct && <AvatarInfoUseProductConfirmView item={ confirmingProduct } close={ () => setConfirmingProduct(null) } /> }
|
2021-06-13 10:13:46 +02:00
|
|
|
</>
|
|
|
|
)
|
2021-06-12 04:53:56 +02:00
|
|
|
}
|