Add offline mode: play from a music folder instead of the server
Settings has a Music folder row. A folder with subfolders is played as soundtracks: Next picks a random subfolder and a random song in it, the subfolder is the answer's soundtrack and the file name without its type the song. The inspiration list and Search show the subfolders. A folder with songs and no subfolders is a prepared quiz, played once in order (natural sort) or at random, showing only the song title. It has no winning score: after the last song Next becomes Show winner, and the players with the most points win, ties included. While a folder is used nothing but the characters is asked from the server: Sync, QR, Statistics, the update check and play counting are off. Characters fall back to the cached pictures when the server can't be reached. mp3, ogg and wav play; other files and broken ones are skipped. The old local playback code, the hidden Open button and the hidden Local toggle are removed. Next now waits for the song to start before preparing the next one.
This commit is contained in:
1 parent
b120440404
commit
222d231b1b
42 files changed
+8245
-474
No files matched your search
+12
-7
@@ -12,8 +12,8 @@ var players_given_point: Array[String] = []
|
||||
var is_answered: bool = false
|
||||
var has_played: bool = false
|
||||
var is_playing: bool = false
|
||||
## The song's file in [method Playlist.songs_folder]. Read the song with
|
||||
## [method Playlist.get_song].
|
||||
## The song's file: a download in [method Playlist.songs_folder], or a song in the music
|
||||
## folder. Read the song with [method Playlist.get_song].
|
||||
var song_path: String = ""
|
||||
## The song itself, only when it could not be saved to a file.
|
||||
var song: AudioStream
|
||||
@@ -35,16 +35,21 @@ func get_song_title() -> String:
|
||||
|
||||
func get_song_info() -> String:
|
||||
if Settings.is_debug:
|
||||
var format_string: String = "%d. %s - %s | played: %s | answered: %s"
|
||||
return format_string % [(song_number + 1), soundtrack_title, song_title, has_played,
|
||||
is_answered]
|
||||
return "%d. %s | played: %s | answered: %s" % [(song_number + 1), _full_title(),
|
||||
has_played, is_answered]
|
||||
elif is_answered:
|
||||
var format_string: String = "%d. %s - %s"
|
||||
return format_string % [(song_number + 1), soundtrack_title, song_title]
|
||||
return "%d. %s" % [(song_number + 1), _full_title()]
|
||||
else:
|
||||
return "??? - ???"
|
||||
|
||||
|
||||
# "Soundtrack - Song", or only the song in a prepared quiz, which has no soundtracks
|
||||
func _full_title() -> String:
|
||||
if soundtrack_title.is_empty():
|
||||
return song_title
|
||||
return "%s - %s" % [soundtrack_title, song_title]
|
||||
|
||||
|
||||
func add_point(player_id: String) -> void:
|
||||
GameLog.debug("add_point")
|
||||
if !players_given_point.has(player_id):
|
||||
|
||||
Reference in new issue
Block a user