Fixed auto scrolling to inspiration. Fixed show answer changes song list. Started working on some colors
This commit is contained in:
36
InsperationScrollContainer.gd
Normal file
36
InsperationScrollContainer.gd
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
extends ScrollContainer
|
||||||
|
|
||||||
|
var SCROLL = 0
|
||||||
|
var delay = 0.02 #seconds
|
||||||
|
var wait = 0
|
||||||
|
|
||||||
|
var SPEED: int = 1
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
wait = delay
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
wait -= delta
|
||||||
|
if wait < 0:
|
||||||
|
wait = delay
|
||||||
|
#SCROLL DOWN
|
||||||
|
if SCROLL == 1:
|
||||||
|
if (scroll_vertical + get_v_scroll_bar().page) < get_v_scroll_bar().max_value:
|
||||||
|
scroll_vertical += SPEED
|
||||||
|
else:
|
||||||
|
scroll_back_up()
|
||||||
|
#SCROLL UP
|
||||||
|
elif SCROLL == -1:
|
||||||
|
if scroll_vertical != 0:
|
||||||
|
scroll_vertical -= SPEED
|
||||||
|
else:
|
||||||
|
scroll_to_bottom()
|
||||||
|
|
||||||
|
func scroll_back_up():
|
||||||
|
SCROLL = -1
|
||||||
|
|
||||||
|
func scroll_to_bottom():
|
||||||
|
scroll_vertical = 0 #Reset to top first.
|
||||||
|
SCROLL = 1
|
||||||
7
LightGrayTheme.tres
Normal file
7
LightGrayTheme.tres
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://rxexo3ur85as"]
|
||||||
|
|
||||||
|
[ext_resource type="StyleBox" uid="uid://blf3g88mugovr" path="res://neutral_gray.tres" id="1_alhp2"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
Label/styles/normal = ExtResource("1_alhp2")
|
||||||
|
PanelContainer/styles/panel = ExtResource("1_alhp2")
|
||||||
@@ -7,7 +7,10 @@ var open_button := $Open
|
|||||||
var fileDialog := $FileDialog
|
var fileDialog := $FileDialog
|
||||||
|
|
||||||
@onready
|
@onready
|
||||||
var list := $ScrollContainer/VBoxContainer
|
var insperation_scroll := $ScrollContainer
|
||||||
|
|
||||||
|
@onready
|
||||||
|
var insperation_list := $ScrollContainer/VBoxContainer
|
||||||
|
|
||||||
@onready
|
@onready
|
||||||
var game_label := $VBoxContainer/GameLabel
|
var game_label := $VBoxContainer/GameLabel
|
||||||
@@ -111,6 +114,7 @@ func fetched():
|
|||||||
push_error("An error occurred in the HTTP request.")
|
push_error("An error occurred in the HTTP request.")
|
||||||
|
|
||||||
|
|
||||||
|
var next_label: Label
|
||||||
func show_fetched(result, response_code, headers, body) -> void:
|
func show_fetched(result, response_code, headers, body) -> void:
|
||||||
var json = JSON.new()
|
var json = JSON.new()
|
||||||
var error = json.parse(body.get_string_from_utf8())
|
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)
|
print("data_received: ", data_received)
|
||||||
game_label.text = data_received.Game
|
game_label.text = data_received.Game
|
||||||
song_label.text = data_received.Song
|
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 = []
|
var song_list = []
|
||||||
func show_fetched_list(result, response_code, headers, body) -> void:
|
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))
|
label.gui_input.connect(song_clicked.bind(song.SongNo))
|
||||||
music_list.add_child(label)
|
music_list.add_child(label)
|
||||||
|
|
||||||
var label := Label.new()
|
next_label = Label.new()
|
||||||
label.text = "??? - ???"
|
next_label.text = "??? - ???"
|
||||||
label.mouse_filter = Control.MOUSE_FILTER_PASS
|
next_label.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||||
label.gui_input.connect(show_fetched)
|
next_label.gui_input.connect(show_fetched)
|
||||||
music_list.add_child(label)
|
music_list.add_child(next_label)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Unexpected data")
|
print("Unexpected data")
|
||||||
|
|
||||||
func song_clicked(event, song_no):
|
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))
|
print("Clicked: " + str(song_no))
|
||||||
|
|
||||||
# Called when the HTTP request is completed.
|
# Called when the HTTP request is completed.
|
||||||
@@ -167,8 +174,9 @@ func _http_request_completed(result, response_code, headers, body):
|
|||||||
for game in games:
|
for game in games:
|
||||||
var label := Label.new()
|
var label := Label.new()
|
||||||
label.text = game
|
label.text = game
|
||||||
list.add_child(label)
|
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||||
#print(data_received) # Prints array
|
insperation_list.add_child(label)
|
||||||
|
insperation_scroll.scroll_to_bottom()
|
||||||
else:
|
else:
|
||||||
print("Unexpected data")
|
print("Unexpected data")
|
||||||
|
|
||||||
@@ -185,7 +193,7 @@ func open():
|
|||||||
func _process(delta):
|
func _process(delta):
|
||||||
if audio.has_stream_playback() && !is_changing && !audio.stream_paused:
|
if audio.has_stream_playback() && !is_changing && !audio.stream_paused:
|
||||||
progress.value = audio.get_playback_position()
|
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):
|
func _on_file_dialog_dir_selected(path):
|
||||||
print(path)
|
print(path)
|
||||||
@@ -217,7 +225,7 @@ func dir_contents(path: String) -> void:
|
|||||||
for game in games:
|
for game in games:
|
||||||
var label := Label.new()
|
var label := Label.new()
|
||||||
label.text = game
|
label.text = game
|
||||||
list.add_child(label)
|
insperation_list.add_child(label)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,38 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://xwq863o6uvsu"]
|
[gd_scene load_steps=11 format=3 uid="uid://xwq863o6uvsu"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://MainWindow.gd" id="1_eu0t5"]
|
[ext_resource type="Script" path="res://MainWindow.gd" id="1_eu0t5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b16on0oscg1bv" path="res://CharacterSelect.tscn" id="2_76kf4"]
|
[ext_resource type="PackedScene" uid="uid://b16on0oscg1bv" path="res://CharacterSelect.tscn" id="2_76kf4"]
|
||||||
|
[ext_resource type="Script" path="res://InsperationScrollContainer.gd" id="2_gxtxm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://volume_slider.tscn" id="3_rxhba"]
|
[ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://volume_slider.tscn" id="3_rxhba"]
|
||||||
[ext_resource type="AudioStream" uid="uid://n2g8jddr85h2" path="res://01. Opening.mp3" id="4_5kvsq"]
|
[ext_resource type="AudioStream" uid="uid://n2g8jddr85h2" path="res://01. Opening.mp3" id="4_5kvsq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://o5go6smk7hm1" path="res://person_add_alt_1-black-36dp.svg" id="4_op458"]
|
[ext_resource type="Texture2D" uid="uid://o5go6smk7hm1" path="res://person_add_alt_1-black-36dp.svg" id="4_op458"]
|
||||||
[ext_resource type="Script" path="res://ScrollContainer.gd" id="6_7b4jh"]
|
[ext_resource type="Script" path="res://MusicListScrollContainer.gd" id="7_dj026"]
|
||||||
|
[ext_resource type="Theme" uid="uid://rxexo3ur85as" path="res://LightGrayTheme.tres" id="7_wxbv6"]
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_qspbu"]
|
[sub_resource type="LabelSettings" id="LabelSettings_qspbu"]
|
||||||
font_size = 70
|
font_size = 50
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_3m52w"]
|
[sub_resource type="LabelSettings" id="LabelSettings_3m52w"]
|
||||||
font_size = 50
|
font_size = 35
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
script = ExtResource("1_eu0t5")
|
script = ExtResource("1_eu0t5")
|
||||||
|
|
||||||
|
[node name="TopPanelContainer" type="PanelContainer" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 1920.0
|
||||||
|
offset_bottom = 52.0
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="TopPanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="TopPanelContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
text = "Music Player Randomizer"
|
||||||
|
|
||||||
[node name="Open" type="Button" parent="."]
|
[node name="Open" type="Button" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
offset_left = 65.0
|
offset_left = 65.0
|
||||||
@@ -38,12 +53,16 @@ show_hidden_files = true
|
|||||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 1204.0
|
offset_left = 1204.0
|
||||||
offset_top = 17.0
|
offset_top = 95.0
|
||||||
offset_right = 1771.0
|
offset_right = 1845.0
|
||||||
offset_bottom = 465.0
|
offset_bottom = 465.0
|
||||||
|
horizontal_scroll_mode = 0
|
||||||
|
script = ExtResource("2_gxtxm")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer"]
|
[node name="Label" type="Label" parent="ScrollContainer/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -57,7 +76,7 @@ text = "Test2"
|
|||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 52.0
|
offset_left = 52.0
|
||||||
offset_top = 64.0
|
offset_top = 81.0
|
||||||
offset_right = 977.0
|
offset_right = 977.0
|
||||||
offset_bottom = 368.0
|
offset_bottom = 368.0
|
||||||
|
|
||||||
@@ -82,7 +101,7 @@ visible = false
|
|||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 69.0
|
offset_left = 69.0
|
||||||
offset_top = 924.0
|
offset_top = 924.0
|
||||||
offset_right = 955.0
|
offset_right = 1057.0
|
||||||
offset_bottom = 964.0
|
offset_bottom = 964.0
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
|
||||||
@@ -111,12 +130,10 @@ scrollable = false
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "1:00 / 3:00"
|
text = "1:00 / 3:00"
|
||||||
|
|
||||||
[node name="VolumeSlider" parent="." instance=ExtResource("3_rxhba")]
|
[node name="VolumeSlider" parent="PanelContainer/HBoxContainer" instance=ExtResource("3_rxhba")]
|
||||||
layout_mode = 0
|
custom_minimum_size = Vector2(100, 0)
|
||||||
offset_left = 983.0
|
layout_mode = 2
|
||||||
offset_top = 916.0
|
size_flags_vertical = 4
|
||||||
offset_right = 1214.0
|
|
||||||
offset_bottom = 955.0
|
|
||||||
|
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("4_5kvsq")
|
stream = ExtResource("4_5kvsq")
|
||||||
@@ -200,11 +217,12 @@ offset_left = 136.0
|
|||||||
offset_top = 388.0
|
offset_top = 388.0
|
||||||
offset_right = 1009.0
|
offset_right = 1009.0
|
||||||
offset_bottom = 845.0
|
offset_bottom = 845.0
|
||||||
|
theme = ExtResource("7_wxbv6")
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="MusicListPanel"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="MusicListPanel"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
follow_focus = true
|
follow_focus = true
|
||||||
script = ExtResource("6_7b4jh")
|
script = ExtResource("7_dj026")
|
||||||
|
|
||||||
[node name="MusicList" type="VBoxContainer" parent="MusicListPanel/ScrollContainer"]
|
[node name="MusicList" type="VBoxContainer" parent="MusicListPanel/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ func _draw():
|
|||||||
if max != self.get_v_scroll_bar().max_value:
|
if max != self.get_v_scroll_bar().max_value:
|
||||||
max = self.get_v_scroll_bar().max_value
|
max = self.get_v_scroll_bar().max_value
|
||||||
self.scroll_vertical = max
|
self.scroll_vertical = max
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
4
neutral_gray.tres
Normal file
4
neutral_gray.tres
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="StyleBoxFlat" format=3 uid="uid://blf3g88mugovr"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bg_color = Color(0.257813, 0.257813, 0.257813, 1)
|
||||||
Reference in New Issue
Block a user