mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-08-20 04:27:29 +00:00
feat: randomize splashes
This commit is contained in:
parent
70dda3f780
commit
c5608ff939
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue