Split settings into a quiz card and an application Settings popup
- A Quiz settings button under the player bar opens a small card above it with the quiz settings, including Auto repeat, which moves there from under the player bar. The card does not dim the quiz, so it can be changed during a song, and grows to fit its rows. - A Settings button in the top bar opens the application settings: server, fullscreen and songs to download ahead. Quick sync is gone, as the server no longer has it, and the server list is in Settings. - Labels use sentence case, and seconds to hide show as whole numbers. - Debug builds switch to the local server and a low winning score in the Settings autoload, before any scene asks the server for anything. The DEBUG label moves to the top bar, so it shows on every tab. - Search moves from the top bar back to the quiz toolbar, as the Statistics tab has its own search.
This commit is contained in:
1 parent
8d21b0617d
commit
b510aa47f2
34 files changed
+3074
-2525
No files matched your search
+13
-27
@@ -1,7 +1,7 @@
|
||||
class_name Quiz
|
||||
extends Control
|
||||
## The quiz: the song that is playing, the playlist, the players and their points, and
|
||||
## the popups opened from here (settings, character select, winner and log).
|
||||
## the popups opened from here (the quiz settings card, character select and winner).
|
||||
##
|
||||
## The main window shows the quiz below its top bar. Pictures and buttons keep the
|
||||
## positions they had in the main window, so the quiz fills the whole window and lets
|
||||
@@ -12,6 +12,9 @@ extends Control
|
||||
|
||||
signal server_changed
|
||||
|
||||
## Emitted when Search is pressed. The Search popup is in the main window.
|
||||
signal search_pressed
|
||||
|
||||
## Emitted with a line for the game log, e.g. when a player gets a point.
|
||||
signal event_logged(text: String)
|
||||
|
||||
@@ -30,28 +33,23 @@ var popup_backdrop: PopupBackdrop
|
||||
@onready var now_playing: NowPlaying = $NowPlaying
|
||||
@onready var players_panel: PlayersPanel = $PlayersPanel
|
||||
@onready var toolbar: QuizToolbar = $QuizToolbar
|
||||
@onready var settings_popup: SettingsPopup = $SettingsPopup
|
||||
@onready var quiz_settings_card: QuizSettingsCard = $QuizSettingsCard
|
||||
@onready var quiz_settings_button: Button = $QuizSettingsButton
|
||||
@onready var winner_popup: WinnerPopup = %WinnerPopup
|
||||
@onready var song_controls: SongControls = $SongControls
|
||||
@onready var song_loader: SongLoader = $SongLoader
|
||||
@onready var music_list_panel: MusicListPanel = $MusicListPanel
|
||||
@onready var character_select_popup: CharacterSelectPopup = %CharacterSelectPopup
|
||||
@onready var music_player: MusicPlayer = $MusicPlayer
|
||||
@onready var debug_label: Label = $DebugLabel
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
popup_backdrop = PopupBackdrop.add_to(self, _popups())
|
||||
if OS.has_feature("debug"):
|
||||
GameLog.debug("is_debug")
|
||||
debug_label.visible = true
|
||||
Settings.is_debug = true
|
||||
settings_popup.set_winning_score(5)
|
||||
settings_popup.set_selected_server(4)
|
||||
song_controls.next_pressed.connect(play_next_song)
|
||||
song_controls.show_answer_pressed.connect(show_answer_pressed)
|
||||
toolbar.sound_test_pressed.connect(music_player.get_sound_test_song)
|
||||
toolbar.settings_pressed.connect(show_settings)
|
||||
toolbar.search_pressed.connect(search_pressed.emit)
|
||||
quiz_settings_button.pressed.connect(quiz_settings_card.toggle)
|
||||
toolbar.reset_playlist_pressed.connect(reset_playlist)
|
||||
toolbar.reset_points_pressed.connect(reset_points)
|
||||
song_loader.song_list_loaded.connect(update_song_list)
|
||||
@@ -64,8 +62,6 @@ func _ready() -> void:
|
||||
players_panel.change_character_requested.connect(_on_change_character_requested)
|
||||
music_player.play_next_song.connect(play_next_song)
|
||||
music_player.update_song_list.connect(update_song_list)
|
||||
settings_popup.server_changed.connect(_on_server_changed)
|
||||
settings_popup.visibility_changed.connect(_on_settings_popup_visibility_changed)
|
||||
|
||||
open_button.pressed.connect(open)
|
||||
|
||||
@@ -115,8 +111,9 @@ func refresh_from_server() -> void:
|
||||
character_select_popup.load_characters()
|
||||
|
||||
|
||||
func _on_server_changed() -> void:
|
||||
GameLog.debug("_on_server_changed")
|
||||
## Reloads everything from the server picked in the settings and starts a new game.
|
||||
func on_server_changed() -> void:
|
||||
GameLog.debug("on_server_changed")
|
||||
refresh_from_server()
|
||||
reset_points()
|
||||
server_changed.emit()
|
||||
@@ -139,15 +136,9 @@ func play_next_song() -> void:
|
||||
song_loader.fetch_song_if_idle()
|
||||
|
||||
|
||||
# The quiz settings card is left out: it does not dim the quiz
|
||||
func _popups() -> Array[BasePopup]:
|
||||
return [settings_popup, character_select_popup, winner_popup]
|
||||
|
||||
|
||||
# The cache size can be changed in the settings. Waiting until the settings are closed
|
||||
# avoids starting downloads while the user is still clicking the number up and down.
|
||||
func _on_settings_popup_visibility_changed() -> void:
|
||||
if !settings_popup.visible:
|
||||
song_loader.fill_cache()
|
||||
return [character_select_popup, winner_popup]
|
||||
|
||||
|
||||
func _on_song_added() -> void:
|
||||
@@ -204,11 +195,6 @@ func reset_points() -> void:
|
||||
stats_paused_by_win = false
|
||||
|
||||
|
||||
func show_settings() -> void:
|
||||
GameLog.debug("show_settings")
|
||||
settings_popup.open()
|
||||
|
||||
|
||||
# Each new player's points reach the music player, the log and the winner popup.
|
||||
func _on_player_added(new_player_object: PlayerObject) -> void:
|
||||
new_player_object.first_point_triggered.connect(music_player._on_point_triggered.bind("first"))
|
||||
|
||||
Reference in new issue
Block a user