3 Commits
1.6.1 ... main

Author SHA1 Message Date
b4ba96cf63 #20 #24 Winnersong can be stopped. Inspirationlist speed can be changed. Some other small fixes
All checks were successful
Build / build (push) Successful in 1m36s
2025-12-27 14:05:56 +01:00
2a32cc34ef Sync result can be seen multiple times
All checks were successful
Build / build (push) Successful in 1m19s
Publish / build (push) Successful in 1m33s
2025-11-15 15:02:21 +01:00
bae5831a3e #22: Now block add player if player name is empty
All checks were successful
Build / build (push) Successful in 1m21s
#23: Add a log for when points are given to players
#25: Fixed some graphical stuff
#26: Changed so the same character can be on a song multiple times
#27: Turning off statistics after win
2025-11-15 14:53:51 +01:00
15 changed files with 267 additions and 62 deletions

View File

@@ -1,36 +1,34 @@
extends ScrollContainer
var SCROLL = 0
var delay = 0.02 #seconds
var wait = 0
var SPEED: int = 1
var SCROLL: float = 0
var delay: float = 0.02 #seconds
var wait: float = 0
# Called when the node enters the scene tree for the first time.
func _ready():
func _ready() -> void:
wait = delay
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
func _process(delta: float) -> void:
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
scroll_vertical += Settings.inspiration_list_speed
else:
scroll_back_up()
#SCROLL UP
elif SCROLL == -1:
if scroll_vertical != 0:
scroll_vertical -= SPEED
scroll_vertical -= Settings.inspiration_list_speed
else:
scroll_to_bottom()
func scroll_back_up():
func scroll_back_up() -> void:
SCROLL = -1
func scroll_to_bottom():
func scroll_to_bottom() -> void:
scroll_vertical = 0 #Reset to top first.
SCROLL = 1

33
Log.tscn Normal file
View File

@@ -0,0 +1,33 @@
[gd_scene load_steps=2 format=3 uid="uid://bijh5h5yrivm3"]
[ext_resource type="Script" uid="uid://cw41y87l64qo7" path="res://log.gd" id="1_q72ua"]
[node name="Control" type="Control"]
custom_minimum_size = Vector2(700, 700)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_q72ua")
[node name="LogPanel" type="Panel" parent="."]
unique_name_in_owner = true
visibility_layer = 513
custom_minimum_size = Vector2(700, 700)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="LogScrollContainer" type="ScrollContainer" parent="LogPanel"]
custom_minimum_size = Vector2(700, 700)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="LogVBoxContainer" type="VBoxContainer" parent="LogPanel/LogScrollContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(700, 700)
layout_mode = 2
theme_override_constants/separation = 1

View File

