chore: add audio
This commit is contained in:
1 parent
0e12a801d2
commit
295c1424c9
4 files changed
+51
No files matched your search
Binary file not shown.
@@ -24,6 +24,7 @@ export const currentLoadingInfo = writable<string>('Initializing...');
|
|||||||
export const firstStartup = writable<boolean>(false);
|
export const firstStartup = writable<boolean>(false);
|
||||||
|
|
||||||
export const launching = writable<boolean>(false);
|
export const launching = writable<boolean>(false);
|
||||||
|
export const nyanCatSong = writable<HTMLAudioElement | undefined>(undefined);
|
||||||
|
|
||||||
export const serverPing = writable<number | undefined>(undefined);
|
export const serverPing = writable<number | undefined>(undefined);
|
||||||
export const serverConnectionFails = writable(0);
|
export const serverConnectionFails = writable(0);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Logo from '$assets/logo.png';
|
import Logo from '$assets/logo.png';
|
||||||
|
import NyanCatSong from '$assets/nyan-cat.mp3';
|
||||||
import '../app.css';
|
import '../app.css';
|
||||||
|
|
||||||
import Titlebar from '@/components/ui/titlebar/titlebar.svelte';
|
import Titlebar from '@/components/ui/titlebar/titlebar.svelte';
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
discordPresence,
|
discordPresence,
|
||||||
firstStartup,
|
firstStartup,
|
||||||
launcherVersion,
|
launcherVersion,
|
||||||
|
nyanCatSong,
|
||||||
platform,
|
platform,
|
||||||
presenceLoading,
|
presenceLoading,
|
||||||
setupValues,
|
setupValues,
|
||||||
@@ -127,6 +129,14 @@
|
|||||||
description: 'text-center!',
|
description: 'text-center!',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
konami_code = [];
|
||||||
|
|
||||||
|
const audio = new Audio(NyanCatSong);
|
||||||
|
audio.loop = true;
|
||||||
|
audio.volume = 0.3;
|
||||||
|
audio.play();
|
||||||
|
nyanCatSong.set(audio);
|
||||||
|
|
||||||
secret_enabled = true;
|
secret_enabled = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
launcherVersion,
|
launcherVersion,
|
||||||
launching,
|
launching,
|
||||||
newVersion,
|
newVersion,
|
||||||
|
nyanCatSong,
|
||||||
osuBuild,
|
osuBuild,
|
||||||
osuStream,
|
osuStream,
|
||||||
platform,
|
platform,
|
||||||
@@ -426,6 +427,25 @@
|
|||||||
}
|
}
|
||||||
await new Promise((res) => setTimeout(res, 1500));
|
await new Promise((res) => setTimeout(res, 1500));
|
||||||
launchInfo = 'Launching osu!...';
|
launchInfo = 'Launching osu!...';
|
||||||
|
|
||||||
|
if ($nyanCatSong) {
|
||||||
|
const audio = $nyanCatSong;
|
||||||
|
const fadeOutDuration = 2000; // 2 seconds
|
||||||
|
const fadeOutSteps = 20;
|
||||||
|
const fadeOutStepTime = fadeOutDuration / fadeOutSteps;
|
||||||
|
const volumeStep = audio.volume / fadeOutSteps;
|
||||||
|
|
||||||
|
const fadeOutInterval = setInterval(() => {
|
||||||
|
if (audio.volume > 0) {
|
||||||
|
audio.volume = Math.max(0, audio.volume - volumeStep);
|
||||||
|
} else {
|
||||||
|
clearInterval(fadeOutInterval);
|
||||||
|
audio.pause();
|
||||||
|
audio.currentTime = 0;
|
||||||
|
}
|
||||||
|
}, fadeOutStepTime);
|
||||||
|
}
|
||||||
|
|
||||||
await replaceUIFiles(osuPath, false);
|
await replaceUIFiles(osuPath, false);
|
||||||
await new Promise((res) => setTimeout(res, 1000));
|
await new Promise((res) => setTimeout(res, 1000));
|
||||||
await getCurrentWindow().hide();
|
await getCurrentWindow().hide();
|
||||||
@@ -535,6 +555,26 @@
|
|||||||
if ($trackingEnabled) umami.track('app_exit_osu');
|
if ($trackingEnabled) umami.track('app_exit_osu');
|
||||||
cleanup = true;
|
cleanup = true;
|
||||||
launchInfo = 'Cleaning up...';
|
launchInfo = 'Cleaning up...';
|
||||||
|
|
||||||
|
if ($nyanCatSong) {
|
||||||
|
const audio = $nyanCatSong;
|
||||||
|
audio.play();
|
||||||
|
audio.volume = 0;
|
||||||
|
|
||||||
|
const fadeInDuration = 2000; // 2 seconds
|
||||||
|
const fadeInSteps = 20;
|
||||||
|
const fadeInStepTime = fadeInDuration / fadeInSteps;
|
||||||
|
const volumeStep = (1 - audio.volume) / fadeInSteps;
|
||||||
|
|
||||||
|
const fadeInInterval = setInterval(() => {
|
||||||
|
if (audio.volume < 0.5) {
|
||||||
|
audio.volume = Math.min(0.5, audio.volume + volumeStep);
|
||||||
|
} else {
|
||||||
|
clearInterval(fadeInInterval);
|
||||||
|
}
|
||||||
|
}, fadeInStepTime);
|
||||||
|
}
|
||||||
|
|
||||||
await getCurrentWindow().show();
|
await getCurrentWindow().show();
|
||||||
if (presenceUpdater) {
|
if (presenceUpdater) {
|
||||||
window.clearInterval(presenceUpdater);
|
window.clearInterval(presenceUpdater);
|
||||||
|
|||||||
Reference in new issue
Block a user