Compare commits

...

4 Commits

Author SHA1 Message Date
notdraimdev 4a83c33452 fixed hiding in failed screen 2024-11-02 20:33:49 +01:00
notdraimdev accd1fe26f Patchnotes inside simplaudio 2024-11-02 19:23:51 +01:00
notdraimdev 45b758627e Delete improvements 2024-11-02 19:13:52 +01:00
notdraimdev 833bfc3650 Loading failed screen, small fixes 2024-11-02 19:05:54 +01:00
10 changed files with 274 additions and 56 deletions
BIN
View File
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://n8g3v41u2u48"
path="res://.godot/imported/Error.wav-f6422fca2f257bd634183d1c1c7a43ba.sample"
[deps]
source_file="res://Error.wav"
dest_files=["res://.godot/imported/Error.wav-f6422fca2f257bd634183d1c1c7a43ba.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
+131 -21
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=69 format=3 uid="uid://b2sygl55s6fng"] [gd_scene load_steps=73 format=3 uid="uid://b2sygl55s6fng"]
[ext_resource type="Script" path="res://main.gd" id="1_ubs1p"] [ext_resource type="Script" path="res://main.gd" id="1_ubs1p"]
[ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"] [ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"]
@@ -34,8 +34,9 @@
[ext_resource type="PackedScene" uid="uid://bel6i6wdbexw4" path="res://search_results.tscn" id="27_g8wmp"] [ext_resource type="PackedScene" uid="uid://bel6i6wdbexw4" path="res://search_results.tscn" id="27_g8wmp"]
[ext_resource type="Texture2D" uid="uid://bmbxyma4ra46p" path="res://Download.png" id="29_v44vi"] [ext_resource type="Texture2D" uid="uid://bmbxyma4ra46p" path="res://Download.png" id="29_v44vi"]
[ext_resource type="Script" path="res://update_checker.gd" id="30_byc5i"] [ext_resource type="Script" path="res://update_checker.gd" id="30_byc5i"]
[ext_resource type="Script" path="res://patch_notes_button.gd" id="31_hjsj1"]
[ext_resource type="Script" path="res://CustomButtonColor.gd" id="32_pwgec"] [ext_resource type="Script" path="res://CustomButtonColor.gd" id="32_pwgec"]
[ext_resource type="Script" path="res://loading_failed_screen.gd" id="37_mkkhu"]
[ext_resource type="AudioStream" uid="uid://n8g3v41u2u48" path="res://Error.wav" id="38_nkjlp"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kvkfy"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_kvkfy"]
shader = ExtResource("8_xtnau") shader = ExtResource("8_xtnau")
@@ -161,6 +162,31 @@ font_size = 31
[sub_resource type="LabelSettings" id="LabelSettings_ivhc6"] [sub_resource type="LabelSettings" id="LabelSettings_ivhc6"]
font_size = 20 font_size = 20
[sub_resource type="LabelSettings" id="LabelSettings_spe36"]
font_size = 46
outline_size = 5
outline_color = Color(0.675524, 0.62112, 0, 1)
shadow_size = 2
shadow_color = Color(0.282353, 0.282353, 0.282353, 0.384314)
shadow_offset = Vector2(3, 5)
[sub_resource type="LabelSettings" id="LabelSettings_amome"]
font_size = 18
font_color = Color(0.894922, 0.894922, 0.894922, 1)
outline_size = 2
outline_color = Color(0.519817, 0.439396, 0, 1)
shadow_size = 4
shadow_color = Color(0.290196, 0.290196, 0.290196, 0.270588)
shadow_offset = Vector2(2, 3)
[sub_resource type="LabelSettings" id="LabelSettings_drf2g"]
font_size = 20
outline_size = 2
outline_color = Color(0.519817, 0.439396, 0, 1)
shadow_size = 4
shadow_color = Color(0.290196, 0.290196, 0.290196, 0.270588)
shadow_offset = Vector2(2, 3)
[node name="Node2D" type="Control"] [node name="Node2D" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@@ -300,6 +326,7 @@ grow_vertical = 2
metadata/_edit_use_anchors_ = true metadata/_edit_use_anchors_ = true
[node name="PlaylistsPanel" type="Control" parent="PlaylistPanelHolder"] [node name="PlaylistsPanel" type="Control" parent="PlaylistPanelHolder"]
visible = false
layout_mode = 2 layout_mode = 2
anchors_preset = 0 anchors_preset = 0
anchor_bottom = 1.0 anchor_bottom = 1.0
@@ -493,10 +520,13 @@ color = Color(0.14902, 0.14902, 0.14902, 1)
[node name="FileDialog" type="FileDialog" parent="CreatePlaylistsMenu"] [node name="FileDialog" type="FileDialog" parent="CreatePlaylistsMenu"]
title = "Open a Directory" title = "Open a Directory"
initial_position = 2
size = Vector2i(352, 180) size = Vector2i(352, 180)
ok_button_text = "Select Current Folder" ok_button_text = "Select Current Folder"
file_mode = 2 file_mode = 2
access = 2 access = 2
filters = PackedStringArray("*")
show_hidden_files = true
use_native_dialog = true use_native_dialog = true
[node name="ScrollContainer" type="ScrollContainer" parent="CreatePlaylistsMenu"] [node name="ScrollContainer" type="ScrollContainer" parent="CreatePlaylistsMenu"]
@@ -826,6 +856,7 @@ grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 8 size_flags_vertical = 8
tooltip_text = "use Up/Down arrow keys to adjust"
focus_mode = 0 focus_mode = 0
value = 100.0 value = 100.0
@@ -851,7 +882,7 @@ offset_left = -64.0
offset_top = -23.0 offset_top = -23.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
text = "v1.5.1" text = "v1.5.2"
horizontal_alignment = 2 horizontal_alignment = 2
[node name="SettingsButton" type="Button" parent="."] [node name="SettingsButton" type="Button" parent="."]
@@ -950,9 +981,9 @@ timeout = 5.0
[node name="ColorRect" type="ColorRect" parent="UpdateChecker"] [node name="ColorRect" type="ColorRect" parent="UpdateChecker"]
layout_mode = 0 layout_mode = 0
offset_left = -214.0 offset_left = -292.0
offset_top = -144.0 offset_top = -256.0
offset_right = -24.0 offset_right = -10.0
offset_bottom = -44.0 offset_bottom = -44.0
color = Color(0.14902, 0.14902, 0.14902, 1) color = Color(0.14902, 0.14902, 0.14902, 1)
@@ -969,22 +1000,20 @@ text = "Update Available!"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="PatchNotesButton" type="Button" parent="UpdateChecker/ColorRect"] [node name="Patchnotes" type="RichTextLabel" parent="UpdateChecker/ColorRect"]
z_index = 4 z_index = 2
layout_mode = 1 layout_mode = 1
anchors_preset = 14 anchors_preset = -1
anchor_top = 0.5 anchor_top = 0.150943
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 0.5 anchor_bottom = 0.820755
offset_top = -24.0
offset_bottom = 12.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
text = "View patch notes" text = "PatchNotes"
flat = true context_menu_enabled = true
script = ExtResource("31_hjsj1") metadata/_edit_use_anchors_ = true
[node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/PatchNotesButton"] [node name="ColorRect" type="ColorRect" parent="UpdateChecker/ColorRect/Patchnotes"]
z_index = -1 z_index = -1
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
@@ -992,9 +1021,7 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2 color = Color(0.257219, 0.338913, 0.352311, 1)
color = Color(0.19706, 0.279877, 0.326012, 1)
script = ExtResource("32_pwgec")
[node name="LinkButton" type="Button" parent="UpdateChecker/ColorRect"] [node name="LinkButton" type="Button" parent="UpdateChecker/ColorRect"]
z_index = 1 z_index = 1
@@ -1029,7 +1056,7 @@ anchor_right = 1.0
offset_left = -72.0 offset_left = -72.0
offset_bottom = 72.0 offset_bottom = 72.0
grow_horizontal = 0 grow_horizontal = 0
scale = Vector2(0.25, 0.25) scale = Vector2(0.4, 0.4)
pivot_offset = Vector2(72, 0) pivot_offset = Vector2(72, 0)
icon = ExtResource("14_mioc4") icon = ExtResource("14_mioc4")
flat = true flat = true
@@ -1124,6 +1151,89 @@ horizontal_alignment = 1
initial_position = 2 initial_position = 2
dialog_text = "Are you sure you want to delete" dialog_text = "Are you sure you want to delete"
[node name="LoadingFailedScreen" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -235.0
offset_top = -159.0
offset_right = 235.0
offset_bottom = 159.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("37_mkkhu")
[node name="ColorRect" type="ColorRect" parent="LoadingFailedScreen"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.681657, 0.492205, 3.85046e-07, 1)
[node name="VBoxContainer" type="VBoxContainer" parent="LoadingFailedScreen"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -187.0
offset_right = 187.0
offset_bottom = 91.0
grow_horizontal = 2
alignment = 1
[node name="LoadingFailedLabel" type="Label" parent="LoadingFailedScreen/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "LOADING FAILED"
label_settings = SubResource("LabelSettings_spe36")
[node name="Label2" type="Label" parent="LoadingFailedScreen/VBoxContainer"]
layout_mode = 2
text = "Saving is currently disabled
Simplaudio failed to load your save,
Simplaudio may also have failed to save,
if you suspect this, please contact me."
label_settings = SubResource("LabelSettings_amome")
horizontal_alignment = 1
[node name="Label3" type="Label" parent="LoadingFailedScreen/VBoxContainer"]
layout_mode = 2
text = "Please restart Simplaudio,
if the issue presists you can:"
label_settings = SubResource("LabelSettings_drf2g")
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="LoadingFailedScreen/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="ContinueAnyways" type="Button" parent="LoadingFailedScreen/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Continue anyways"
[node name="Contact" type="Button" parent="LoadingFailedScreen/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Contact me"
[node name="ConfirmationDialog" type="ConfirmationDialog" parent="LoadingFailedScreen"]
title = "Are you sure?"
initial_position = 2
size = Vector2i(242, 106)
force_native = true
ok_button_text = "Yes, i will take the risk"
dialog_text = "This is *irreversable*"
cancel_button_text = "No"
[node name="FailedAudioCue" type="AudioStreamPlayer" parent="LoadingFailedScreen"]
stream = ExtResource("38_nkjlp")
[connection signal="toggled" from="SelectPlaylist" to="SelectPlaylist" method="_on_toggled"] [connection signal="toggled" from="SelectPlaylist" to="SelectPlaylist" method="_on_toggled"]
[connection signal="pressed" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/CreatePlaylist" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_create_playlist_pressed"] [connection signal="pressed" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/CreatePlaylist" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_create_playlist_pressed"]
[connection signal="toggled" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/PlayAll" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_play_all_toggled"] [connection signal="toggled" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/PlayAll" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_play_all_toggled"]
+1 -1
View File
@@ -41,7 +41,7 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
scroll_vertical = 250 scroll_vertical = 100
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
custom_minimum_size = Vector2(576, 493) custom_minimum_size = Vector2(576, 493)
+29
View File
@@ -0,0 +1,29 @@
extends Control
@onready var continue_anyways: Button = $VBoxContainer/HBoxContainer/ContinueAnyways
@onready var contact: Button = $VBoxContainer/HBoxContainer/Contact
@onready var failed_audio_cue: AudioStreamPlayer = $FailedAudioCue
@onready var confirmation_dialog: ConfirmationDialog = $ConfirmationDialog
func Show():
failed_audio_cue.play()
show()
continue_anyways.pressed.connect(confirmation_dialog.show)
confirmation_dialog.confirmed.connect(Confiremed)
contact.pressed.connect(Contact)
func Confiremed():
owner.LoadingSaveFailed = false
hide()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
hide()
func Contact():
print("Contact pressed")
OS.shell_open("https://notdraimdev.github.io/SimplSite/Contact.html")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
+56 -19
View File
@@ -69,6 +69,9 @@ var PlayAllLists:bool
signal ContinueDelete signal ContinueDelete
var deleteSong:bool var deleteSong:bool
var LoadingSaveFailed:bool
@onready var loading_failed_screen: Control = $LoadingFailedScreen
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
get_tree().root.min_size = Vector2(850,492) get_tree().root.min_size = Vector2(850,492)
@@ -88,9 +91,10 @@ func _ready() -> void:
if Arg.to_lower().ends_with(".mp3") or Arg.to_lower().ends_with(".wav"): if Arg.to_lower().ends_with(".mp3") or Arg.to_lower().ends_with(".wav"):
OS.alert("opening files like this\nis no longer supported") OS.alert("opening files like this\nis no longer supported")
var data:Dictionary var data:Dictionary
var save = loadUserdata()
if save != {}:
data = save
loadPlaylists() loadPlaylists()
if loadUserdata() != null:
data = loadUserdata()
if Strin.is_empty(): if Strin.is_empty():
if !Playlists.is_empty(): if !Playlists.is_empty():
PlaylistSelected(Playlists.keys()[0],PlaylistsLocation[Playlists.keys()[0]]) PlaylistSelected(Playlists.keys()[0],PlaylistsLocation[Playlists.keys()[0]])
@@ -179,6 +183,8 @@ func _ready() -> void:
for child in get_children(true): for child in get_children(true):
if child is Control: if child is Control:
child.focus_mode = child is LineEdit child.focus_mode = child is LineEdit
if LoadingSaveFailed:
loading_failed_screen.Show()
func setUpDiscord(): func setUpDiscord():
DiscordRPC.app_id = 1276916292170809426 DiscordRPC.app_id = 1276916292170809426
@@ -277,7 +283,8 @@ func SetSong(IDX:int):
CurrentIDX = IDX -1 CurrentIDX = IDX -1
PlaySongs() PlaySongs()
music_player.stop() music_player.stop()
SaveEverything() if !LoadingSaveFailed:
SaveEverything()
print("SetSong") print("SetSong")
func pausePlay(): func pausePlay():
@@ -308,13 +315,12 @@ func SetVolume(Volume:float):
AudioServer.set_bus_volume_db(0,volume) AudioServer.set_bus_volume_db(0,volume)
else: else:
AudioServer.set_bus_volume_db(0,-1000) AudioServer.set_bus_volume_db(0,-1000)
print("Chnaged Volume")
SaveEverything()
volume_slider.value = Volume volume_slider.value = Volume
func SelectPlaylistDir(): func SelectPlaylistDir():
file_dialog.show() file_dialog.show()
SaveEverything() if !LoadingSaveFailed:
SaveEverything()
print("Select Playtlist dir") print("Select Playtlist dir")
func DirectorySelected(dir:String): func DirectorySelected(dir:String):
@@ -388,7 +394,8 @@ func PlaySongs():
CurrentSongLenth = song.get_length() CurrentSongLenth = song.get_length()
music_player.stream = song music_player.stream = song
music_player.play() music_player.play()
SaveEverything() if !LoadingSaveFailed:
SaveEverything()
print("set stream") print("set stream")
@@ -467,9 +474,8 @@ func _process(_delta: float) -> void:
currentSaveTime = SaveInterval currentSaveTime = SaveInterval
DiscordUsername = DiscordRPC.get_current_user().get("username") DiscordUsername = DiscordRPC.get_current_user().get("username")
print(DiscordRPC.get_current_user()) if !LoadingSaveFailed:
SaveEverything() SaveEverything()
print("yoo")
@warning_ignore("integer_division") @warning_ignore("integer_division")
if DiscordRPC.large_image != "nullbody": if DiscordRPC.large_image != "nullbody":
UpdateSplashes() UpdateSplashes()
@@ -579,44 +585,66 @@ func SaveEverything():
"PlayAllLists" : PlayAllLists, "PlayAllLists" : PlayAllLists,
"DiscordUsername" : DiscordRPC.get_current_user().get("username") "DiscordUsername" : DiscordRPC.get_current_user().get("username")
} }
print("saving")
saveUserdata(Data) saveUserdata(Data)
savePlaylists() savePlaylists()
var saveRetrys:int =0
func savePlaylists(): func savePlaylists():
var json = JSON.new() var json = JSON.new()
var file = FileAccess.open("user://playlists.dat", FileAccess.WRITE) var file = FileAccess.open("user://playlists.dat", FileAccess.WRITE)
var file2 = FileAccess.open("user://playlistsLocation.dat", FileAccess.WRITE) var file2 = FileAccess.open("user://playlistsLocation.dat", FileAccess.WRITE)
@warning_ignore("static_called_on_instance") @warning_ignore("static_called_on_instance")
if !Playlists == null or !Playlists == {}: if !(Playlists == null) or !(Playlists == {}):
file.store_string(str(json.stringify(Playlists))) file.store_string(str(json.stringify(Playlists)))
if !PlaylistsLocation == null or !PlaylistsLocation == {}: if !(PlaylistsLocation == null) or !(PlaylistsLocation == {}):
file2.store_string(str(json.stringify(PlaylistsLocation))) file2.store_string(str(json.stringify(PlaylistsLocation)))
if loadUserdata() == {}:
if saveRetrys < 3:
savePlaylists()
else:
printerr("saving failed")
func saveUserdata(content): func saveUserdata(content):
var json = JSON.new() var json = JSON.new()
var file = FileAccess.open("user://data.dat", FileAccess.WRITE) var file = FileAccess.open("user://data.dat", FileAccess.WRITE)
@warning_ignore("static_called_on_instance") @warning_ignore("static_called_on_instance")
file.store_string(Marshalls.utf8_to_base64(json.stringify(content))) file.store_string(json.stringify(content))
file.close() file.close()
func loadUserdata(): var saveLoadTries:int
func loadUserdata() -> Dictionary:
var json = JSON.new() var json = JSON.new()
var file = FileAccess.open("user://data.dat", FileAccess.READ) var file = FileAccess.open("user://data.dat", FileAccess.READ)
var filetext = file.get_as_text() if file != null else null var filetext = file.get_as_text() if file != null else null
if file != null: if file != null:
var content var content:Dictionary = {}
if json.parse_string(file.get_as_text()) != null: if json.parse_string(file.get_as_text()) != null:
content = json.parse_string(filetext) content = json.parse_string(filetext)
else: else:
@warning_ignore("static_called_on_instance") @warning_ignore("static_called_on_instance")
content = json.parse_string(Marshalls.base64_to_utf8(file.get_as_text())) content = json.parse_string(Marshalls.base64_to_utf8(file.get_as_text()))
file.close() file.close()
return content if content != null:
return content
else:
LoadingSaveFailed = true
return {}
else: else:
file.close() file.close()
return null printerr("loading save failed")
if saveLoadTries < 3:
print("retrying")
saveLoadTries +=1
return loadUserdata()
LoadingSaveFailed = true
return {}
var playlistLoadTries:int
func loadPlaylists(): func loadPlaylists():
var json = JSON.new() var json = JSON.new()
var file = FileAccess.open("user://playlistsLocation.dat", FileAccess.READ) var file = FileAccess.open("user://playlistsLocation.dat", FileAccess.READ)
@@ -626,8 +654,17 @@ func loadPlaylists():
print(filetext) print(filetext)
#print("shit " + json.parse_string(filetext)) #print("shit " + json.parse_string(filetext))
if file.get_as_text() != "" and file2.get_as_text() != "": if file.get_as_text() != "" and file2.get_as_text() != "":
PlaylistsLocation = json.parse_string(file.get_as_text()) var PlaylistsLocationTemp
Playlists = {} if json.parse_string(file2.get_as_text()) == null else json.parse_string(file2.get_as_text()) var PlaylistsTemp
LoadingSaveFailed
PlaylistsLocationTemp = json.parse_string(file.get_as_text())
PlaylistsTemp = json.parse_string(file2.get_as_text())
if (PlaylistsTemp == null) or (PlaylistsLocationTemp == null):
printerr("Loading playlists failed")
LoadingSaveFailed = true
else:
Playlists = PlaylistsTemp
PlaylistsLocation = PlaylistsLocationTemp
print(PlaylistsLocation) print(PlaylistsLocation)
print(Playlists.keys()) print(Playlists.keys())
print("Playlists") print("Playlists")
+13 -5
View File
@@ -2,24 +2,32 @@ extends Control
var SongName:String var SongName:String
var CurrentlyPlaying:bool var CurrentlyPlaying:bool
var idx:int var songidx:int
@onready var songname: Button = $HBoxContainer/Songname @onready var songname: Button = $HBoxContainer/Songname
@onready var dropdown: Button = $HBoxContainer/Dropdown
@onready var popup_menu: PopupMenu = $PopupMenu
signal PlayPressed signal PlayPressed
signal DeletePressed signal DeletePressed
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
songname.text = SongName songname.text = SongName
popup_menu.index_pressed.connect(popupPressed)
func popupPressed(idx:int):
if idx == 0:
DeletePressed.emit(songidx)
# 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: float) -> void: func _process(delta: float) -> void:
pass dropdown.visible = songname.is_hovered() or dropdown.is_hovered()
func _on_songname_pressed() -> void: func _on_songname_pressed() -> void:
PlayPressed.emit(idx) PlayPressed.emit(songidx)
func _on_delete_pressed() -> void: func _on_dropdown_pressed() -> void:
DeletePressed.emit(idx) popup_menu.show()
popup_menu.position = get_global_mouse_position()
+16 -9
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://ctqcbjrmxaqsk"] [gd_scene load_steps=3 format=3 uid="uid://ctqcbjrmxaqsk"]
[ext_resource type="Texture2D" uid="uid://cm5ps3a716wr0" path="res://XSmall.png" id="1_6wgd5"]
[ext_resource type="Script" path="res://search_item.gd" id="1_j4126"] [ext_resource type="Script" path="res://search_item.gd" id="1_j4126"]
[ext_resource type="Texture2D" uid="uid://dwvy6crqhardn" path="res://Dropdown.png" id="2_hicj1"]
[node name="SearchItem" type="Control"] [node name="SearchItem" type="Control"]
custom_minimum_size = Vector2(0, 30) custom_minimum_size = Vector2(0, 30)
@@ -17,23 +17,26 @@ size_flags_vertical = 4
script = ExtResource("1_j4126") script = ExtResource("1_j4126")
[node name="HBoxContainer" type="HBoxContainer" parent="."] [node name="HBoxContainer" type="HBoxContainer" parent="."]
custom_minimum_size = Vector2(700, 0) custom_minimum_size = Vector2(700, 32)
layout_mode = 1 layout_mode = 1
anchors_preset = 4 anchors_preset = 4
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_top = -19.0 offset_top = -16.0
offset_right = 50.0 offset_right = 700.0
offset_bottom = 19.0 offset_bottom = 16.0
grow_vertical = 2 grow_vertical = 2
alignment = 1
[node name="delete" type="Button" parent="HBoxContainer"] [node name="Dropdown" type="Button" parent="HBoxContainer"]
modulate = Color(0.553478, 0.101429, 4.81308e-08, 1) custom_minimum_size = Vector2(20, 0)
layout_mode = 2 layout_mode = 2
tooltip_text = "delete song from hard-drive" tooltip_text = "delete song from hard-drive"
focus_mode = 0 focus_mode = 0
icon = ExtResource("1_6wgd5") icon = ExtResource("2_hicj1")
flat = true flat = true
icon_alignment = 1
expand_icon = true
[node name="Songname" type="Button" parent="HBoxContainer"] [node name="Songname" type="Button" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
@@ -42,5 +45,9 @@ focus_mode = 0
flat = true flat = true
alignment = 0 alignment = 0
[connection signal="pressed" from="HBoxContainer/delete" to="." method="_on_delete_pressed"] [node name="PopupMenu" type="PopupMenu" parent="."]
item_count = 1
item_0/text = "delete"
[connection signal="pressed" from="HBoxContainer/Dropdown" to="." method="_on_dropdown_pressed"]
[connection signal="pressed" from="HBoxContainer/Songname" to="." method="_on_songname_pressed"] [connection signal="pressed" from="HBoxContainer/Songname" to="." method="_on_songname_pressed"]
+1 -1
View File
@@ -24,7 +24,7 @@ func _process(delta: float) -> void:
func add_item(text:String): func add_item(text:String):
var child = SEARCH_ITEM.instantiate() var child = SEARCH_ITEM.instantiate()
child.SongName = text.replace(".mp3", "") child.SongName = text.replace(".mp3", "")
child.idx = parent.textSongs.find(text) child.songidx = parent.textSongs.find(text)
SongsAmount+=1 SongsAmount+=1
child.PlayPressed.connect(songSelected) child.PlayPressed.connect(songSelected)
child.DeletePressed.connect(deletePressed) child.DeletePressed.connect(deletePressed)
+3
View File
@@ -10,6 +10,7 @@ extends Control
@onready var errorLabel: Label = $"../UpdatingNotification/Error" @onready var errorLabel: Label = $"../UpdatingNotification/Error"
@onready var updating_bg: ColorRect = $"../UpdatingBG" @onready var updating_bg: ColorRect = $"../UpdatingBG"
@onready var paused_indicator: TextureRect = $"../PausedIndicator" @onready var paused_indicator: TextureRect = $"../PausedIndicator"
@onready var patchnotes: RichTextLabel = $ColorRect/Patchnotes
@export var errorColor:Color @export var errorColor:Color
@@ -51,6 +52,8 @@ func _on_http_request_completed(result: int, _response_code: int, _headers: Pack
update_available_text.text = result2["tag_name"] + " Is Out!" update_available_text.text = result2["tag_name"] + " Is Out!"
show() show()
updateLink = result2["html_url"] updateLink = result2["html_url"]
if result2.has("body"):
patchnotes.text = str(result2["body"])
func _on_close_buen_pressed() -> void: func _on_close_buen_pressed() -> void:
hide() hide()