mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 22:40:50 +01:00
add constants
This commit is contained in:
parent
02e3e04fe7
commit
caf6fe4b18
@ -5,3 +5,10 @@ export function PlaySound(sampleCode: string): void
|
|||||||
{
|
{
|
||||||
dispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
|
dispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CAMERA_SHUTTER = 'camera_shutter';
|
||||||
|
export const CREDITS = 'credits';
|
||||||
|
export const DUCKETS = 'duckets';
|
||||||
|
export const MESSENGER_NEW_THREAD = 'messenger_new_thread';
|
||||||
|
export const MESSENGER_MESSAGE_RECEIVED = 'messenger_message_received';
|
||||||
|
export const MODTOOLS_NEW_TICKET = 'modtools_new_ticket';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { NitroRectangle } from '@nitrots/nitro-renderer';
|
import { NitroRectangle } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useRef } from 'react';
|
import { FC, useCallback, useRef } from 'react';
|
||||||
import { GetRoomEngine, LocalizeText } from '../../api';
|
import { GetRoomEngine, LocalizeText } from '../../api';
|
||||||
import { PlaySound } from '../../api/utils/PlaySound';
|
import { CAMERA_SHUTTER, PlaySound } from '../../api/utils/PlaySound';
|
||||||
import { DraggableWindow } from '../draggable-window';
|
import { DraggableWindow } from '../draggable-window';
|
||||||
import { NitroLayoutMiniCameraViewProps } from './NitroLayoutMiniCameraView.types';
|
import { NitroLayoutMiniCameraViewProps } from './NitroLayoutMiniCameraView.types';
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export const NitroLayoutMiniCameraView: FC<NitroLayoutMiniCameraViewProps> = pro
|
|||||||
|
|
||||||
const takePicture = useCallback(() =>
|
const takePicture = useCallback(() =>
|
||||||
{
|
{
|
||||||
PlaySound('camera_shutter');
|
PlaySound(CAMERA_SHUTTER);
|
||||||
textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds()));
|
textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds()));
|
||||||
}, [ roomId, getCameraBounds, textureReceiver ]);
|
}, [ roomId, getCameraBounds, textureReceiver ]);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { NitroRectangle, TextureUtils } from '@nitrots/nitro-renderer';
|
import { NitroRectangle, TextureUtils } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useRef } from 'react';
|
import { FC, useCallback, useRef } from 'react';
|
||||||
import { GetRoomEngine, GetRoomSession, LocalizeText } from '../../../../api';
|
import { GetRoomEngine, GetRoomSession, LocalizeText } from '../../../../api';
|
||||||
import { PlaySound } from '../../../../api/utils/PlaySound';
|
import { CAMERA_SHUTTER, PlaySound } from '../../../../api/utils/PlaySound';
|
||||||
import { DraggableWindow } from '../../../../layout';
|
import { DraggableWindow } from '../../../../layout';
|
||||||
import { CameraPicture } from '../../common/CameraPicture';
|
import { CameraPicture } from '../../common/CameraPicture';
|
||||||
import { useCameraWidgetContext } from '../../context/CameraWidgetContext';
|
import { useCameraWidgetContext } from '../../context/CameraWidgetContext';
|
||||||
@ -45,7 +45,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
|||||||
clone.pop();
|
clone.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySound('camera_shutter');
|
PlaySound(CAMERA_SHUTTER);
|
||||||
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
|
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
|
||||||
|
|
||||||
setCameraRoll(clone);
|
setCameraRoll(clone);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer';
|
import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useReducer, useState } from 'react';
|
import { FC, useCallback, useEffect, useReducer, useState } from 'react';
|
||||||
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api';
|
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api';
|
||||||
import { PlaySound } from '../../api/utils/PlaySound';
|
import { CREDITS, PlaySound } from '../../api/utils/PlaySound';
|
||||||
import { CatalogEvent } from '../../events';
|
import { CatalogEvent } from '../../events';
|
||||||
import { useUiEvent } from '../../hooks/events/ui/ui-event';
|
import { useUiEvent } from '../../hooks/events/ui/ui-event';
|
||||||
import { SendMessageHook } from '../../hooks/messages/message-event';
|
import { SendMessageHook } from '../../hooks/messages/message-event';
|
||||||
@ -49,7 +49,7 @@ export const CatalogView: FC<CatalogViewProps> = props =>
|
|||||||
setIsVisible(value => !value);
|
setIsVisible(value => !value);
|
||||||
return;
|
return;
|
||||||
case CatalogEvent.PURCHASE_SUCCESS:
|
case CatalogEvent.PURCHASE_SUCCESS:
|
||||||
PlaySound('credits');
|
PlaySound(CREDITS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, SendMessageComposer } from '@nitrots/nitro-renderer';
|
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, SendMessageComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { FC, KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { AddEventLinkTracker, GetUserProfile, LocalizeText, RemoveLinkEventTracker } from '../../../../api';
|
import { AddEventLinkTracker, GetUserProfile, LocalizeText, RemoveLinkEventTracker } from '../../../../api';
|
||||||
import { PlaySound } from '../../../../api/utils/PlaySound';
|
import { MESSENGER_MESSAGE_RECEIVED, MESSENGER_NEW_THREAD, PlaySound } from '../../../../api/utils/PlaySound';
|
||||||
import { FriendsMessengerIconEvent } from '../../../../events';
|
import { FriendsMessengerIconEvent } from '../../../../events';
|
||||||
import { BatchUpdates, CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../../../hooks';
|
import { BatchUpdates, CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../../../hooks';
|
||||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutButton, NitroLayoutButtonGroup, NitroLayoutFlex, NitroLayoutFlexColumn } from '../../../../layout';
|
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutButton, NitroLayoutButtonGroup, NitroLayoutFlex, NitroLayoutFlexColumn } from '../../../../layout';
|
||||||
@ -115,7 +115,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
|
|
||||||
SendMessageHook(new SendMessageComposer(thread.participant.id, messageText));
|
SendMessageHook(new SendMessageComposer(thread.participant.id, messageText));
|
||||||
|
|
||||||
if(messageThreads.length === 1 && thread.groups.length === 1) PlaySound('messenger_new_thread');
|
if(messageThreads.length === 1 && thread.groups.length === 1) PlaySound(MESSENGER_NEW_THREAD);
|
||||||
|
|
||||||
thread.addMessage(0, messageText, 0, null, MessengerThreadChat.CHAT);
|
thread.addMessage(0, messageText, 0, null, MessengerThreadChat.CHAT);
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isUnread) PlaySound('messenger_message_received');
|
if(isUnread) PlaySound(MESSENGER_MESSAGE_RECEIVED);
|
||||||
|
|
||||||
dispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
dispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
||||||
}, [ visibleThreads, updateValue ]);
|
}, [ visibleThreads, updateValue ]);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer';
|
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback } from 'react';
|
import { FC, useCallback } from 'react';
|
||||||
import { PlaySound } from '../../api/utils/PlaySound';
|
import { MODTOOLS_NEW_TICKET, PlaySound } from '../../api/utils/PlaySound';
|
||||||
import { NotificationAlertEvent } from '../../events';
|
import { NotificationAlertEvent } from '../../events';
|
||||||
import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent';
|
import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent';
|
||||||
import { ModToolsOpenRoomChatlogEvent } from '../../events/mod-tools/ModToolsOpenRoomChatlogEvent';
|
import { ModToolsOpenRoomChatlogEvent } from '../../events/mod-tools/ModToolsOpenRoomChatlogEvent';
|
||||||
@ -58,7 +58,7 @@ export const ModToolsMessageHandler: FC<{}> = props =>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
newTickets.push(parser.issueData);
|
newTickets.push(parser.issueData);
|
||||||
PlaySound('modtools_new_ticket');
|
PlaySound(MODTOOLS_NEW_TICKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchModToolsState({
|
dispatchModToolsState({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ActivityPointNotificationMessageEvent, UserCreditsEvent, UserCurrencyEvent, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
|
import { ActivityPointNotificationMessageEvent, UserCreditsEvent, UserCurrencyEvent, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback } from 'react';
|
import { FC, useCallback } from 'react';
|
||||||
import { PlaySound } from '../../api/utils/PlaySound';
|
import { CREDITS, DUCKETS, PlaySound } from '../../api/utils/PlaySound';
|
||||||
import { CreateMessageHook } from '../../hooks/messages/message-event';
|
import { CreateMessageHook } from '../../hooks/messages/message-event';
|
||||||
import { usePurseContext } from './context/PurseContext';
|
import { usePurseContext } from './context/PurseContext';
|
||||||
import { PurseMessageHandlerProps } from './PurseMessageHandler.types';
|
import { PurseMessageHandlerProps } from './PurseMessageHandler.types';
|
||||||
@ -13,7 +13,7 @@ export const PurseMessageHandler: FC<PurseMessageHandlerProps> = props =>
|
|||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
if(purse.credits && purse.credits !== parseFloat(parser.credits)) PlaySound('credits');
|
if(purse.credits && purse.credits !== parseFloat(parser.credits)) PlaySound(CREDITS);
|
||||||
|
|
||||||
purse.credits = parseFloat(parser.credits);
|
purse.credits = parseFloat(parser.credits);
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export const PurseMessageHandler: FC<PurseMessageHandlerProps> = props =>
|
|||||||
|
|
||||||
purse.activityPoints.set(parser.type, parser.amount);
|
purse.activityPoints.set(parser.type, parser.amount);
|
||||||
|
|
||||||
if(parser.type === 0) PlaySound('duckets');
|
if(parser.type === 0) PlaySound(DUCKETS);
|
||||||
|
|
||||||
purse.notify();
|
purse.notify();
|
||||||
}, [ purse ]);
|
}, [ purse ]);
|
||||||
|
Loading…
Reference in New Issue
Block a user