@@ -130,6 +130,9 @@ var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton
@onready
var music_player_container: PanelContainer = $MusicPlayer
@onready
var log: Control = %Log
@onready
var debug_label: Label = $DebugLabel
@@ -148,9 +151,8 @@ func _ready() -> void:
print("is_debug")
debug_label.visible = true
Settings.is_debug = true
Settings.default_path = "http://localhost:8080"
Settings.selected_server = 3
Settings.winning_score = 5
settings_window.set_winning_score(5)
settings_window.set_selected_server(4)
if is_mac:
print("is_mac")
next_button.pressed.connect(play_next_song)
@@ -205,10 +207,13 @@ func _input(event: InputEvent) -> void:
if event.alt_pressed && event.keycode == KEY_ENTER:
print("Alt + Enter pressed")
Settings.fullscreen = !Settings.fullscreen
settings_window.fullscreen_button.button_pressed = 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)
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
if event.alt_pressed && event.keycode == KEY_L:
log.visible = !log.visible
func server_updated() -> void:
print("server_updated")
@@ -384,6 +389,7 @@ func _on_sync_finished() -> void:
sound_test_button.disabled = false
reset_playlist_button.disabled = false
show_answer_button.disabled = false
reset_points()
func get_suggestion_list() -> void:
print("get_suggestion_list")
@@ -412,16 +418,17 @@ func add_players() -> void:
func add_player() -> void:
print("add_player")
var new_player_object: PlayerObject = PlayerObject.new(new_player_name_field.text, Settings.player_array.size())
new_player_name_field.text = ""
Settings.player_array.append(new_player_object)
new_player_object.connect("first_point_triggerd", music_player_container._on_point_triggered.bind("first"))
new_player_object.connect("match_point_triggerd", music_player_container._on_point_triggered.bind("match"))
new_player_object.connect("winner_triggerd", _on_player_won.bind(new_player_object.id))
new_player_object.connect("point_given_sound", _on_make_point_given_sound)
new_player_object.connect("player_point_given", _on_point_given.bind(new_player_object.id))
new_player_object.connect("player_point_taken", _on_point_taken.bind(new_player_object.id))
load_players()
if new_player_name_field.text != "":
var new_player_object: PlayerObject = PlayerObject.new(new_player_name_field.text, Settings.player_array.size())
new_player_name_field.text = ""
Settings.player_array.append(new_player_object)
new_player_object.connect("first_point_triggerd", music_player_container._on_point_triggered.bind("first"))
new_player_object.connect("match_point_triggerd", music_player_container._on_point_triggered.bind("match"))
new_player_object.connect("winner_triggerd", _on_player_won.bind(new_player_object.id))
new_player_object.connect("point_given_sound", _on_make_point_given_sound)
new_player_object.connect("player_point_given", _on_point_given.bind(new_player_object.id))
new_player_object.connect("player_point_taken", _on_point_taken.bind(new_player_object.id))
load_players()
func load_players() -> void:
print("load_players")
@@ -441,6 +448,7 @@ func load_players() -> void:
func _on_point_given(player_given_point: int) -> void:
print("_on_point_given")
log.add_log_row(Settings.player_array[player_given_point].player_name + " got a point")
if Playlist.currently_playing_song >= 0:
Playlist.add_point(player_given_point)
update_song_list()
@@ -450,6 +458,7 @@ func _on_make_point_given_sound() -> void:
func _on_point_taken(player_taken_point: int) -> void:
print("_on_point_taken")
log.add_log_row(Settings.player_array[player_taken_point].player_name + " lost a point")
music_player_container.play_sound_effect(preload("res://sounds/itemequip.wav"))
if Playlist.currently_playing_song >= 0:
Playlist.remove_point(player_taken_point)
@@ -463,7 +472,8 @@ func _on_player_won(winning_player_id: int) -> void:
winner_picture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
winner_picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
winner_picture.texture = Settings.player_array[winning_player_id].character
music_player_container.play_sound(preload("res://sounds/winning.mp3"))
music_player_container.play_song(preload("res://sounds/winning.mp3"))
Settings.add_to_stats = false
func _on_player_removed(player_to_remove: int) -> void:
print("_on_player_removed ", player_to_remove)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://xwq863o6uvsu"]
[gd_scene load_steps=29 format=3 uid="uid://xwq863o6uvsu"]
[ext_resource type="Script" uid="uid://b8f4g15cas2j2" path="res://MainWindow.gd" id="1_eu0t5"]
[ext_resource type="PackedScene" uid="uid://b16on0oscg1bv" path="res://CharacterSelect.tscn" id="2_76kf4"]
@@ -13,6 +13,7 @@
[ext_resource type="PackedScene" uid="uid://dpdem7pdxweb5" path="res://SyncWindow.tscn" id="10_yxw0b"]
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="11_1qef0"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsWindow.tscn" id="11_k62u5"]
[ext_resource type="PackedScene" uid="uid://bijh5h5yrivm3" path="res://Log.tscn" id="14_26rwn"]
[sub_resource type="LabelSettings" id="LabelSettings_ychxr"]
font_size = 25
@@ -548,4 +549,13 @@ horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="Log" parent="." instance=ExtResource("14_26rwn")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 562.0
offset_top = 132.0
offset_right = 1262.0
offset_bottom = 832.0
[connection signal="dir_selected" from="FileDialog" to="." method="_on_file_dialog_dir_selected"]

View File

