feat(audio): looping per-season background music system
MusicService (looping audioplayers player, independent of SFX) driven by the active season theme's new 'bgm' key; switches track on season change, pauses on app background, all failures swallowed. Separate Music on/off toggle in Settings (persisted, independent of SFX). Season packs carry bgm keys (menu/season_001/ season_002), manifest regenerated. Assets slot assets/audio/bgm/ ready — drop in menu.mp3/season_001.mp3/season_002.mp3 (CC0) and it plays; silent until then. 180 tests green, analyze clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ class SeasonTheme {
|
||||
this.particleType = 'petals',
|
||||
this.tilePalette,
|
||||
this.boardTint,
|
||||
this.bgm = 'menu',
|
||||
});
|
||||
|
||||
factory SeasonTheme.fromJson(Map<String, dynamic> json) => SeasonTheme(
|
||||
@@ -25,6 +26,7 @@ class SeasonTheme {
|
||||
? [for (final c in json['tilePalette'] as List) (c as num).toInt()]
|
||||
: null,
|
||||
boardTint: json['boardTint'] as int?,
|
||||
bgm: (json['bgm'] as String?) ?? 'menu',
|
||||
);
|
||||
|
||||
/// Season 1 "First Bloom": deep navy dusk.
|
||||
@@ -48,6 +50,10 @@ class SeasonTheme {
|
||||
/// Optional board background override.
|
||||
final int? boardTint;
|
||||
|
||||
/// Looping background-music track key, resolved to `assets/audio/bgm/KEY.mp3`.
|
||||
/// Remote seasons reuse bundled track keys (no remote audio download).
|
||||
final String bgm;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'tileSet': tileSet,
|
||||
'background': background,
|
||||
@@ -56,6 +62,7 @@ class SeasonTheme {
|
||||
'particleType': particleType,
|
||||
if (tilePalette != null) 'tilePalette': tilePalette,
|
||||
if (boardTint != null) 'boardTint': boardTint,
|
||||
'bgm': bgm,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user