diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-29 09:13:31 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-29 09:13:31 +0500 |
| commit | b9050a21c0bcb988ac90a1d0082ab03277e490da (patch) | |
| tree | 85bd3c0e6093d861338a3ef6b5a8ed4d25817f42 /core/src/kz/ilotterytea/maxon/audio | |
| parent | 4ffacd6cf5a2dbcb89f4d2a3ab6c192f1f343223 (diff) | |
feat: controllable sfx and music
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/audio')
| -rw-r--r-- | core/src/kz/ilotterytea/maxon/audio/Playlist.kt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/kz/ilotterytea/maxon/audio/Playlist.kt b/core/src/kz/ilotterytea/maxon/audio/Playlist.kt index 10363a5..2e79f37 100644 --- a/core/src/kz/ilotterytea/maxon/audio/Playlist.kt +++ b/core/src/kz/ilotterytea/maxon/audio/Playlist.kt @@ -12,6 +12,11 @@ class Playlist(vararg musics: Music) { private var index = 0 var shuffleMode = false + var volume = 1f + set(value) { + playingNow.volume = value + field = value + } /** * Play next music. @@ -22,13 +27,14 @@ class Playlist(vararg musics: Music) { if (shuffleMode) { index = Math.getRandomNumber(0, playlist.size - 1) playingNow = playlist[index] - playingNow.play() } else { index++ if (index > playlist.size - 1) index = 0 playingNow = playlist[index] - playingNow.play() } + + playingNow.volume = volume + playingNow.play() } }
\ No newline at end of file |