@@ -151,10 +151,8 @@ func play_sound(sound_name: AudioStream) -> void:
if stream != null:
music_time_label.text = format_text(progress_slider.value, stream.get_length())
func play_song(body: PackedByteArray) -> void:
var sound: AudioStream = AudioStreamMP3.new()
sound.data = body
audio_player.stream = sound
func play_song(song: AudioStream) -> void:
audio_player.stream = song
audio_player.play()
sound_player.stop()
song_finished = false
@@ -186,7 +184,11 @@ func play_song_object(song_object_no: int) -> void:
update_song_list.emit()
func get_sound_test_song() -> void:
Settings.make_request2("/music/soundTest", play_song, true)
var test_sound: Callable = func test_sound(body: PackedByteArray) -> void:
var sound: AudioStream = AudioStreamMP3.new()
sound.data = body
play_song(sound)
Settings.make_request2("/music/soundTest", test_sound, true)
##### LOCAL
var local_path: String = '/Users/sebastian/ResilioSync/Sorterat_test/Metal Gear Solid 4 - Guns of the Patriots/2-16 Metal Gear Saga.mp3'

View File

@@ -86,7 +86,7 @@ scrollable = false
[node name="MusicTimeLabel" type="Label" parent="MusicPlayerContainer"]
layout_mode = 2
text = "1:00 / 3:00"
text = "0:00 / 0:00"
[node name="VolumeSlider" parent="MusicPlayerContainer" instance=ExtResource("5_iifuj")]
custom_minimum_size = Vector2(100, 0)

View File

@@ -42,7 +42,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_821k2")
custom_minimum_size = Vector2(130, 40)
layout_mode = 2
size_flags_vertical = 1
text = "Sansansans: 100"
text = ": 0"
vertical_alignment = 1
[node name="Panel3" type="Panel" parent="HBoxContainer"]

View File

@@ -16,6 +16,7 @@ var close_button: Button = $CloseButton
var search_bar: TextEdit = $Searchbar
var games: Array = []
var regex: RegEx
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@@ -24,6 +25,7 @@ func _ready() -> void:
search_bar.grab_focus()
search_bar.text_changed.connect(search)
visibility_changed.connect(focus)
regex = RegEx.new()
func focus() -> void:
if self.visible == true:
@@ -37,21 +39,25 @@ func close() -> void:
func search() -> void:
print(search_bar.text)
Settings.delete_children(search_list)
var search_text: String = search_bar.text.to_lower()
for game: String in games:
if is_match_exact(search_bar.text, game):
if is_match_exact(search_text, game):
add_game(game)
var clean_search_text: String = clean_search_term(search_text)
for game: String in games:
if is_match_contains(clean_search_text, clean_game(game)):
add_game(game)
for game: String in games:
if is_match_contains(clean_term(search_bar.text), clean_term(game)):
add_game(game)
for game: String in games:
if is_match_regex(clean_term(search_bar.text), clean_term(game)):
if is_match_regex(clean_search_text, clean_game(game)):
add_game(game)
func clean_term(term: String) -> String:
func clean_search_term(term: String) -> String:
return term.replace(" ", "").replace("é", "e").replace("+", "plus").replace("&", "and").replace("'n", "and")
func clean_game(term: String) -> String:
return term.replace(" ", "").replace("é", "e").replace("+", "plus").replace("&", "and").replace("'n", "and").to_lower()
func is_match_exact(search_term: String, game_name: String) -> bool:
search_term = search_term.to_lower()
game_name = game_name.to_lower()
if search_term == "":
@@ -78,7 +84,7 @@ func is_match_regex(search_term: String, game_name: String) -> bool:
return false
func add_game(game: String) -> void:
var label := Label.new()
var label: Label = Label.new()
label.text = game
print("game: " + game)
label.autowrap_mode = TextServer.AUTOWRAP_WORD
@@ -93,22 +99,21 @@ func check_if_game_exists(game: String) -> bool:
return game_exists
func compile_regex(search_term: String) -> RegEx:
var regex = RegEx.new()
var regText: String = ".*"
for letter in search_term:
for letter: String in search_term:
regText += letter + ".*"
regex.compile(regText)
return regex
func get_list_of_games() -> void:
print("get_list_of_games")
var handle_games: Callable = func handle_games(array) -> void:
var handle_games: Callable = func handle_games(array: Array) -> void:
if typeof(array) == TYPE_ARRAY:
games = []
Settings.delete_children(search_list)
games.append_array(array)
for game in games:
var label := Label.new()
for game: String in games:
var label: Label = Label.new()
label.text = game
label.autowrap_mode = TextServer.AUTOWRAP_WORD
search_list.add_child(label)
@@ -128,3 +133,46 @@ func clear() -> void:
search()
search_bar.grab_focus()
func old_search() -> void:
print(search_bar.text)
Settings.delete_children(search_list)
for game: String in games:
if old_is_match_exact(search_bar.text, game):
add_game(game)
for game: String in games:
if is_match_contains(clean_term(search_bar.text), clean_term(game)):
add_game(game)
for game: String in games:
if old_is_match_regex(clean_term(search_bar.text), clean_term(game)):
add_game(game)
func clean_term(term: String) -> String:
return term.replace(" ", "").replace("é", "e").replace("+", "plus").replace("&", "and").replace("'n", "and").to_lower()
func old_is_match_exact(search_term: String, game_name: String) -> bool:
search_term = search_term.to_lower()
game_name = game_name.to_lower()
if search_term == "":
return true
elif game_name.contains(search_term):
return true
else:
return false
func old_is_match_regex(search_term: String, game_name: String) -> bool:
if search_term == "":
return true
elif compile_regex(search_term).search(game_name):
return true
else:
return false
func old_compile_regex(search_term: String) -> RegEx:
var regex = RegEx.new()
var regText: String = ".*"
for letter in search_term:
regText += letter + ".*"
regex.compile(regText)
return regex

