Save the quiz and continue it after a restart; load characters from a folder
The quiz is saved to current_quiz.json in the config folder after every change, and the game goes on where it was when it starts again: the players with their points and characters, every song with who got a point for it and whether it was played, answered or is playing, and the songs downloaded ahead with their files. The song that was playing is ready to play again. Songs whose files are gone are downloaded again. On a server, the saved songs are checked against the server's playlist. If it changed, e.g. after a sync, or another server is used, the quiz starts over with the same players. A quiz from a music folder continues offline, including how far a prepared quiz has come. A new game is saved like any other change, and a file that can't be read starts a new quiz. Characters can be read from a folder picked in Settings instead of the server, for this session. A music folder with a characters folder brings its own characters, e.g. for a themed quiz; that folder is not counted as a soundtrack. When the characters come from somewhere else, players pick their characters again. Closes #11, closes #44
This commit is contained in:
1 parent
4a934840f6
commit
e4352a9f34
33 files changed
+2886
-499
No files matched your search
+21
-1
@@ -188,12 +188,32 @@ func play_song(song: AudioStream) -> void:
|
||||
music_time_label.text = format_text(progress_slider.value, stream.get_length())
|
||||
|
||||
|
||||
## Puts song [param song_object_no] in the player without playing it, e.g. the song that
|
||||
## was playing when the game was closed. Play starts it from the beginning.
|
||||
func load_song_object(song_object_no: int) -> void:
|
||||
var song: AudioStream = Playlist.get_song(song_object_no)
|
||||
if song == null:
|
||||
return
|
||||
audio_player.stream = song
|
||||
stream = song
|
||||
song_finished = true
|
||||
_show_playing(false)
|
||||
progress_slider.value = 0
|
||||
progress_slider.max_value = round(stream.get_length())
|
||||
progress_slider.tick_count = 0 if Settings.hide_ticks else round(stream.get_length() / 60)
|
||||
music_time_label.text = format_text(progress_slider.value, stream.get_length())
|
||||
|
||||
|
||||
func play_song_object(song_object_no: int) -> void:
|
||||
GameLog.debug("play_song_object")
|
||||
var song: AudioStream = Playlist.get_song(song_object_no)
|
||||
if song == null:
|
||||
GameLog.warning("Song ", song_object_no, " has no file to play")
|
||||
return
|
||||
if audio_player.is_playing():
|
||||
audio_player.stop()
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
audio_player.stream = Playlist.get_song(song_object_no)
|
||||
audio_player.stream = song
|
||||
sound_player.stop()
|
||||
audio_player.play()
|
||||
song_finished = false
|
||||
|
||||
Reference in new issue
Block a user