mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Sounds
This commit is contained in:
parent
785b411889
commit
a8eb8ecf22
59
package-lock.json
generated
59
package-lock.json
generated
@ -1817,12 +1817,13 @@
|
||||
"@nitrots/nitro-renderer": {
|
||||
"version": "file:../nitro-renderer",
|
||||
"requires": {
|
||||
"@pixi/canvas-renderer": "^6.1.0",
|
||||
"@pixi/extract": "^6.1.0",
|
||||
"@pixi/canvas-renderer": "^6.1.3",
|
||||
"@pixi/extract": "^6.1.3",
|
||||
"@pixi/filter-adjustment": "^4.1.3",
|
||||
"@pixi/tilemap": "^3.2.2",
|
||||
"pako": "^2.0.4",
|
||||
"pixi.js": "^6.1.0",
|
||||
"tslib": "^2.3.0"
|
||||
"pixi.js": "^6.1.3",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": {
|
||||
@ -2108,6 +2109,11 @@
|
||||
"resolved": "https://registry.npmjs.org/@pixi/ticker/-/ticker-6.1.0.tgz",
|
||||
"integrity": "sha512-tCh1dhmriLKLMcxTJ9usm1UZEK2+M5nEwvyec9kouF4EMi/PiGup65+pwTHK4SvjXD+9vbtTDam39fWYXCpRxg=="
|
||||
},
|
||||
"@pixi/tilemap": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@pixi/tilemap/-/tilemap-3.2.2.tgz",
|
||||
"integrity": "sha512-svdmMyJP63vdae3t66tCmE8IWeO/6lD1xXU+5gzfxqxJS5seTp2bm8mQok2c8PF0O6l/NYlLz6BRklOuEuHboQ=="
|
||||
},
|
||||
"@pixi/utils": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-6.1.0.tgz",
|
||||
@ -11826,6 +11832,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"load-script": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-script/-/load-script-1.0.0.tgz",
|
||||
"integrity": "sha1-BJGTngvuVkPuSUp+PaPSuscMbKQ="
|
||||
},
|
||||
"loader-runner": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
|
||||
@ -15025,6 +15036,16 @@
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"react-youtube": {
|
||||
"version": "7.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-youtube/-/react-youtube-7.13.1.tgz",
|
||||
"integrity": "sha512-b++TLHmHDpd0ZBS1wcbYabbuchU+W4jtx5A2MUQX0BINNKKsaIQX29sn/aLvZ9v5luwAoceia3VGtyz9blaB9w==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"prop-types": "15.7.2",
|
||||
"youtube-player": "5.5.2"
|
||||
}
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
|
||||
@ -16219,6 +16240,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"sister": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/sister/-/sister-3.0.2.tgz",
|
||||
"integrity": "sha512-p19rtTs+NksBRKW9qn0UhZ8/TUI9BPw9lmtHny+Y3TinWlOa9jWh9xB0AtPSdmOy49NJJJSSe0Ey4C7h0TrcYA=="
|
||||
},
|
||||
"sisteransi": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
|
||||
@ -19328,6 +19354,31 @@
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="
|
||||
},
|
||||
"youtube-player": {
|
||||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/youtube-player/-/youtube-player-5.5.2.tgz",
|
||||
"integrity": "sha512-ZGtsemSpXnDky2AUYWgxjaopgB+shFHgXVpiJFeNB5nWEugpW1KWYDaHKuLqh2b67r24GtP6HoSW5swvf0fFIQ==",
|
||||
"requires": {
|
||||
"debug": "^2.6.6",
|
||||
"load-script": "^1.0.0",
|
||||
"sister": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
"hof.furni.url": "https://swf.nitrots.co/dcr/hof_furni",
|
||||
"images.url": "${asset.url}/images",
|
||||
"gamedata.url": "${asset.url}/gamedata",
|
||||
"sounds.url": "${asset.url}/sounds",
|
||||
"sounds.url": "${asset.url}/sounds/%sample%.mp3",
|
||||
"external.texts.url": [ "${gamedata.url}/ExternalTexts.json", "${gamedata.url}/UITexts.json" ],
|
||||
"external.samples.url": "${hof.furni.url}/mp3/sound_machine_sample_%sample%.mp3",
|
||||
"furnidata.url": "${gamedata.url}/FurnitureData.json",
|
||||
|
7
src/api/utils/PlaySound.ts
Normal file
7
src/api/utils/PlaySound.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent';
|
||||
import { dispatchMainEvent } from '../../hooks';
|
||||
|
||||
export function PlaySound(sampleCode: string): void
|
||||
{
|
||||
dispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { NitroRectangle, TextureUtils } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useRef } from 'react';
|
||||
import { GetRoomEngine, GetRoomSession, LocalizeText } from '../../../../api';
|
||||
import { PlaySound } from '../../../../api/utils/PlaySound';
|
||||
import { DraggableWindow } from '../../../../layout';
|
||||
import { CameraPicture } from '../../common/CameraPicture';
|
||||
import { useCameraWidgetContext } from '../../context/CameraWidgetContext';
|
||||
@ -30,7 +31,6 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
||||
if(selectedPictureIndex > -1)
|
||||
{
|
||||
setSelectedPictureIndex(-1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ export const CameraWidgetCaptureView: FC<CameraWidgetCaptureViewProps> = props =
|
||||
clone.pop();
|
||||
}
|
||||
|
||||
PlaySound('camera_shutter');
|
||||
clone.push(new CameraPicture(texture, TextureUtils.generateImageUrl(texture)));
|
||||
|
||||
setCameraRoll(clone);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useReducer, useState } from 'react';
|
||||
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api';
|
||||
import { PlaySound } from '../../api/utils/PlaySound';
|
||||
import { CatalogEvent } from '../../events';
|
||||
import { useUiEvent } from '../../hooks/events/ui/ui-event';
|
||||
import { SendMessageHook } from '../../hooks/messages/message-event';
|
||||
@ -47,6 +48,9 @@ export const CatalogView: FC<CatalogViewProps> = props =>
|
||||
save = true;
|
||||
setIsVisible(value => !value);
|
||||
return;
|
||||
case CatalogEvent.PURCHASE_SUCCESS:
|
||||
PlaySound('credits');
|
||||
return;
|
||||
}
|
||||
|
||||
if(save) saveActivePages();
|
||||
@ -56,6 +60,7 @@ export const CatalogView: FC<CatalogViewProps> = props =>
|
||||
useUiEvent(CatalogEvent.HIDE_CATALOG, onCatalogEvent);
|
||||
useUiEvent(CatalogEvent.TOGGLE_CATALOG, onCatalogEvent);
|
||||
useUiEvent(CatalogEvent.CATALOG_RESET, onCatalogEvent);
|
||||
useUiEvent(CatalogEvent.PURCHASE_SUCCESS, onCatalogEvent);
|
||||
|
||||
const linkReceived = useCallback((url: string) =>
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { FollowFriendMessageComposer, ILinkEventTracker, NewConsoleMessageEvent, SendMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { AddEventLinkTracker, GetUserProfile, LocalizeText, RemoveLinkEventTracker } from '../../../../api';
|
||||
import { PlaySound } from '../../../../api/utils/PlaySound';
|
||||
import { FriendsMessengerIconEvent } from '../../../../events';
|
||||
import { BatchUpdates, CreateMessageHook, dispatchUiEvent, SendMessageHook } from '../../../../hooks';
|
||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutButton, NitroLayoutButtonGroup, NitroLayoutFlex, NitroLayoutFlexColumn } from '../../../../layout';
|
||||
@ -114,6 +115,8 @@ export const FriendsMessengerView: FC<{}> = props =>
|
||||
|
||||
SendMessageHook(new SendMessageComposer(thread.participant.id, messageText));
|
||||
|
||||
if(messageThreads.length === 1 && thread.groups.length === 1) PlaySound('messenger_new_thread');
|
||||
|
||||
thread.addMessage(0, messageText, 0, null, MessengerThreadChat.CHAT);
|
||||
|
||||
BatchUpdates(() =>
|
||||
@ -227,6 +230,8 @@ export const FriendsMessengerView: FC<{}> = props =>
|
||||
}
|
||||
}
|
||||
|
||||
if(isUnread) PlaySound('messenger_message_received');
|
||||
|
||||
dispatchUiEvent(new FriendsMessengerIconEvent(FriendsMessengerIconEvent.UPDATE_ICON, isUnread ? FriendsMessengerIconEvent.UNREAD_ICON : FriendsMessengerIconEvent.SHOW_ICON));
|
||||
}, [ visibleThreads, updateValue ]);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback } from 'react';
|
||||
import { PlaySound } from '../../api/utils/PlaySound';
|
||||
import { NotificationAlertEvent } from '../../events';
|
||||
import { ModToolsEvent } from '../../events/mod-tools/ModToolsEvent';
|
||||
import { ModToolsOpenRoomChatlogEvent } from '../../events/mod-tools/ModToolsOpenRoomChatlogEvent';
|
||||
@ -57,6 +58,7 @@ export const ModToolsMessageHandler: FC<{}> = props =>
|
||||
else
|
||||
{
|
||||
newTickets.push(parser.issueData);
|
||||
PlaySound('modtools_new_ticket');
|
||||
}
|
||||
|
||||
dispatchModToolsState({
|
||||
@ -66,8 +68,6 @@ export const ModToolsMessageHandler: FC<{}> = props =>
|
||||
}
|
||||
});
|
||||
|
||||
//todo: play ticket sound
|
||||
//GetNitroInstance().events.dispatchEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sound)
|
||||
console.log(parser);
|
||||
}, [dispatchModToolsState, tickets]);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { ActivityPointNotificationMessageEvent, UserCreditsEvent, UserCurrencyEvent, UserSubscriptionEvent, UserSubscriptionParser } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback } from 'react';
|
||||
import { PlaySound } from '../../api/utils/PlaySound';
|
||||
import { CreateMessageHook } from '../../hooks/messages/message-event';
|
||||
import { usePurseContext } from './context/PurseContext';
|
||||
import { PurseMessageHandlerProps } from './PurseMessageHandler.types';
|
||||
@ -12,6 +13,8 @@ export const PurseMessageHandler: FC<PurseMessageHandlerProps> = props =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
if(purse.credits && purse.credits !== parseFloat(parser.credits)) PlaySound('credits');
|
||||
|
||||
purse.credits = parseFloat(parser.credits);
|
||||
|
||||
purse.notify();
|
||||
@ -32,6 +35,8 @@ export const PurseMessageHandler: FC<PurseMessageHandlerProps> = props =>
|
||||
|
||||
purse.activityPoints.set(parser.type, parser.amount);
|
||||
|
||||
if(parser.type === 0) PlaySound('duckets');
|
||||
|
||||
purse.notify();
|
||||
}, [ purse ]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user