mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Add whisper event
This commit is contained in:
parent
63bc890fd6
commit
fc3ff514ec
@ -0,0 +1,29 @@
|
|||||||
|
import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
|
||||||
|
|
||||||
|
export class RoomWidgetChatInputContentUpdateEvent extends RoomWidgetUpdateEvent
|
||||||
|
{
|
||||||
|
public static CHAT_INPUT_CONTENT: string = 'RWCICUE_CHAT_INPUT_CONTENT';
|
||||||
|
public static WHISPER: string = 'whisper';
|
||||||
|
public static SHOUT: string = 'shout';
|
||||||
|
|
||||||
|
private _chatMode: string = '';
|
||||||
|
private _userName: string = '';
|
||||||
|
|
||||||
|
constructor(k: string, _arg_2: string)
|
||||||
|
{
|
||||||
|
super(RoomWidgetChatInputContentUpdateEvent.CHAT_INPUT_CONTENT);
|
||||||
|
|
||||||
|
this._chatMode = k;
|
||||||
|
this._userName = _arg_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get chatMode(): string
|
||||||
|
{
|
||||||
|
return this._chatMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get userName(): string
|
||||||
|
{
|
||||||
|
return this._userName;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
export * from './RoomWidgetAvatarInfoEvent';
|
export * from './RoomWidgetAvatarInfoEvent';
|
||||||
|
export * from './RoomWidgetChatInputContentUpdateEvent';
|
||||||
export * from './RoomWidgetFloodControlEvent';
|
export * from './RoomWidgetFloodControlEvent';
|
||||||
export * from './RoomWidgetObjectNameEvent';
|
export * from './RoomWidgetObjectNameEvent';
|
||||||
export * from './RoomWidgetRoomEngineUpdateEvent';
|
export * from './RoomWidgetRoomEngineUpdateEvent';
|
||||||
|
@ -3,7 +3,7 @@ import { GetConnection, GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture
|
|||||||
import { WiredSelectObjectEvent } from '../../../events';
|
import { WiredSelectObjectEvent } from '../../../events';
|
||||||
import { dispatchUiEvent } from '../../../hooks/events';
|
import { dispatchUiEvent } from '../../../hooks/events';
|
||||||
import { LocalizeText } from '../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../utils/LocalizeText';
|
||||||
import { RoomWidgetObjectNameEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent } from '../events';
|
import { RoomWidgetChatInputContentUpdateEvent, RoomWidgetObjectNameEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateInfostandFurniEvent, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateInfostandUserEvent } from '../events';
|
||||||
import { RoomWidgetChangeMottoMessage, RoomWidgetFurniActionMessage, RoomWidgetMessage, RoomWidgetRoomObjectMessage, RoomWidgetUserActionMessage } from '../messages';
|
import { RoomWidgetChangeMottoMessage, RoomWidgetFurniActionMessage, RoomWidgetMessage, RoomWidgetRoomObjectMessage, RoomWidgetUserActionMessage } from '../messages';
|
||||||
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ export class RoomWidgetInfostandHandler extends RoomWidgetHandler
|
|||||||
GetSessionDataManager().givePetRespect(userId);
|
GetSessionDataManager().givePetRespect(userId);
|
||||||
break;
|
break;
|
||||||
case RoomWidgetUserActionMessage.WHISPER_USER:
|
case RoomWidgetUserActionMessage.WHISPER_USER:
|
||||||
//this.container.eventDispatcher.dispatchEvent(new RoomWidgetChatInputContentUpdateEvent(RoomWidgetChatInputContentUpdateEvent.WHISPER, userData.name));
|
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChatInputContentUpdateEvent(RoomWidgetChatInputContentUpdateEvent.WHISPER, userData.name));
|
||||||
break;
|
break;
|
||||||
case RoomWidgetUserActionMessage.IGNORE_USER:
|
case RoomWidgetUserActionMessage.IGNORE_USER:
|
||||||
GetSessionDataManager().ignoreUser(userData.name);
|
GetSessionDataManager().ignoreUser(userData.name);
|
||||||
|
@ -4,7 +4,7 @@ import { GetConfiguration } from '../../../../api';
|
|||||||
import { CreateEventDispatcherHook } from '../../../../hooks/events';
|
import { CreateEventDispatcherHook } from '../../../../hooks/events';
|
||||||
import { LocalizeText } from '../../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../../utils/LocalizeText';
|
||||||
import { useRoomContext } from '../../context/RoomContext';
|
import { useRoomContext } from '../../context/RoomContext';
|
||||||
import { RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateInfostandUserEvent } from '../../events';
|
import { RoomWidgetChatInputContentUpdateEvent, RoomWidgetRoomObjectUpdateEvent, RoomWidgetUpdateInfostandUserEvent } from '../../events';
|
||||||
import { RoomWidgetChatMessage, RoomWidgetChatTypingMessage } from '../../messages';
|
import { RoomWidgetChatMessage, RoomWidgetChatTypingMessage } from '../../messages';
|
||||||
import { ChatInputViewProps } from './ChatInputView.types';
|
import { ChatInputViewProps } from './ChatInputView.types';
|
||||||
import { ChatInputStyleSelectorView } from './style-selector/ChatInputStyleSelectorView';
|
import { ChatInputStyleSelectorView } from './style-selector/ChatInputStyleSelectorView';
|
||||||
@ -199,6 +199,21 @@ export const ChatInputView: FC<ChatInputViewProps> = props =>
|
|||||||
|
|
||||||
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateInfostandUserEvent);
|
CreateEventDispatcherHook(RoomWidgetUpdateInfostandUserEvent.PEER, eventDispatcher, onRoomWidgetUpdateInfostandUserEvent);
|
||||||
|
|
||||||
|
const onRoomWidgetChatInputContentUpdateEvent = useCallback((event: RoomWidgetChatInputContentUpdateEvent) =>
|
||||||
|
{
|
||||||
|
switch(event.chatMode)
|
||||||
|
{
|
||||||
|
case RoomWidgetChatInputContentUpdateEvent.WHISPER: {
|
||||||
|
setChatValue(`${ chatModeIdWhisper } ${ event.userName } `);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case RoomWidgetChatInputContentUpdateEvent.SHOUT:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}, [ chatModeIdWhisper ]);
|
||||||
|
|
||||||
|
CreateEventDispatcherHook(RoomWidgetChatInputContentUpdateEvent.CHAT_INPUT_CONTENT, eventDispatcher, onRoomWidgetChatInputContentUpdateEvent);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
if(isTyping)
|
if(isTyping)
|
||||||
|
Loading…
Reference in New Issue
Block a user