mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Update SoundNames
This commit is contained in:
parent
d9a0c81104
commit
e8316e3837
@ -5,10 +5,3 @@ 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';
|
|
||||||
|
9
src/api/utils/SoundNames.ts
Normal file
9
src/api/utils/SoundNames.ts
Normal 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';
|
||||||
|
}
|
@ -6,3 +6,4 @@ export * from './LocalizeShortNumber';
|
|||||||
export * from './LocalizeText';
|
export * from './LocalizeText';
|
||||||
export * from './PlaySound';
|
export * from './PlaySound';
|
||||||
export * from './Randomizer';
|
export * from './Randomizer';
|
||||||
|
export * from './SoundNames';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { NitroRectangle, NitroRenderTexture } from '@nitrots/nitro-renderer';
|
import { NitroRectangle, NitroRenderTexture } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useRef } from 'react';
|
import { FC, useCallback, useRef } from 'react';
|
||||||
import { GetRoomEngine, LocalizeText } from '../../api';
|
import { GetRoomEngine, LocalizeText, SoundNames } from '../../api';
|
||||||
import { CAMERA_SHUTTER, PlaySound } from '../../api/utils/PlaySound';
|
import { PlaySound } from '../../api/utils/PlaySound';
|
||||||
import { DraggableWindow } from '../draggable-window';
|
import { DraggableWindow } from '../draggable-window';
|
||||||
|
|
||||||
interface LayoutMiniCameraViewProps
|
interface LayoutMiniCameraViewProps
|
||||||
@ -27,7 +27,7 @@ export const LayoutMiniCameraView: FC<LayoutMiniCameraViewProps> = props =>
|
|||||||
|
|
||||||
const takePicture = useCallback(() =>
|
const takePicture = useCallback(() =>
|
||||||
{
|
{
|
||||||
PlaySound(CAMERA_SHUTTER);
|
PlaySound(SoundNames.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 { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
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 { CAMERA_SHUTTER, GetRoomEngine, GetRoomSession, LocalizeText, PlaySound } from '../../../../api';
|
import { GetRoomEngine, GetRoomSession, LocalizeText, PlaySound, SoundNames } from '../../../../api';
|
||||||
import { Column, DraggableWindow, Flex } from '../../../../common';
|
import { Column, DraggableWindow, Flex } from '../../../../common';
|
||||||
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
|
import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities';
|
||||||
import { useCameraWidgetContext } from '../../CameraWidgetContext';
|
import { useCameraWidgetContext } from '../../CameraWidgetContext';
|
||||||
@ -52,7 +52,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
|||||||
clone.pop();
|
clone.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySound(CAMERA_SHUTTER);
|
PlaySound(SoundNames.CAMERA_SHUTTER);
|
||||||
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
|
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
|
||||||
|
|
||||||
setCameraRoll(clone);
|
setCameraRoll(clone);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
|
import { FrontPageItem, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, RoomPreviewer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
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 { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||||
import { CatalogPurchasedEvent } from '../../events';
|
import { CatalogPurchasedEvent } from '../../events';
|
||||||
import { BatchUpdates, UseUiEvent } from '../../hooks';
|
import { BatchUpdates, UseUiEvent } from '../../hooks';
|
||||||
@ -268,7 +268,7 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
|
|
||||||
const onCatalogPurchasedEvent = useCallback((event: CatalogPurchasedEvent) =>
|
const onCatalogPurchasedEvent = useCallback((event: CatalogPurchasedEvent) =>
|
||||||
{
|
{
|
||||||
PlaySound(CREDITS);
|
PlaySound(SoundNames.CREDITS);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);
|
UseUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, onCatalogPurchasedEvent);
|
||||||
|
@ -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 { MODTOOLS_NEW_TICKET, PlaySound } from '../../api';
|
import { PlaySound, SoundNames } from '../../api';
|
||||||
import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserChatlogEvent, ModToolsOpenUserInfoEvent } from '../../events';
|
import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserChatlogEvent, ModToolsOpenUserInfoEvent } from '../../events';
|
||||||
import { UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
|
import { UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
|
||||||
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
|
import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType';
|
||||||
@ -54,7 +54,7 @@ export const ModToolsMessageHandler: FC<{}> = props =>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
newTickets.push(parser.issueData);
|
newTickets.push(parser.issueData);
|
||||||
PlaySound(MODTOOLS_NEW_TICKET);
|
PlaySound(SoundNames.MODTOOLS_NEW_TICKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchModToolsState({
|
dispatchModToolsState({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ActivityPointNotificationMessageEvent, FriendlyTime, HabboClubLevelEnum, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
|
import { ActivityPointNotificationMessageEvent, FriendlyTime, HabboClubLevelEnum, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
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 { Column, Flex, Grid, LayoutCurrencyIcon, Text } from '../../common';
|
||||||
import { HcCenterEvent, UserSettingsUIEvent } from '../../events';
|
import { HcCenterEvent, UserSettingsUIEvent } from '../../events';
|
||||||
import { DispatchUiEvent, UseMessageEventHook } from '../../hooks';
|
import { DispatchUiEvent, UseMessageEventHook } from '../../hooks';
|
||||||
@ -75,7 +75,7 @@ export const PurseView: FC<{}> = props =>
|
|||||||
|
|
||||||
newValue.credits = parseFloat(parser.credits);
|
newValue.credits = parseFloat(parser.credits);
|
||||||
|
|
||||||
if(prevValue.credits !== newValue.credits) PlaySound(CREDITS);
|
if(prevValue.credits !== newValue.credits) PlaySound(SoundNames.CREDITS);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
@ -111,7 +111,7 @@ export const PurseView: FC<{}> = props =>
|
|||||||
|
|
||||||
newValue.activityPoints.set(parser.type, parser.amount);
|
newValue.activityPoints.set(parser.type, parser.amount);
|
||||||
|
|
||||||
if(parser.type === 0) PlaySound(DUCKETS)
|
if(parser.type === 0) PlaySound(SoundNames.DUCKETS)
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, RoomInviteEvent, SendMessageComposer as SendMessageComposerPacket } from '@nitrots/nitro-renderer';
|
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, RoomInviteEvent, SendMessageComposer as SendMessageComposerPacket } 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, 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 { Base, Button, ButtonGroup, Column, Flex, Grid, LayoutAvatarImageView, LayoutBadgeImageView, LayoutItemCountView, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
|
||||||
import { FriendsMessengerIconEvent } from '../../../../events';
|
import { FriendsMessengerIconEvent } from '../../../../events';
|
||||||
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
|
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
|
||||||
@ -127,7 +127,7 @@ export const FriendsMessengerView: FC<{}> = props =>
|
|||||||
|
|
||||||
SendMessageComposer(new SendMessageComposerPacket(thread.participant.id, messageText));
|
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);
|
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));
|
DispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
||||||
}, [visibleThreads, updateValue]);
|
}, [visibleThreads, updateValue]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user