Fixed auto scrolling to inspiration. Fixed show answer changes song list. Started working on some colors
This commit is contained in:
@@ -7,7 +7,10 @@ var open_button := $Open
|
||||
var fileDialog := $FileDialog
|
||||
|
||||
@onready
|
||||
var list := $ScrollContainer/VBoxContainer
|
||||
var insperation_scroll := $ScrollContainer
|
||||
|
||||
@onready
|
||||
var insperation_list := $ScrollContainer/VBoxContainer
|
||||
|
||||
@onready
|
||||
var game_label := $VBoxContainer/GameLabel
|
||||
@@ -111,6 +114,7 @@ func fetched():
|
||||
push_error("An error occurred in the HTTP request.")
|
||||
|
||||
|
||||
var next_label: Label
|
||||
func show_fetched(result, response_code, headers, body) -> void:
|
||||
var json = JSON.new()
|
||||
var error = json.parse(body.get_string_from_utf8())
|
||||
@@ -120,6 +124,9 @@ func show_fetched(result, response_code, headers, body) -> void:
|
||||
print("data_received: ", data_received)
|
||||
game_label.text = data_received.Game
|
||||
song_label.text = data_received.Song
|
||||
var format_string = "%d. %s - %s"
|
||||
var actual_string = format_string % [(data_received.SongNo+1), data_received.Game, data_received.Song]
|
||||
next_label.text = actual_string
|
||||
|
||||
var song_list = []
|
||||
func show_fetched_list(result, response_code, headers, body) -> void:
|
||||
@@ -142,17 +149,17 @@ func show_fetched_list(result, response_code, headers, body) -> void:
|
||||
label.gui_input.connect(song_clicked.bind(song.SongNo))
|
||||
music_list.add_child(label)
|
||||
|
||||
var label := Label.new()
|
||||
label.text = "??? - ???"
|
||||
label.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
label.gui_input.connect(show_fetched)
|
||||
music_list.add_child(label)
|
||||
next_label = Label.new()
|
||||
next_label.text = "??? - ???"
|
||||
next_label.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
next_label.gui_input.connect(show_fetched)
|
||||
music_list.add_child(next_label)
|
||||
|
||||
else:
|
||||
print("Unexpected data")
|
||||
|
||||
func song_clicked(event, song_no):
|
||||
if (event is InputEventMouseButton && event.pressed && event.button_index == 1):
|
||||
if (event is InputEventMouseButton && event.pressed && event.button_index == MOUSE_BUTTON_LEFT):
|
||||
print("Clicked: " + str(song_no))
|
||||
|
||||
# Called when the HTTP request is completed.
|
||||
@@ -167,8 +174,9 @@ func _http_request_completed(result, response_code, headers, body):
|
||||
for game in games:
|
||||
var label := Label.new()
|
||||
label.text = game
|
||||
list.add_child(label)
|
||||
#print(data_received) # Prints array
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
insperation_list.add_child(label)
|
||||
insperation_scroll.scroll_to_bottom()
|
||||
else:
|
||||
print("Unexpected data")
|
||||
|
||||
@@ -185,7 +193,7 @@ func open():
|
||||
func _process(delta):
|
||||
if audio.has_stream_playback() && !is_changing && !audio.stream_paused:
|
||||
progress.value = audio.get_playback_position()
|
||||
label.text = format_text(progress.value, stream.get_length())
|
||||
label.text = format_text(progress.value, stream.get_length())
|
||||
|
||||
func _on_file_dialog_dir_selected(path):
|
||||
print(path)
|
||||
@@ -217,7 +225,7 @@ func dir_contents(path: String) -> void:
|
||||
for game in games:
|
||||
var label := Label.new()
|
||||
label.text = game
|
||||
list.add_child(label)
|
||||
insperation_list.add_child(label)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user