Update SoundNames

This commit is contained in:
Bill 2022-03-06 22:15:49 -05:00
parent d9a0c81104
commit e8316e3837
9 changed files with 25 additions and 22 deletions

View File

@ -5,10 +5,3 @@ export function PlaySound(sampleCode: string): void
{
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';

View File

@ -0,0 +1,9 @@
export class SoundNames
{
public static CAMERA_SHUTTER = 'camera_shutter';
public static CREDITS = 'credits';
public static DUCKETS = 'duckets';
public static MESSENGER_NEW_THREAD = 'messenger_new_thread';
public static MESSENGER_MESSAGE_RECEIVED = 'messenger_message_received';
public static MODTOOLS_NEW_TICKET = 'modtools_new_ticket';
}

View File

@ -6,3 +6,4 @@ export * from './LocalizeShortNumber';
export * from './LocalizeText';
export * from './PlaySound';
export * from './Randomizer';
export * from './SoundNames';

View File

@ -1,7 +1,7 @@
import { NitroRectangle, NitroRenderTexture } from '@nitrots/nitro-renderer';
import { FC, useCallback, useRef } from 'react';
import { GetRoomEngine, LocalizeText } from '../../api';
import { CAMERA_SHUTTER, PlaySound } from '../../api/utils/PlaySound';
import { GetRoomEngine, LocalizeText, SoundNames } from '../../api';
import { PlaySound } from '../../api/utils/PlaySound';
import { DraggableWindow } from '../draggable-window';
interface LayoutMiniCameraViewProps
@ -27,7 +27,7 @@ export const LayoutMiniCameraView: FC<LayoutMiniCameraViewProps> = props =>
const takePicture = useCallback(() =>
{
PlaySound(CAMERA_SHUTTER);
PlaySound(SoundNames.CAMERA_SHUTTER);
textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds()));
}, [ roomId, getCameraBounds, textureReceiver ]);

View File

@ -1,7 +1,7 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { NitroRectangle, TextureUtils } from '@nitrots/nitro-renderer';
import { FC, useCallback, useRef } from 'react';
import { CAMERA_SHUTTER, GetRoomEngine, GetRoomSession, LocalizeText, PlaySound } from '../../../../api';
import { GetRoomEngine, GetRoomSession, LocalizeText, PlaySound, SoundNames } from '../../../../api';
import { Column, DraggableWindow, Flex } from '../../../../common';
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
import { useCameraWidgetContext } from '../../CameraWidgetContext';
@ -52,7 +52,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
clone.pop();
}
PlaySound(CAMERA_SHUTTER);
PlaySound(SoundNames.CAMERA_SHUTTER);
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
setCameraRoll(clone);

View File

@ -1,6 +1,6 @@
import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, CREDITS, GetRoomEngine, LocalizeText, PlaySound, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../api';
import { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { CatalogPurchasedEvent } from '../../events';
import { BatchUpdates, UseUiEvent } from '../../hooks';
@ -268,7 +268,7 @@ export const CatalogView: FC<{}> = props =>
const onCatalogPurchasedEvent = useCallback((event: CatalogPurchasedEvent) =>
{
PlaySound(CREDITS);
PlaySound(SoundNames.CREDITS);
}, []);
UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);

View File

@ -1,6 +1,6 @@
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react';
import { MODTOOLS_NEW_TICKET, PlaySound } from '../../api';
import { PlaySound, SoundNames } from '../../api';
import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserChatlogEvent, ModToolsOpenUserInfoEvent } from '../../events';
import { UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
@ -54,7 +54,7 @@ export const ModToolsMessageHandler: FC<{}> = props =>
else
{
newTickets.push(parser.issueData);
PlaySound(MODTOOLS_NEW_TICKET);
PlaySound(SoundNames.MODTOOLS_NEW_TICKET);
}
dispatchModToolsState({

View File

@ -1,6 +1,6 @@
import { ActivityPointNotificationMessageEvent, FriendlyTime, HabboClubLevelEnum, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { CreateLinkEvent, CREDITS, DUCKETS, GetConfiguration, LocalizeText, PlaySound, SendMessageComposer } from '../../api';
import { CreateLinkEvent, GetConfiguration, LocalizeText, PlaySound, SendMessageComposer, SoundNames } from '../../api';
import { Column, Flex, Grid, LayoutCurrencyIcon, Text } from '../../common';
import { HcCenterEvent, UserSettingsUIEvent } from '../../events';
import { DispatchUiEvent, UseMessageEventHook } from '../../hooks';
@ -75,7 +75,7 @@ export const PurseView: FC<{}> = props =>
newValue.credits = parseFloat(parser.credits);
if(prevValue.credits !== newValue.credits) PlaySound(CREDITS);
if(prevValue.credits !== newValue.credits) PlaySound(SoundNames.CREDITS);
return newValue;
});
@ -111,7 +111,7 @@ export const PurseView: FC<{}> = props =>
newValue.activityPoints.set(parser.type, parser.amount);
if(parser.type === 0) PlaySound(DUCKETS)
if(parser.type === 0) PlaySound(SoundNames.DUCKETS)
return newValue;
});

View File

@ -1,6 +1,6 @@
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, RoomInviteEvent, SendMessageComposer as SendMessageComposerPacket } from '@nitrots/nitro-renderer';
import { FC, KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, MESSENGER_MESSAGE_RECEIVED, MESSENGER_NEW_THREAD, PlaySound, RemoveLinkEventTracker, SendMessageComposer } from '../../../../api';
import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../../../api';
import { Base, Button, ButtonGroup, Column, Flex, Grid, LayoutAvatarImageView, LayoutBadgeImageView, LayoutItemCountView, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { FriendsMessengerIconEvent } from '../../../../events';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
@ -127,7 +127,7 @@ export const FriendsMessengerView: FC<{}> = props =>
SendMessageComposer(new SendMessageComposerPacket(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(SoundNames.MESSENGER_NEW_THREAD);
thread.addMessage(GetSessionDataManager().userId, messageText, 0, null, MessengerThreadChat.CHAT);
@ -242,7 +242,7 @@ export const FriendsMessengerView: FC<{}> = props =>
}
}
if(isUnread) PlaySound(MESSENGER_MESSAGE_RECEIVED);
if(isUnread) PlaySound(SoundNames.MESSENGER_MESSAGE_RECEIVED);
DispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
}, [visibleThreads, updateValue]);