Load menu and level audio dynamically

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-15 14:54:57 +01:00
parent 6eb903cbaa
commit a75ade8b33
8 changed files with 67 additions and 6 deletions

View File

@@ -22,16 +22,13 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
@override
void initState() {
super.initState();
if (Wolf3d.I.music.isNotEmpty) {
Wolf3d.I.audio.playMusic(Wolf3d.I.music.first);
}
Wolf3d.I.audio.playMenuMusic();
}
void _selectEpisode(int index) {
Wolf3d.I.setActiveEpisode(index);
Navigator.of(context).push(
MaterialPageRoute(
// We pass the audio handles so the next screen can stop them when the game starts
builder: (context) => DifficultyScreen(),
),
);
@@ -39,7 +36,6 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
@override
Widget build(BuildContext context) {
// Determine how many episodes are available (10 levels per episode)
final int numberOfEpisodes = (Wolf3d.I.levels.length / 10).floor().clamp(
1,
6,