View File

@@ -2,8 +2,6 @@ extends Node
var default_path: String = "https://music.sanplex.tech"
var selected_server: int = 0
#var default_path: String = "https://tmusic.sanplex.tech"
#var selected_server: int = 1
var is_local: bool = false
@@ -17,15 +15,25 @@ var use_low_played_mode: bool = false
var winning_score: int = 20
var fullscreen: bool = false
var play_local: bool = false
var inspiration_list_speed: int = 1
var player_array: Array[PlayerObject]
var edit_players: bool = false
var currently_syncing: bool = false
var character_select_open: bool = false
var version: String = "1.6.1"
var version: String = "1.7.5"
var whats_new: String = "Changelog:
1.7.5:
#20: The winner song can now be stopped
#24: The speed of the inspiration list can now be changed
1.7.0:
#22: Now block add player if player name is empty
#23: Add a log for when points are given to players
#25: Fixed some graphical stuff
#26: Changed so the same character can be on a song multiple times
#27: Turning off statistics after win
1.6.1:
#17: Removed Debug text in release
#18: Fixed bug with new character select screen

View File

@@ -33,15 +33,21 @@ var lower_cache_button: Button = %LowerCacheButton
@onready
var increase_cache_button: Button = %IncreaseCacheButton
@onready
var inspiration_speed_label: Label = %InspirationListSpeedLabel
@onready
var lower_inspiration_speed_button: Button = %LowerInspirationSpeedButton
@onready
var increase_inspiration_speed_button: Button = %IncreaseInspirationSpeedButton
@onready
var select_server_button: OptionButton = %SelectServerButton
@onready
var fullscreen_button: CheckButton = %FullscreenButton
#@onready
#var quick_sync_button := $QuickSyncButton
@onready
var local_button: CheckButton = %LocalButton
@@ -60,6 +66,8 @@ func _ready() -> void:
increase_winning_score_button.pressed.connect(increase_winning_score)
lower_cache_button.pressed.connect(lower_cache)
increase_cache_button.pressed.connect(increase_cache)
lower_inspiration_speed_button.pressed.connect(lower_inspiration_speed)
increase_inspiration_speed_button.pressed.connect(increase_inspiration_speed)
fullscreen_button.pressed.connect(fullscreen)
local_button.pressed.connect(local_play)
@@ -69,6 +77,7 @@ func _ready() -> void:
low_played_button.button_pressed = Settings.use_low_played_mode
score_label.text = str(Settings.winning_score)
cache_label.text = str(Playlist.number_of_tracks_to_preload)
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
fullscreen_button.button_pressed = Settings.fullscreen
select_server_button.select(Settings.selected_server)
select_server_button.item_selected.connect(select_server)
@@ -110,6 +119,10 @@ func increase_winning_score() -> void:
Settings.winning_score += 1
score_label.text = str(Settings.winning_score)
func set_winning_score(new_score: int) -> void:
Settings.winning_score = new_score
score_label.text = str(Settings.winning_score)
func lower_cache() -> void:
Playlist.number_of_tracks_to_preload -= 1
if Playlist.number_of_tracks_to_preload < 1:
@@ -120,7 +133,29 @@ func increase_cache() -> void:
Playlist.number_of_tracks_to_preload += 1
cache_label.text = str(Playlist.number_of_tracks_to_preload)
func lower_inspiration_speed() -> void:
Settings.inspiration_list_speed -= 1
if Settings.inspiration_list_speed < 1:
Settings.inspiration_list_speed = 1
inspiration_speed_label.text = str(Settings.inspiration_list_speed)
func increase_inspiration_speed() -> void:
Settings.inspiration_list_speed += 1
inspiration_speed_label.text = str(Settings.inspiration_list_speed )
func select_server(new_server: int) -> void:
print("select_server")
Settings.default_path = select_server_button.get_item_text(new_server)
Settings.selected_server = new_server
print("Settings.default_path: " + Settings.default_path)
print("Settings.selected_server: " + str(Settings.selected_server))
print("new_server: " + str(new_server))
print("select_server_button.get_item_text(new_server): " + select_server_button.get_item_text(new_server))
server_changed.emit()
func set_selected_server(new_server: int) -> void:
print("set_selected_server")
select_server_button.select(new_server)
Settings.default_path = select_server_button.get_item_text(new_server)
Settings.selected_server = new_server
print("Settings.default_path: " + Settings.default_path)

