feat: randomize splashes

This commit is contained in:
neoapps-dev 2026-08-16 15:40:09 +03:00
parent 70dda3f780
commit c5608ff939
2 changed files with 5 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import { useSkinSync } from "../hooks/useSkinSync";
import { useDiscordRPC } from "../hooks/useDiscordRPC";
import { useGamepad } from "../hooks/useGamepad";
import { useUpdateCheck } from "../hooks/useUpdateCheck";
import { SPLASHES } from "../data/splashes";
import RpcService from "../services/RpcService";
interface UIContextType {
@ -175,7 +176,7 @@ export function LauncherProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
if (activeView === "main") {
audioRaw.setSplashIndex(-1);
audioRaw.setSplashIndex(Math.floor(Math.random() * SPLASHES.length));
}
}, [activeView]);

View file

@ -30,7 +30,9 @@ export function useAudioController({
isWindowVisible,
}: AudioControllerProps) {
const [currentTrack, setCurrentTrack] = useState(0);
const [splashIndex, setSplashIndex] = useState(-1);
const [splashIndex, setSplashIndex] = useState(
() => Math.floor(Math.random() * SPLASHES.length),
);
const audioContextRef = useRef<AudioContext | null>(null);
const musicSourceRef = useRef<AudioBufferSourceNode | null>(null);
const musicGainRef = useRef<GainNode | null>(null);