Save the quiz and continue it after a restart; load characters from a folder
Build / test (push) Successful in 1m25s
Build / build (push) Successful in 1m12s

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:
Sansan committed 2026-10-09 18:08:50 +02:00
1 parent 4a934840f6
commit e4352a9f34
33 files changed
+2886 -499

No files matched your search

+10 -6
View File
@@ -3,8 +3,11 @@ extends Panel
## One character in the character select popup: its picture and name. Clicking it picks
## the character.
## Emitted with the character's picture when the card is clicked.
signal new_character_selected(img_texture: ImageTexture)
## Emitted with the character's picture and name when the card is clicked.
signal new_character_selected(img_texture: ImageTexture, character_name: String)
## The character's name: its picture's file name, e.g. "PaperMario.png".
var character_name: String = ""
@onready var character_image: TextureRect = %CharacterTextureRect
@onready var character_name_label: Label = %CharacterName
@@ -19,12 +22,13 @@ func _ready() -> void:
## Shows [param character_name] and its picture. [param fetch_image] is called with the
## name and a Callable that takes the picture as an [Image], e.g.
## [method CharacterCache.fetch_image].
func set_character_name(character_name: String, fetch_image: Callable) -> void:
character_name_label.text = display_name(character_name)
func set_character_name(new_name: String, fetch_image: Callable) -> void:
character_name = new_name
character_name_label.text = display_name(new_name)
tooltip_text = character_name_label.text
var image_fetched: Callable = func image_fetched(picture: Image) -> void:
character_image.texture = ImageTexture.create_from_image(picture)
fetch_image.call(character_name, image_fetched)
fetch_image.call(new_name, image_fetched)
## The name to show for a picture's [param file_name]: without the file extension, and
@@ -58,4 +62,4 @@ func _on_gui_input(event: InputEvent) -> void:
&& event.button_index == MOUSE_BUTTON_LEFT && Settings.character_select_open:
accept_event()
GameLog.debug(character_name_label.text)
new_character_selected.emit(character_image.texture)
new_character_selected.emit(character_image.texture, character_name)