View File

@@ -123,6 +123,34 @@ focus_mode = 0
action_mode = 0
text = "+1"
[node name="InspirationHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
layout_mode = 2
[node name="InspirationListSpeedTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer"]
layout_mode = 2
text = "Inspiration List Speed: "
[node name="InspirationListSpeedLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "1"
[node name="LowerInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "-1"
[node name="IncreaseInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2
focus_mode = 0
action_mode = 0
text = "+1"
[node name="SelectServerButton" type="OptionButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2

View File

@@ -42,8 +42,7 @@ func get_song_info() -> String:
func add_point(id: int) -> void:
print("add_point")
if !players_given_point.has(id):
players_given_point.append(id)
players_given_point.append(id)
players_given_point.sort()
func remove_point(id: int) -> void:

29
log.gd Normal file
View File

@@ -0,0 +1,29 @@
extends Control
@onready
var log_panel: Panel = %LogPanel
@onready
var log_box: VBoxContainer = %LogVBoxContainer
var log_rows: Array
func add_log_row(text: String) -> void:
var log_row: String = get_time() + text
log_rows.append(log_row)
update_log()
func update_log() -> void:
print("update_log")
Settings.delete_children(log_box)
for row: String in log_rows:
var log_label: Label = Label.new()
log_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
log_label.add_theme_font_size_override("font_size", 20)
log_label.text = row
log_label.autowrap_mode = TextServer.AUTOWRAP_WORD
log_box.add_child(log_label)
func get_time() -> String:
var dateTime: Dictionary = Time.get_datetime_dict_from_system()
return "" + str(dateTime.hour) + ":" + str(dateTime.minute) + ":" + str(dateTime.second) + " "

1
log.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://cw41y87l64qo7

View File

@@ -59,6 +59,8 @@ var sync_timer: Timer = %SyncTimer
var changes: bool = false
var has_synced: bool = false
signal sync_started
signal sync_finished
@@ -75,13 +77,14 @@ func _input(event: InputEvent) -> void:
func start_sync() -> void:
print("start_sync")
self.visible = true
var sync_request_sent: Callable = func sync_request_sent() -> void:
sync_timer.start(0.75)
Settings.currently_syncing = true
sync_started.emit()
show_sync_progress()
if !Settings.currently_syncing:
Settings.make_request2("/sync", sync_request_sent, false)
if !has_synced:
var sync_request_sent: Callable = func sync_request_sent() -> void:
sync_timer.start(0.75)
Settings.currently_syncing = true
sync_started.emit()
show_sync_progress()
if !Settings.currently_syncing:
Settings.make_request2("/sync", sync_request_sent, false)
func _on_sync_timeout() -> void:
print("_on_sync_timeout!")
@@ -97,6 +100,7 @@ func _on_sync_timeout() -> void:
Settings.make_request2("/sync/progress", get_progress, true)
func on_sync_finished(data_received: Dictionary) -> void:
has_synced = true
reset_sync_result()
if data_received.games_added != null:
changes = true