Added auto repeat and made some small fixes
This commit is contained in:
@@ -120,6 +120,9 @@ var winner_popup: PopupPanel = $WinnerPopupPanel
|
||||
@onready
|
||||
var winner_label: Label = $WinnerPopupPanel/WinnerLabel
|
||||
|
||||
@onready
|
||||
var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton
|
||||
|
||||
@onready
|
||||
var music_player_container: PanelContainer = $MusicPlayer
|
||||
|
||||
@@ -133,14 +136,17 @@ var current_player: Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var is_debug := OS.has_feature("debug")
|
||||
var is_mac := OS.has_feature("macos")
|
||||
var is_debug: bool = OS.has_feature("debug")
|
||||
|
||||
#var is_mac := OS.has_feature("macos")
|
||||
if is_debug:
|
||||
print("is_debug")
|
||||
Settings.default_path = "http://localhost:8080"
|
||||
Settings.selected_server = 3
|
||||
if is_mac:
|
||||
print("is_mac")
|
||||
##Settings.default_path = "http://localhost:8080"
|
||||
##Settings.selected_server = 3
|
||||
Settings.default_path = "http://localhost:8080"
|
||||
Settings.selected_server = 3
|
||||
#if is_mac:
|
||||
# print("is_mac")
|
||||
next_button.pressed.connect(next_track)
|
||||
show_answer_button.pressed.connect(show_answer_pressed)
|
||||
search_button.pressed.connect(show_search)
|
||||
@@ -160,6 +166,7 @@ func _ready() -> void:
|
||||
add_players_button.pressed.connect(add_players)
|
||||
add_player_button.pressed.connect(add_player)
|
||||
open_button.pressed.connect(open)
|
||||
auto_repeat_song_button.pressed.connect(repeat_song)
|
||||
|
||||
get_suggestion_list()
|
||||
fetch_full_music_list_at_start()
|
||||
@@ -172,15 +179,29 @@ func _input(event: InputEvent) -> void:
|
||||
if event.alt_pressed && event.keycode == KEY_DOWN:
|
||||
print("Alt + DOWN pressed")
|
||||
music_player_container.change_volume(-0.05)
|
||||
if event.alt_pressed && event.keycode == KEY_LEFT:
|
||||
if event.alt_pressed && event.ctrl_pressed && event.keycode == KEY_LEFT:
|
||||
print("Ctrl + Alt + LEFT pressed")
|
||||
music_player_container.restart()
|
||||
elif event.alt_pressed && event.keycode == KEY_LEFT:
|
||||
print("Alt + LEFT pressed")
|
||||
music_player_container.seek(-5)
|
||||
if event.alt_pressed && event.keycode == KEY_RIGHT:
|
||||
print("Alt + RIGHT pressed")
|
||||
music_player_container.seek(5)
|
||||
|
||||
if event.alt_pressed && event.keycode == KEY_ENTER:
|
||||
print("Alt + Enter pressed")
|
||||
Settings.fullscreen = !Settings.fullscreen
|
||||
if Settings.fullscreen == true:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
|
||||
if Settings.fullscreen == false:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
|
||||
func repeat_song() -> void:
|
||||
Settings.auto_repeat_song = !Settings.auto_repeat_song
|
||||
|
||||
func next_track() -> void:
|
||||
next_button.disabled = true
|
||||
music_player_container.pause()
|
||||
music_player_container.fetch_next_song()
|
||||
|
||||
func reset_playlist() -> void:
|
||||
@@ -228,7 +249,10 @@ func sync_games() -> void:
|
||||
reset_playlist()
|
||||
get_suggestion_list()
|
||||
search_view.get_list_of_games()
|
||||
Settings.make_request2("/sync", games_synced, false)
|
||||
if Settings.quick_sync == true:
|
||||
Settings.make_request2("/sync/quick", games_synced, false)
|
||||
else:
|
||||
Settings.make_request2("/sync", games_synced, false)
|
||||
|
||||
func get_suggestion_list() -> void:
|
||||
print("get_suggestion_list")
|
||||
@@ -237,7 +261,7 @@ func get_suggestion_list() -> void:
|
||||
games = []
|
||||
games.append_array(array)
|
||||
for game: String in games:
|
||||
var inspiration_label: Label= Label.new()
|
||||
var inspiration_label: Label = Label.new()
|
||||
inspiration_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
inspiration_label.add_theme_font_size_override("font_size", 20)
|
||||
inspiration_label.text = game
|
||||
@@ -333,6 +357,7 @@ func fetch_full_music_list(event: InputEvent, song_no: int) -> void:
|
||||
var music_label: Label= Label.new()
|
||||
music_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
music_label.add_theme_font_size_override("font_size", 20)
|
||||
music_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
game_label.text = song.Game
|
||||
song_label.text = song.Song
|
||||
var format_string: String = "%d. %s - %s"
|
||||
@@ -367,6 +392,7 @@ func fetched() -> void:
|
||||
var fetched_song_label: Label = Label.new()
|
||||
fetched_song_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
fetched_song_label.add_theme_font_size_override("font_size", 20)
|
||||
fetched_song_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
var format_string: String = "%d. %s - %s"
|
||||
var actual_string: String = format_string % [(song.SongNo+1), song.Game, song.Song]
|
||||
fetched_song_label.text = actual_string
|
||||
@@ -402,6 +428,7 @@ func song_clicked(event: InputEvent, clicked_song_label: Label, song_no: int) ->
|
||||
|
||||
func _on_player_removed(new_player: Node) -> void:
|
||||
print("_on_player_removed")
|
||||
Settings.player_removed()
|
||||
players.remove_child(new_player)
|
||||
|
||||
func _on_player_change_character_clicked(new_player: Node) -> void:
|
||||
|
||||
Reference in New Issue
Block a user