14 Commits

Author SHA1 Message Date
Sansan 6989b53dda Merge pull request 'Fixed workflow' (#35) from 1.8.0 into main
Build / build (push) Successful in 1m5s
Publish / build (push) Successful in 1m13s
Reviewed-on: #35
2026-05-16 17:50:05 +02:00
Sansan 899e99864f #9 #32 #33 : New winner screen, new setting for hide beginning and fixed bug
Build / build (push) Successful in 1m25s
2026-05-16 17:46:09 +02:00
Sansan 84608c95c2 Fixed workflow
Publish / build (push) Successful in 1m13s
2026-05-15 11:03:20 +02:00
Sansan acd8d65b95 #29 Small fixes
Build / build (push) Successful in 1m6s
Publish / build (push) Failing after 1m16s
2026-05-15 10:52:26 +02:00
Sansan d957c02373 #14 #15 #29 #31 : Added qr, added more settings, added keymap, changed about page.
Build / build (push) Successful in 1m5s
2026-05-14 12:24:50 +02:00
Sansan 0316df2f95 #14,#15,#29,#31: Added qr, added more settings, added keymap, changed about page.
Build / build (push) Successful in 1m10s
2026-05-14 12:18:42 +02:00
Sansan b4ba96cf63 #20 #24 Winnersong can be stopped. Inspirationlist speed can be changed. Some other small fixes
Build / build (push) Successful in 1m36s
2025-12-27 14:05:56 +01:00
Sansan 2a32cc34ef Sync result can be seen multiple times
Build / build (push) Successful in 1m19s
Publish / build (push) Successful in 1m33s
2025-11-15 15:02:21 +01:00
Sansan bae5831a3e #22: Now block add player if player name is empty
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
Sansan c6ed3c8e53 #17 #18: Removed Debug text in release and fixed bug with new character select screen
Build / build (push) Successful in 1m31s
Publish / build (push) Successful in 1m32s
2025-11-13 18:17:25 +01:00
Sansan 166705f2ab #4 #5 Added a new character select window that now fetches images from the server
Build / build (push) Successful in 1m31s
Publish / build (push) Successful in 2m39s
2025-11-07 20:46:45 +01:00
Sansan 734a463db9 #8: Added functionality to cache more than one song
Build / build (push) Successful in 1m25s
2025-10-26 20:48:35 +01:00
Sansan 4e6e37775d #2 #6 #7 Added a new sync screen that shows progress during sync
Build / build (push) Successful in 1m22s
2025-09-19 22:15:37 +02:00
Sansan 3e4d417b4f #1: Fixed bug with inspiration list and search list not updating on sync and server changed
Build / build (push) Successful in 1m30s
2025-08-24 12:00:29 +02:00
67 changed files with 27349 additions and 502 deletions
+6 -8
View File
@@ -9,11 +9,9 @@ on:
branches: [main, develop] branches: [main, develop]
env: env:
GODOT_VERSION: 4.4 GODOT_VERSION: 4.6
PROJECT_PATH: . PROJECT_PATH: .
#GAME_VERSION: 0.0.8 EXPORT_NAME: MusicPlayer
#GAME_VERSION: ${{gitea.ref_name}}
EXPORT_NAME: test-project
jobs: jobs:
build: build:
@@ -54,8 +52,8 @@ jobs:
cd $PROJECT_PATH cd $PROJECT_PATH
./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64" ./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64"
- name: MacOS Build # - name: MacOS Build
run: | # run: |
cd $PROJECT_PATH # cd $PROJECT_PATH
./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip" # ./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip"
+13 -13
View File
@@ -10,7 +10,7 @@ on:
- '*.*' - '*.*'
env: env:
GODOT_VERSION: 4.4 GODOT_VERSION: 4.6
PROJECT_PATH: . PROJECT_PATH: .
PROJECT_NAME: MusicPlayer PROJECT_NAME: MusicPlayer
GAME_VERSION: ${{gitea.ref_name}} GAME_VERSION: ${{gitea.ref_name}}
@@ -55,31 +55,31 @@ jobs:
cd $PROJECT_PATH cd $PROJECT_PATH
./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64" ./godot --headless --verbose --export-release "Linux" "build/$EXPORT_NAME.x86_64"
- name: MacOS Build # - name: MacOS Build
run: | # run: |
cd $PROJECT_PATH # cd $PROJECT_PATH
./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip" # ./godot --headless --verbose --export-release "macOS" "build/$EXPORT_NAME.zip"
- name: Upload Artifact Windows - name: Upload Artifact Windows
run: | run: |
#ls -la build #ls -la build
curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \ curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
--upload-file "build/$EXPORT_NAME.exe" \ --upload-file "build/$EXPORT_NAME.exe" \
https://gitea.sanplex.tech/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.exe https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.exe
- name: Upload Artifact Linux - name: Upload Artifact Linux
run: | run: |
ls -la build ls -la build
curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \ curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
--upload-file "build/$EXPORT_NAME.x86_64" \ --upload-file "build/$EXPORT_NAME.x86_64" \
https://gitea.sanplex.tech/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.x86_64 https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.x86_64
- name: Upload Artifact MacOS # - name: Upload Artifact MacOS
run: | # run: |
ls -la build # ls -la build
curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \ # curl --user ${{ github.repository_owner }}:${{ secrets.TOKEN }} \
--upload-file "build/$EXPORT_NAME.zip" \ # --upload-file "build/$EXPORT_NAME.zip" \
https://gitea.sanplex.tech/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.zip # https://gitea.sanplex.xyz/api/packages/sansan/generic/$PROJECT_NAME/$GAME_VERSION/$EXPORT_NAME.zip
- name: Create release - name: Create release
uses: akkuman/gitea-release-action@v1 uses: akkuman/gitea-release-action@v1
-19
View File
@@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://n2g8jddr85h2"
path="res://.godot/imported/01. Opening.mp3-3b470cf2b258d9ffad574f672712bdc3.mp3str"
[deps]
source_file="res://01. Opening.mp3"
dest_files=["res://.godot/imported/01. Opening.mp3-3b470cf2b258d9ffad574f672712bdc3.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
+70
View File
@@ -0,0 +1,70 @@
extends Control
@onready
var about_panel: Panel = %AboutPanel
@onready
var version_label: Label = %VersionLabel
@onready
var whats_new_label: Label = %WhatsNewLabel
# Changelog as Dictionary with version as key and description as value
const WHATS_NEW: Dictionary = {
"1.8.5": "#9: New winner screen with positions of all players
#32: New setting for how long to hide the beginning
#33: Fixed bug with hiding beginning when song restarts",
"1.8.0": "#14: Updated About page
#15: Create new keymap page
#20: The winner song can now be stopped
#24: The speed of the inspiration list can now be changed
#29: New settings to hide time left and things like that
#31: Added a QR page",
"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",
"1.6.0": "#1: Fixed bug with inspiration list not reloading after sync
#2: New dialog for sync
#4: Now downloads characters from the server
#5: New character select screen
#6: Now show progress during sync
#7: Blocking all requests to the server during sync
#8: Added functionality to cache more than one song",
"1.5.0": "Made big changes to players and the song list and how the local song list works",
"0.9.0-Beta": "Fixed settings and updated the player view",
"0.8.0-Beta": "Fixed reset buttons and some other small things",
"0.7.8-Beta": "Added shortcuts. Added dialog for winner. Started cleaning code.",
"0.7.5-Beta": "Added settings menu, most things don't do anything yet",
"0.7-Beta": "Can now hop between songs"
}
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), about_panel.size).has_point(evLocal.position):
self.visible = false
func show_window() -> void:
visible = true
version_label.text = Settings.version
# Build changelog text with version headers
var changelog_text: String = ""
for version: String in WHATS_NEW.keys():
changelog_text += "\n" + version + "\n"
changelog_text += WHATS_NEW[version] + "\n"
whats_new_label.text = changelog_text
func hide_window() -> void:
visible = false
+1
View File
@@ -0,0 +1 @@
uid://b7bh0of7olbcb
+63
View File
@@ -0,0 +1,63 @@
[gd_scene format=3 uid="uid://cp54idaudb8dp"]
[ext_resource type="Script" uid="uid://b7bh0of7olbcb" path="res://AboutWindow.gd" id="1_about_script"]
[node name="AboutControl" type="Control" unique_id=1626010355]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_about_script")
[node name="AboutPanel" type="Panel" parent="." unique_id=1907299275]
unique_name_in_owner = true
layout_mode = 0
offset_right = 600.0
offset_bottom = 640.0
[node name="TitleLabel" type="Label" parent="AboutPanel" unique_id=200295721]
texture_filter = 1
layout_mode = 0
offset_right = 600.0
offset_bottom = 50.0
text = "About"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ScrollContainer" type="ScrollContainer" parent="AboutPanel" unique_id=417677913]
layout_mode = 0
offset_left = 10.0
offset_top = 50.0
offset_right = 590.0
offset_bottom = 630.0
[node name="ContentVBox" type="VBoxContainer" parent="AboutPanel/ScrollContainer" unique_id=1746337912]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="VersionLabel" type="Label" parent="AboutPanel/ScrollContainer/ContentVBox" unique_id=352884126]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
size_flags_horizontal = 3
horizontal_alignment = 1
[node name="DescriptionLabel" type="Label" parent="AboutPanel/ScrollContainer/ContentVBox" unique_id=543094263]
texture_filter = 1
custom_minimum_size = Vector2(560, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "Try your video game music knowledge with this VGM randomizer, invite your friends and see who is the best."
horizontal_alignment = 1
autowrap_mode = 2
[node name="WhatsNewLabel" type="Label" parent="AboutPanel/ScrollContainer/ContentVBox" unique_id=1363040291]
unique_name_in_owner = true
texture_filter = 1
custom_minimum_size = Vector2(560, 0)
layout_mode = 2
size_flags_horizontal = 3
autowrap_mode = 2
+9 -11
View File
@@ -1,36 +1,34 @@
extends ScrollContainer extends ScrollContainer
var SCROLL = 0 var SCROLL: float = 0
var delay = 0.02 #seconds var delay: float = 0.02 #seconds
var wait = 0 var wait: float = 0
var SPEED: int = 1
# 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(): func _ready() -> void:
wait = delay wait = delay
# 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: float) -> void:
wait -= delta wait -= delta
if wait < 0: if wait < 0:
wait = delay wait = delay
#SCROLL DOWN #SCROLL DOWN
if SCROLL == 1: if SCROLL == 1:
if (scroll_vertical + get_v_scroll_bar().page) < get_v_scroll_bar().max_value: if (scroll_vertical + get_v_scroll_bar().page) < get_v_scroll_bar().max_value:
scroll_vertical += SPEED scroll_vertical += Settings.inspiration_list_speed
else: else:
scroll_back_up() scroll_back_up()
#SCROLL UP #SCROLL UP
elif SCROLL == -1: elif SCROLL == -1:
if scroll_vertical != 0: if scroll_vertical != 0:
scroll_vertical -= SPEED scroll_vertical -= Settings.inspiration_list_speed
else: else:
scroll_to_bottom() scroll_to_bottom()
func scroll_back_up(): func scroll_back_up() -> void:
SCROLL = -1 SCROLL = -1
func scroll_to_bottom(): func scroll_to_bottom() -> void:
scroll_vertical = 0 #Reset to top first. scroll_vertical = 0 #Reset to top first.
SCROLL = 1 SCROLL = 1
+33
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
+145 -115
View File
@@ -8,8 +8,6 @@ extends Control
# 386 LOC 12/6 - 2024 # 386 LOC 12/6 - 2024
##TODO ##TODO
# 13. Fix graphics in lists
# 14. Fix layout
# 15. Fix for local play # 15. Fix for local play
@onready @onready
@@ -55,13 +53,25 @@ var sound_test_button: Button = $SoundTestButton
var sync_button: Button = $SyncButton var sync_button: Button = $SyncButton
@onready @onready
var sync_popup: PopupPanel = $SyncPopupPanel var sync_window: Control = %SyncWindow
@onready @onready
var settings_button: Button = $SettingsButton var settings_button: Button = $SettingsButton
@onready @onready
var settings_popup: PopupPanel = $SettingsPopupPanel var settings_window: Control = $SettingsWindow
@onready
var shortcuts_window: Control = %ShortcutsWindow
@onready
var qr_window: Control = %QRWindow
@onready
var winner_window: Control = %WinnerWindow
@onready
var qr_button: Button = $QRButton
@onready @onready
var statistics_button: Button = $StatisticsButton var statistics_button: Button = $StatisticsButton
@@ -72,11 +82,14 @@ var statistic_popup: PopupPanel = $StatisticsPopupPanel
@onready @onready
var statistic_label: Label = $StatisticsPopupPanel/StatisticsLabel var statistic_label: Label = $StatisticsPopupPanel/StatisticsLabel
@onready
var shortcuts_button: Button = $ShortcutsButton
@onready @onready
var about_button: Button = $AboutButton var about_button: Button = $AboutButton
@onready @onready
var about_popup: PopupPanel = $AboutPopupPanel var about_window: Control = %AboutWindow
@onready @onready
var show_answer_button: Button = $ShowAnswerButton var show_answer_button: Button = $ShowAnswerButton
@@ -96,41 +109,29 @@ var player_container: VBoxContainer = $Players/VBoxContainer
@onready @onready
var character_select: Control = $CharacterSelect var character_select: Control = $CharacterSelect
@onready
var new_character_select: Control = %NewCharacterSelect
@onready @onready
var search_button: Button = $SearchButton var search_button: Button = $SearchButton
@onready @onready
var search_view: Control= $Search var search_view: Control= $Search
@onready
var version_label: Label = $AboutPopupPanel/VBoxContainer/VersionLabel
@onready
var whats_new_label: Label = $AboutPopupPanel/VBoxContainer/HBoxContainer/NewLabel
@onready
var shortcut_label: Label = $AboutPopupPanel/VBoxContainer/HBoxContainer/ShortcutsLabel
@onready
var coming_label: Label = $AboutPopupPanel/VBoxContainer/HBoxContainer/CommingLabel
@onready
var winner_popup: PopupPanel = $WinnerPopupPanel
@onready
var winner_label: Label = $WinnerPopupPanel/WinnerLabel
@onready
var winner_picture: TextureRect = $WinnerPopupPanel/WinnerPicture
@onready @onready
var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton
@onready @onready
var music_player_container: PanelContainer = $MusicPlayer var music_player_container: PanelContainer = $MusicPlayer
var player := preload("res://Player.tscn") @onready
var song_list_object := preload("res://song_list_object.tscn") var log_window: Control = %Log
@onready
var debug_label: Label = $DebugLabel
var player: PackedScene = preload("res://Player.tscn")
var song_list_object: PackedScene = preload("res://song_list_object.tscn")
var songs: Array= [] var songs: Array= []
var games: Array = [] var games: Array = []
@@ -138,32 +139,38 @@ var current_player: Node
# 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:
var is_debug: bool = OS.has_feature("debug") var debug: bool = OS.has_feature("debug")
var is_mac: bool = OS.has_feature("macos") var is_mac: bool = OS.has_feature("macos")
if is_debug: if debug:
print("is_debug") print("is_debug")
##Settings.default_path = "http://localhost:8080" debug_label.visible = true
##Settings.selected_server = 3 Settings.is_debug = true
Settings.default_path = "http://localhost:8080" settings_window.set_winning_score(5)
Settings.selected_server = 3 settings_window.set_selected_server(4)
Settings.winning_score = 5
if is_mac: if is_mac:
print("is_mac") print("is_mac")
next_button.pressed.connect(fetch_song.bind(false)) next_button.pressed.connect(play_next_song)
show_answer_button.pressed.connect(show_answer_pressed) show_answer_button.pressed.connect(show_answer_pressed)
search_button.pressed.connect(show_search) search_button.pressed.connect(show_search)
sync_button.pressed.connect(sync_games) sync_button.pressed.connect(sync_games)
sound_test_button.pressed.connect(music_player_container.get_sound_test_song) sound_test_button.pressed.connect(music_player_container.get_sound_test_song)
statistics_button.pressed.connect(get_statistics) statistics_button.pressed.connect(get_statistics)
shortcuts_button.pressed.connect(show_shortcuts)
about_button.pressed.connect(show_about) about_button.pressed.connect(show_about)
settings_button.pressed.connect(show_settings) settings_button.pressed.connect(show_settings)
qr_button.pressed.connect(show_qr)
reset_playlist_button.pressed.connect(reset_playlist) reset_playlist_button.pressed.connect(reset_playlist)
reset_points_button.pressed.connect(reset_points) reset_points_button.pressed.connect(reset_points)
character_select.connect("character_selected", _on_character_selected) character_select.connect("character_selected", _on_character_selected)
new_character_select.connect("new_new_character_selected", _on_new_character_selected)
new_player_name_field.connect("enter_key_pressed", add_player) new_player_name_field.connect("enter_key_pressed", add_player)
music_player_container.connect("play_next_song", fetch_song.bind(false)) music_player_container.connect("play_next_song", play_next_song)
music_player_container.connect("update_song_list", update_song_list) music_player_container.connect("update_song_list", update_song_list)
settings_window.connect("server_changed", server_updated)
sync_window.connect("sync_started", _on_sync_started)
sync_window.connect("sync_finished", _on_sync_finished)
add_players_button.pressed.connect(add_players) add_players_button.pressed.connect(add_players)
add_player_button.pressed.connect(add_player) add_player_button.pressed.connect(add_player)
@@ -172,7 +179,9 @@ func _ready() -> void:
get_suggestion_list() get_suggestion_list()
fetch_song_list_at_start() fetch_song_list_at_start()
fetch_song(true) fetch_song()
search_view.get_list_of_games()
new_character_select.load_characters()
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed: if event is InputEventKey and event.pressed:
@@ -194,60 +203,77 @@ func _input(event: InputEvent) -> void:
if event.alt_pressed && event.keycode == KEY_ENTER: if event.alt_pressed && event.keycode == KEY_ENTER:
print("Alt + Enter pressed") print("Alt + Enter pressed")
Settings.fullscreen = !Settings.fullscreen Settings.fullscreen = !Settings.fullscreen
settings_window.fullscreen_button.button_pressed = Settings.fullscreen
if Settings.fullscreen == true: if Settings.fullscreen == true:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
if Settings.fullscreen == false: 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_K:
shortcuts_window.visible = !shortcuts_window.visible
if event.alt_pressed && event.keycode == KEY_L:
log_window.visible = !log_window.visible
func server_updated() -> void:
print("server_updated")
update_from_server()
reset_points()
func update_from_server() -> void:
print("update_from_server")
search_view.get_list_of_games()
get_suggestion_list()
reset_playlist()
new_character_select.load_characters()
func repeat_song() -> void: func repeat_song() -> void:
Settings.auto_repeat_song = !Settings.auto_repeat_song Settings.auto_repeat_song = !Settings.auto_repeat_song
func show_answer_pressed() -> void: func show_answer_pressed() -> void:
print("show_answer_pressed") print("show_answer_pressed")
print("show_answer_pressed song_object: ", Settings.song_object_array[Settings.latest_played_song]._to_string()) Playlist.song_is_answered()
Settings.song_object_array[Settings.latest_played_song].is_answered = true
update_song_list() update_song_list()
func fetch_song_list_at_start() -> void: func fetch_song_list_at_start() -> void:
print("fetch_song_list_at_start") print("fetch_song_list_at_start")
var fetch_song_list_at_start_done: Callable = func fetch_songs_at_start_done(data) -> void: var fetch_song_list_at_start_done: Callable = func fetch_songs_at_start_done(data) -> void:
Settings.song_object_array = [] Playlist.clear_song_list()
if data == null: if data == null:
Settings.latest_played_song = Settings.song_object_array.size() Playlist.update_last_played_song()
update_song_list() update_song_list()
return return
if typeof(data) == TYPE_ARRAY: if typeof(data) == TYPE_ARRAY:
for d in data: for d: Dictionary in data:
var new_song_object: SongObject = SongObject.new() var new_song_object: SongObject = SongObject.new()
new_song_object.song_number = d.SongNo new_song_object.song_number = d.SongNo
new_song_object.game_title = d.Game new_song_object.game_title = d.Game
new_song_object.song_title = d.Song new_song_object.song_title = d.Song
new_song_object.is_answered = true new_song_object.is_answered = true
new_song_object.has_played = true new_song_object.has_played = true
Settings.song_object_array.append(new_song_object) Playlist.add_to_playlist(new_song_object)
else: else:
print("Unexpected data") print("Unexpected data")
Settings.latest_played_song = Settings.song_object_array.size() Playlist.update_last_played_song()
update_song_list() update_song_list()
Settings.make_request2("/music/list", fetch_song_list_at_start_done, true) Settings.make_request2("/music/list", fetch_song_list_at_start_done, true)
func play_next_song() -> void:
print("play_next_song ", Playlist.latest_played_song)
if Playlist.first_song_played:
Playlist.set_latest_played_song()
Playlist.first_song_played = true
music_player_container.play_song_object(Playlist.latest_played_song)
if !(Playlist.get_preloaded_songs() > 0):
next_button.disabled = true
if !Playlist.is_song_downloading:
fetch_song()
#not first "/music/addPlayed" #not first "/music/addPlayed"
#"/music/rand" #"/music/rand"
#"/music/addQue" #"/music/addQue"
#"/music/info" #"/music/info"
func fetch_song(first_time: bool) -> void: func fetch_song() -> void:
print("fetch_song") print("fetch_song")
if !first_time: Playlist.is_song_downloading = true
if Settings.song_object_array[Settings.latest_played_song].has_played && !Settings.song_object_array[Settings.latest_played_song].is_answered:
Settings.song_object_array[Settings.latest_played_song].is_answered = true
Settings.latest_played_song = Settings.song_object_array.size() - 1
music_player_container.play_song_object(Settings.latest_played_song)
if Settings.add_to_stats :
print("add to stats")
Settings.make_request3("/music/addPlayed")
next_button.disabled = true
var url: String = "" var url: String = ""
if Settings.use_low_played_mode: if Settings.use_low_played_mode:
url = "/music/rand/low" url = "/music/rand/low"
@@ -269,8 +295,14 @@ func fetch_song(first_time: bool) -> void:
new_song_object.song_title = data_received.Song new_song_object.song_title = data_received.Song
print("new_song_object: ", new_song_object.to_string()) print("new_song_object: ", new_song_object.to_string())
Settings.song_object_array.append(new_song_object) Playlist.add_to_playlist(new_song_object)
next_button.disabled = false next_button.disabled = false
if Playlist.should_preload_more_songs():
fetch_song()
else:
Playlist.is_song_downloading = false
if Settings.is_debug:
update_song_list()
Settings.make_request2("/music/info", fetch_song_info_done, true) Settings.make_request2("/music/info", fetch_song_info_done, true)
Settings.make_request2("/music/addQue", added_to_que_done, false) Settings.make_request2("/music/addQue", added_to_que_done, false)
@@ -279,13 +311,11 @@ func fetch_song(first_time: bool) -> void:
func update_song_list() -> void: func update_song_list() -> void:
print("update_song_list") print("update_song_list")
if Settings.currently_playing_song >= 0: if Playlist.currently_playing_song >= 0:
game_label.text = Settings.song_object_array[Settings.currently_playing_song].get_game_title() game_label.text = Playlist.get_current_game_title()
song_label.text = Settings.song_object_array[Settings.currently_playing_song].get_song_title() song_label.text = Playlist.get_current_song_title()
Settings.delete_children(music_list) Settings.delete_children(music_list)
for s: SongObject in Settings.song_object_array: for s: SongObject in Playlist.get_playlist():
if !s.has_played:
return
var new_song_list_object: SongListObject = song_list_object.instantiate() var new_song_list_object: SongListObject = song_list_object.instantiate()
new_song_list_object.song_object = s new_song_list_object.song_object = s
new_song_list_object.gui_input.connect(song_object_clicked.bind(s.song_number)) new_song_list_object.gui_input.connect(song_object_clicked.bind(s.song_number))
@@ -293,15 +323,15 @@ func update_song_list() -> void:
func song_object_clicked(event: InputEvent, song_no: int) -> void: func song_object_clicked(event: InputEvent, song_no: int) -> void:
if (event is InputEventMouseButton && event.pressed && event.button_index == MOUSE_BUTTON_LEFT): if (event is InputEventMouseButton && event.pressed && event.button_index == MOUSE_BUTTON_LEFT):
print("Clicked Song Object: ", Settings.song_object_array[song_no].to_string()) print("Clicked Song Object: ", Playlist.song_object_array[song_no].to_string())
if Settings.song_object_array[song_no].song == null: if Settings.character_select_open == false:
if Playlist.get_song(song_no) == null:
print("has no song, need to download") print("has no song, need to download")
var song_downloaded: Callable = func song_downloaded(body: PackedByteArray) -> void: var song_downloaded: Callable = func song_downloaded(body: PackedByteArray) -> void:
var sound: AudioStream = AudioStreamMP3.new() var sound: AudioStream = AudioStreamMP3.new()
sound.data = body sound.data = body
Settings.song_object_array[song_no].song = sound Playlist.add_song_to_song_object(song_no, sound)
music_player_container.play_song_object(song_no) music_player_container.play_song_object(song_no)
Settings.make_request2("/music?song=" + str(song_no), song_downloaded, true) Settings.make_request2("/music?song=" + str(song_no), song_downloaded, true)
else: else:
print("song already downloaded") print("song already downloaded")
@@ -310,11 +340,9 @@ func song_object_clicked(event: InputEvent, song_no: int) -> void:
func reset_playlist() -> void: func reset_playlist() -> void:
print("reset_playlist") print("reset_playlist")
var playlist_reset_done: Callable = func playlist_reset_done() -> void: var playlist_reset_done: Callable = func playlist_reset_done() -> void:
Settings.currently_playing_song = -1 Playlist.reset_playlist()
Settings.latest_played_song = 0
Settings.song_object_array.clear()
fetch_song_list_at_start() fetch_song_list_at_start()
fetch_song(true) fetch_song()
Settings.make_request2("/music/reset", playlist_reset_done, false) Settings.make_request2("/music/reset", playlist_reset_done, false)
@@ -326,15 +354,19 @@ func reset_points() -> void:
func show_about() -> void: func show_about() -> void:
print("show_about") print("show_about")
about_popup.visible = true about_window.show_window()
version_label.text = Settings.version
whats_new_label.text = Settings.whats_new func show_shortcuts() -> void:
shortcut_label.text = Settings.shortcuts print("show_shortcuts")
coming_label.text = Settings.whats_left shortcuts_window.visible = true
func show_settings() -> void: func show_settings() -> void:
print("show_settings") print("show_settings")
settings_popup.visible = true settings_window.visible = true
func show_qr() -> void:
print("show_qr")
qr_window.show_window()
func get_statistics() -> void: func get_statistics() -> void:
print("get_statistics") print("get_statistics")
@@ -343,34 +375,30 @@ func get_statistics() -> void:
func sync_games() -> void: func sync_games() -> void:
print("sync_games") print("sync_games")
sync_button.disabled = true sync_window.start_sync()
var games_synced: Callable = func games_synced() -> void:
sync_button.disabled = false
sync_popup.visible = true
print("games_synced")
reset_playlist()
get_suggestion_list()
search_view.get_list_of_games()
var new_games_synced: Callable = func new_games_synced(synced) -> void: func _on_sync_started() -> void:
print("_on_sync_started")
sync_button.disabled = false sync_button.disabled = false
sync_popup.visible = true sound_test_button.disabled = true
print("games_synced") reset_playlist_button.disabled = true
print("synced: ", synced) show_answer_button.disabled = true
reset_playlist() next_button.disabled = true
get_suggestion_list()
search_view.get_list_of_games()
if Settings.quick_sync == true: func _on_sync_finished() -> void:
Settings.make_request2("/sync/new", new_games_synced, true) print("_on_sync_finished")
else: update_from_server()
Settings.make_request2("/sync/quick", games_synced, false) sound_test_button.disabled = false
reset_playlist_button.disabled = false
show_answer_button.disabled = false
reset_points()
func get_suggestion_list() -> void: func get_suggestion_list() -> void:
print("get_suggestion_list") print("get_suggestion_list")
var populate_list: Callable = func populate_list(array) -> void: var populate_list: Callable = func populate_list(array) -> void:
if typeof(array) == TYPE_ARRAY: if typeof(array) == TYPE_ARRAY:
games = [] games = []
Settings.delete_children(inspiration_list)
games.append_array(array) games.append_array(array)
for game: String in games: for game: String in games:
var inspiration_label: Label = Label.new() var inspiration_label: Label = Label.new()
@@ -392,6 +420,7 @@ func add_players() -> void:
func add_player() -> void: func add_player() -> void:
print("add_player") print("add_player")
if new_player_name_field.text != "" && Settings.player_array.size() < Settings.MAX_NUMBER_OF_PLAYERS:
var new_player_object: PlayerObject = PlayerObject.new(new_player_name_field.text, Settings.player_array.size()) var new_player_object: PlayerObject = PlayerObject.new(new_player_name_field.text, Settings.player_array.size())
new_player_name_field.text = "" new_player_name_field.text = ""
Settings.player_array.append(new_player_object) Settings.player_array.append(new_player_object)
@@ -413,7 +442,7 @@ func load_players() -> void:
var new_player: Player = player.instantiate() var new_player: Player = player.instantiate()
new_player.id = counter new_player.id = counter
new_player.connect("change_character_clicked", _on_player_change_character_clicked.bind(new_player)) new_player.connect("change_character_clicked", _on_player_change_character_clicked.bind(new_player, player_object.player_name))
new_player.connect("player_removed", _on_player_removed.bind(counter)) new_player.connect("player_removed", _on_player_removed.bind(counter))
player_container.add_child(new_player) player_container.add_child(new_player)
@@ -421,8 +450,9 @@ func load_players() -> void:
func _on_point_given(player_given_point: int) -> void: func _on_point_given(player_given_point: int) -> void:
print("_on_point_given") print("_on_point_given")
if Settings.currently_playing_song >= 0: log_window.add_log_row(Settings.player_array[player_given_point].player_name + " got a point")
Settings.song_object_array[Settings.currently_playing_song].add_point(player_given_point) if Playlist.currently_playing_song >= 0:
Playlist.add_point(player_given_point)
update_song_list() update_song_list()
func _on_make_point_given_sound() -> void: func _on_make_point_given_sound() -> void:
@@ -430,39 +460,39 @@ func _on_make_point_given_sound() -> void:
func _on_point_taken(player_taken_point: int) -> void: func _on_point_taken(player_taken_point: int) -> void:
print("_on_point_taken") print("_on_point_taken")
log_window.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")) music_player_container.play_sound_effect(preload("res://sounds/itemequip.wav"))
if Settings.currently_playing_song >= 0: if Playlist.currently_playing_song >= 0:
Settings.song_object_array[Settings.currently_playing_song].remove_point(player_taken_point) Playlist.remove_point(player_taken_point)
update_song_list() update_song_list()
func _on_player_won(winning_player_id: int) -> void: func _on_player_won(winning_player_id: int) -> void:
print("_on_player_won") print("_on_player_won")
winner_popup.visible = true winner_window.show_winner(winning_player_id)
winner_label.text = Settings.player_array[winning_player_id].player_name + " won!!" music_player_container.play_song(preload("res://sounds/winning.mp3"))
winner_picture.custom_minimum_size = Vector2(80, 40) Settings.add_to_stats = false
winner_picture.ignore_texture_size = true
winner_picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT
winner_picture.texture = Settings.player_array[winning_player_id].character
music_player_container.play_sound(preload("res://sounds/winning.mp3"))
func _on_player_removed(player_to_remove: int) -> void: func _on_player_removed(player_to_remove: int) -> void:
print("_on_player_removed ", player_to_remove) print("_on_player_removed ", player_to_remove)
Settings.player_array.remove_at(player_to_remove) Settings.player_array.remove_at(player_to_remove)
load_players() load_players()
Playlist.remove_player_from_list(player_to_remove)
for song_list_object: SongObject in Settings.song_object_array:
Settings.song_object_array[song_list_object.song_number].players_given_point.remove_at(Settings.song_object_array[song_list_object.song_number].players_given_point.find(player_to_remove))
update_song_list() update_song_list()
func _on_player_change_character_clicked(new_player: Node) -> void: func _on_player_change_character_clicked(new_player: Player, player_name: String) -> void:
print("_on_player_change_character_clicked") print("_on_player_change_character_clicked")
current_player = new_player current_player = new_player
character_select.visible = true print("Change character for: " + player_name)
new_character_select.show_grid(player_name)
func _on_character_selected(file_name: String) -> void: func _on_character_selected(file_name: String) -> void:
print("_on_character_selected") print("_on_character_selected")
character_select.visible = false character_select.visible = false
current_player._on_control_character_selected_clicked(file_name) current_player.character_selected(file_name)
func _on_new_character_selected(character_texture: ImageTexture) -> void:
print("_on_new_character_selected")
current_player.new_character_selected(character_texture)
func show_search() -> void: func show_search() -> void:
print("show_search") print("show_search")
+163 -160
View File
@@ -1,16 +1,22 @@
[gd_scene load_steps=26 format=3 uid="uid://xwq863o6uvsu"] [gd_scene format=3 uid="uid://xwq863o6uvsu"]
[ext_resource type="Script" uid="uid://b8f4g15cas2j2" path="res://MainWindow.gd" id="1_eu0t5"] [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"] [ext_resource type="PackedScene" uid="uid://b16on0oscg1bv" path="res://CharacterSelect.tscn" id="2_76kf4"]
[ext_resource type="Script" uid="uid://elgn7gkxgagq" path="res://InsperationScrollContainer.gd" id="2_gxtxm"] [ext_resource type="Script" uid="uid://elgn7gkxgagq" path="res://InsperationScrollContainer.gd" id="2_gxtxm"]
[ext_resource type="Texture2D" uid="uid://bcfmpd7h512ef" path="res://icons/person_add_light.svg" id="5_31tjv"] [ext_resource type="Texture2D" uid="uid://bcfmpd7h512ef" path="res://icons/person_add_light.svg" id="5_31tjv"]
[ext_resource type="PackedScene" uid="uid://ds15cgsf8vpvc" path="res://MusicPlayer.tscn" id="5_emn36"] [ext_resource type="PackedScene" uid="uid://ds15cgsf8vpvc" path="res://MusicPlayer.tscn" id="5_emn36"]
[ext_resource type="PackedScene" uid="uid://cdy4kvemwaiom" path="res://new_character_select.tscn" id="6_dhrvg"]
[ext_resource type="Script" uid="uid://gf1bk6xbe3j" path="res://MusicListScrollContainer.gd" id="7_dj026"] [ext_resource type="Script" uid="uid://gf1bk6xbe3j" path="res://MusicListScrollContainer.gd" id="7_dj026"]
[ext_resource type="Script" uid="uid://cgakje8gb37tf" path="res://PlayerNameField.gd" id="7_qsdfy"] [ext_resource type="Script" uid="uid://cgakje8gb37tf" path="res://PlayerNameField.gd" id="7_qsdfy"]
[ext_resource type="Theme" uid="uid://rxexo3ur85as" path="res://LightGrayTheme.tres" id="7_wxbv6"] [ext_resource type="Theme" uid="uid://rxexo3ur85as" path="res://LightGrayTheme.tres" id="7_wxbv6"]
[ext_resource type="PackedScene" uid="uid://bxydgil1yifps" path="res://SearchWindow.tscn" id="9_5ijvr"] [ext_resource type="PackedScene" uid="uid://bxydgil1yifps" path="res://SearchWindow.tscn" id="9_5ijvr"]
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="11_1qef0"] [ext_resource type="PackedScene" uid="uid://dpdem7pdxweb5" path="res://SyncWindow.tscn" id="10_yxw0b"]
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsWindow.tscn" id="11_k62u5"] [ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsWindow.tscn" id="11_k62u5"]
[ext_resource type="PackedScene" uid="uid://bd1by80q1v27e" path="res://shortcutsWindow.tscn" id="13_8eebo"]
[ext_resource type="PackedScene" uid="uid://bijh5h5yrivm3" path="res://Log.tscn" id="14_26rwn"]
[ext_resource type="PackedScene" uid="uid://btupbowehiyyu" path="res://QRWindow.tscn" id="15_qr_window"]
[ext_resource type="PackedScene" uid="uid://cp54idaudb8dp" path="res://AboutWindow.tscn" id="16_about_window"]
[ext_resource type="PackedScene" uid="uid://cxlsmxnrp0agh" path="res://WinnerWindow.tscn" id="17_winner_window"]
[sub_resource type="LabelSettings" id="LabelSettings_ychxr"] [sub_resource type="LabelSettings" id="LabelSettings_ychxr"]
font_size = 25 font_size = 25
@@ -62,22 +68,19 @@ keycode = 83
[sub_resource type="Shortcut" id="Shortcut_fbju4"] [sub_resource type="Shortcut" id="Shortcut_fbju4"]
events = [SubResource("InputEventKey_ujjlu")] events = [SubResource("InputEventKey_ujjlu")]
[sub_resource type="LabelSettings" id="LabelSettings_hr75l"] [node name="Control" type="Control" unique_id=407149696]
font_size = 35
[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="."] [node name="TopPanelContainer" type="PanelContainer" parent="." unique_id=663404711]
layout_mode = 0 layout_mode = 0
offset_right = 1920.0 offset_right = 1920.0
offset_bottom = 56.0 offset_bottom = 56.0
[node name="Title" type="Label" parent="."] [node name="Title" type="Label" parent="." unique_id=1187907861]
texture_filter = 1 texture_filter = 1
layout_mode = 2 layout_mode = 0
offset_left = 64.0 offset_left = 64.0
offset_top = 12.0 offset_top = 12.0
offset_right = 369.0 offset_right = 369.0
@@ -86,16 +89,16 @@ size_flags_horizontal = 0
text = "Music Player Randomizer" text = "Music Player Randomizer"
label_settings = SubResource("LabelSettings_ychxr") label_settings = SubResource("LabelSettings_ychxr")
[node name="Open" type="Button" parent="."] [node name="Open" type="Button" parent="." unique_id=165052329]
visible = false visible = false
layout_mode = 2 layout_mode = 0
offset_left = 1296.0 offset_left = 1296.0
offset_top = 66.0 offset_top = 66.0
offset_right = 1346.0 offset_right = 1346.0
offset_bottom = 97.0 offset_bottom = 97.0
text = "Open" text = "Open"
[node name="FileDialog" type="FileDialog" parent="."] [node name="FileDialog" type="FileDialog" parent="." unique_id=485771559]
title = "Open a Directory" title = "Open a Directory"
initial_position = 2 initial_position = 2
size = Vector2i(616, 400) size = Vector2i(616, 400)
@@ -104,7 +107,7 @@ file_mode = 2
access = 2 access = 2
show_hidden_files = true show_hidden_files = true
[node name="MusicListPanel" type="PanelContainer" parent="."] [node name="MusicListPanel" type="PanelContainer" parent="." unique_id=2011292375]
layout_mode = 0 layout_mode = 0
offset_left = 64.0 offset_left = 64.0
offset_top = 384.0 offset_top = 384.0
@@ -112,19 +115,19 @@ offset_right = 1152.0
offset_bottom = 896.0 offset_bottom = 896.0
theme = ExtResource("7_wxbv6") theme = ExtResource("7_wxbv6")
[node name="ScrollContainer" type="ScrollContainer" parent="MusicListPanel"] [node name="ScrollContainer" type="ScrollContainer" parent="MusicListPanel" unique_id=707750459]
layout_mode = 2 layout_mode = 2
follow_focus = true follow_focus = true
script = ExtResource("7_dj026") script = ExtResource("7_dj026")
[node name="MusicList" type="VBoxContainer" parent="MusicListPanel/ScrollContainer"] [node name="MusicList" type="VBoxContainer" parent="MusicListPanel/ScrollContainer" unique_id=373398568]
texture_filter = 1 texture_filter = 1
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
theme_override_constants/separation = 10 theme_override_constants/separation = 10
[node name="ScrollContainer" type="ScrollContainer" parent="."] [node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=498283761]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1216.0 offset_left = 1216.0
@@ -135,20 +138,20 @@ horizontal_scroll_mode = 0
vertical_scroll_mode = 3 vertical_scroll_mode = 3
script = ExtResource("2_gxtxm") script = ExtResource("2_gxtxm")
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=1215162949]
texture_filter = 1 texture_filter = 1
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=42468498]
layout_mode = 0 layout_mode = 0
offset_left = 64.0 offset_left = 64.0
offset_top = 64.0 offset_top = 64.0
offset_right = 1152.0 offset_right = 1152.0
offset_bottom = 384.0 offset_bottom = 384.0
[node name="GameLabel" type="Label" parent="VBoxContainer"] [node name="GameLabel" type="Label" parent="VBoxContainer" unique_id=173147793]
texture_filter = 1 texture_filter = 1
custom_minimum_size = Vector2(1, 1) custom_minimum_size = Vector2(1, 1)
layout_mode = 2 layout_mode = 2
@@ -156,7 +159,7 @@ label_settings = SubResource("LabelSettings_qspbu")
horizontal_alignment = 1 horizontal_alignment = 1
autowrap_mode = 2 autowrap_mode = 2
[node name="SongLabel" type="Label" parent="VBoxContainer"] [node name="SongLabel" type="Label" parent="VBoxContainer" unique_id=1687490027]
texture_filter = 1 texture_filter = 1
custom_minimum_size = Vector2(1, 1) custom_minimum_size = Vector2(1, 1)
layout_mode = 2 layout_mode = 2
@@ -164,7 +167,7 @@ label_settings = SubResource("LabelSettings_3m52w")
horizontal_alignment = 1 horizontal_alignment = 1
autowrap_mode = 2 autowrap_mode = 2
[node name="CharacterSelect" parent="." instance=ExtResource("2_76kf4")] [node name="CharacterSelect" parent="." unique_id=2079506802 instance=ExtResource("2_76kf4")]
visible = false visible = false
top_level = true top_level = true
layout_mode = 0 layout_mode = 0
@@ -173,7 +176,7 @@ offset_top = 264.0
offset_right = 776.0 offset_right = 776.0
offset_bottom = 424.0 offset_bottom = 424.0
[node name="MusicPlayer" parent="." instance=ExtResource("5_emn36")] [node name="MusicPlayer" parent="." unique_id=1990459832 instance=ExtResource("5_emn36")]
layout_mode = 0 layout_mode = 0
anchors_preset = 0 anchors_preset = 0
anchor_left = 0.0 anchor_left = 0.0
@@ -187,21 +190,21 @@ offset_bottom = 1024.0
grow_horizontal = 1 grow_horizontal = 1
grow_vertical = 1 grow_vertical = 1
[node name="Players" type="PanelContainer" parent="."] [node name="Players" type="PanelContainer" parent="." unique_id=1708375945]
layout_mode = 0 layout_mode = 0
offset_left = 1216.0 offset_left = 1216.0
offset_top = 576.0 offset_top = 576.0
offset_right = 1857.0 offset_right = 1857.0
offset_bottom = 977.0 offset_bottom = 977.0
[node name="VBoxContainer" type="VBoxContainer" parent="Players"] [node name="VBoxContainer" type="VBoxContainer" parent="Players" unique_id=270084211]
layout_mode = 2 layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="Players/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="Players/VBoxContainer" unique_id=513047023]
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
[node name="Label" type="Label" parent="Players/VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="Players/VBoxContainer/HBoxContainer" unique_id=1331357386]
texture_filter = 1 texture_filter = 1
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
@@ -211,7 +214,7 @@ text = "Players"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="AddPlayersButton" type="TextureButton" parent="Players/VBoxContainer/HBoxContainer"] [node name="AddPlayersButton" type="TextureButton" parent="Players/VBoxContainer/HBoxContainer" unique_id=634410148]
texture_filter = 1 texture_filter = 1
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
@@ -221,36 +224,36 @@ action_mode = 0
shortcut = SubResource("Shortcut_jafqj") shortcut = SubResource("Shortcut_jafqj")
texture_normal = ExtResource("5_31tjv") texture_normal = ExtResource("5_31tjv")
[node name="AddPlayerContainer" type="HBoxContainer" parent="Players/VBoxContainer"] [node name="AddPlayerContainer" type="HBoxContainer" parent="Players/VBoxContainer" unique_id=1371948739]
visible = false visible = false
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
[node name="Panel" type="Panel" parent="Players/VBoxContainer/AddPlayerContainer"] [node name="Panel" type="Panel" parent="Players/VBoxContainer/AddPlayerContainer" unique_id=1569854056]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_qk7sj") theme_override_styles/panel = SubResource("StyleBoxFlat_qk7sj")
[node name="PlayerNameField" type="TextEdit" parent="Players/VBoxContainer/AddPlayerContainer"] [node name="PlayerNameField" type="TextEdit" parent="Players/VBoxContainer/AddPlayerContainer" unique_id=332535327]
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
placeholder_text = "Player name" placeholder_text = "Player name"
script = ExtResource("7_qsdfy") script = ExtResource("7_qsdfy")
[node name="AddPlayerButton" type="Button" parent="Players/VBoxContainer/AddPlayerContainer"] [node name="AddPlayerButton" type="Button" parent="Players/VBoxContainer/AddPlayerContainer" unique_id=245001313]
texture_filter = 1 texture_filter = 1
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
text = "Add" text = "Add"
[node name="Panel2" type="Panel" parent="Players/VBoxContainer/AddPlayerContainer"] [node name="Panel2" type="Panel" parent="Players/VBoxContainer/AddPlayerContainer" unique_id=60215448]
custom_minimum_size = Vector2(2.08165e-12, 40) custom_minimum_size = Vector2(2.08165e-12, 40)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_k1ygi") theme_override_styles/panel = SubResource("StyleBoxFlat_k1ygi")
[node name="ResetPlaylistButton" type="Button" parent="."] [node name="ResetPlaylistButton" type="Button" parent="." unique_id=1754155620]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1359.0 offset_left = 1359.0
@@ -261,7 +264,7 @@ focus_mode = 0
action_mode = 0 action_mode = 0
text = "Reset playlist" text = "Reset playlist"
[node name="ResetPointsButton" type="Button" parent="."] [node name="ResetPointsButton" type="Button" parent="." unique_id=942880776]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1487.0 offset_left = 1487.0
@@ -272,7 +275,7 @@ focus_mode = 0
action_mode = 0 action_mode = 0
text = "Reset points" text = "Reset points"
[node name="SyncButton" type="Button" parent="."] [node name="SyncButton" type="Button" parent="." unique_id=1228313556]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1615.0 offset_left = 1615.0
@@ -283,7 +286,7 @@ focus_mode = 0
action_mode = 0 action_mode = 0
text = "Sync games" text = "Sync games"
[node name="SoundTestButton" type="Button" parent="."] [node name="SoundTestButton" type="Button" parent="." unique_id=1332971879]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1743.0 offset_left = 1743.0
@@ -294,7 +297,7 @@ focus_mode = 0
action_mode = 0 action_mode = 0
text = "Sound test" text = "Sound test"
[node name="ShowAnswerButton" type="Button" parent="."] [node name="ShowAnswerButton" type="Button" parent="." unique_id=415388039]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 65.0 offset_left = 65.0
@@ -306,7 +309,7 @@ action_mode = 0
shortcut = SubResource("Shortcut_a7fvb") shortcut = SubResource("Shortcut_a7fvb")
text = "Show answer" text = "Show answer"
[node name="NextButton" type="Button" parent="."] [node name="NextButton" type="Button" parent="." unique_id=1744703488]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 193.0 offset_left = 193.0
@@ -314,56 +317,79 @@ offset_top = 944.0
offset_right = 368.0 offset_right = 368.0
offset_bottom = 975.0 offset_bottom = 975.0
focus_mode = 0 focus_mode = 0
disabled = true
action_mode = 0 action_mode = 0
shortcut = SubResource("Shortcut_d6fml") shortcut = SubResource("Shortcut_d6fml")
text = "Randomize new track" text = "Randomize new track"
[node name="SearchButton" type="Button" parent="."] [node name="SearchButton" type="Button" parent="." unique_id=1782453581]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1488.0 offset_left = 1354.0
offset_top = 8.0 offset_top = 8.0
offset_right = 1558.0 offset_right = 1424.0
offset_bottom = 48.0 offset_bottom = 48.0
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
shortcut = SubResource("Shortcut_fbju4") shortcut = SubResource("Shortcut_fbju4")
text = "Search" text = "Search"
[node name="SettingsButton" type="Button" parent="."] [node name="SettingsButton" type="Button" parent="." unique_id=1193400323]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1584.0 offset_left = 1442.0
offset_top = 8.0 offset_top = 8.0
offset_right = 1654.0 offset_right = 1512.0
offset_bottom = 48.0 offset_bottom = 48.0
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
text = "Settings" text = "Settings"
[node name="StatisticsButton" type="Button" parent="."] [node name="StatisticsButton" type="Button" parent="." unique_id=2045021269]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1680.0 offset_left = 1530.0
offset_top = 8.0 offset_top = 8.0
offset_right = 1758.0 offset_right = 1600.0
offset_bottom = 48.0 offset_bottom = 48.0
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
text = "Statistics" text = "Statistics"
[node name="AboutButton" type="Button" parent="."] [node name="ShortcutsButton" type="Button" parent="." unique_id=2066498226]
texture_filter = 1 texture_filter = 1
layout_mode = 0 layout_mode = 0
offset_left = 1784.0 offset_left = 1626.0
offset_top = 8.0 offset_top = 8.0
offset_right = 1854.0 offset_right = 1696.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
text = "Shortcuts"
[node name="AboutButton" type="Button" parent="." unique_id=1057035253]
texture_filter = 1
layout_mode = 0
offset_left = 1722.0
offset_top = 8.0
offset_right = 1792.0
offset_bottom = 48.0 offset_bottom = 48.0
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
text = "About" text = "About"
[node name="Search" parent="." instance=ExtResource("9_5ijvr")] [node name="QRButton" type="Button" parent="." unique_id=2021908559]
texture_filter = 1
layout_mode = 0
offset_left = 1802.0
offset_top = 8.0
offset_right = 1872.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
text = "QR"
[node name="Search" parent="." unique_id=1661250375 instance=ExtResource("9_5ijvr")]
visible = false visible = false
layout_mode = 1 layout_mode = 1
offset_left = 56.0 offset_left = 56.0
@@ -371,25 +397,56 @@ offset_top = 96.0
offset_right = 56.0 offset_right = 56.0
offset_bottom = 96.0 offset_bottom = 96.0
[node name="SyncPopupPanel" type="PopupPanel" parent="."] [node name="SyncWindow" parent="." unique_id=182499699 instance=ExtResource("10_yxw0b")]
initial_position = 2 unique_name_in_owner = true
size = Vector2i(140, 70) visible = false
layout_mode = 1
offset_left = 401.0
offset_top = 153.0
offset_right = 401.0
offset_bottom = 153.0
[node name="Label" type="Label" parent="SyncPopupPanel"] [node name="SettingsWindow" parent="." unique_id=1323246978 instance=ExtResource("11_k62u5")]
texture_filter = 1 visible = false
offset_left = 4.0 layout_mode = 1
offset_top = 4.0 offset_left = 720.0
offset_right = 136.0 offset_top = 153.0
offset_bottom = 66.0 offset_right = 720.0
text = "Games synced!" offset_bottom = 153.0
horizontal_alignment = 1
vertical_alignment = 1
[node name="StatisticsPopupPanel" type="PopupPanel" parent="."] [node name="QRWindow" parent="." unique_id=589733821 instance=ExtResource("15_qr_window")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 720.0
offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="NewCharacterSelect" parent="." unique_id=1679856322 instance=ExtResource("6_dhrvg")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 420.0
offset_top = 165.0
offset_right = 1572.0
offset_bottom = 805.0
[node name="ShortcutsWindow" parent="." unique_id=1513416242 instance=ExtResource("13_8eebo")]
unique_name_in_owner = true
visible = false
layout_mode = 1
offset_left = 562.0
offset_top = 160.0
offset_right = 1262.0
offset_bottom = 860.0
[node name="StatisticsPopupPanel" type="PopupPanel" parent="." unique_id=298311407]
oversampling_override = 1.0
initial_position = 2 initial_position = 2
size = Vector2i(450, 100) size = Vector2i(450, 100)
[node name="Label" type="Label" parent="StatisticsPopupPanel"] [node name="Label" type="Label" parent="StatisticsPopupPanel" unique_id=548316493]
texture_filter = 1 texture_filter = 1
offset_left = 4.0 offset_left = 4.0
offset_top = 4.0 offset_top = 4.0
@@ -398,7 +455,7 @@ offset_bottom = 96.0
text = "Statistics" text = "Statistics"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="StatisticsLabel" type="Label" parent="StatisticsPopupPanel"] [node name="StatisticsLabel" type="Label" parent="StatisticsPopupPanel" unique_id=58226477]
texture_filter = 1 texture_filter = 1
offset_left = 4.0 offset_left = 4.0
offset_top = 4.0 offset_top = 4.0
@@ -408,109 +465,55 @@ text = "Total amount of games in the playlist: 9000"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="AboutPopupPanel" type="PopupPanel" parent="."] [node name="AboutWindow" parent="." unique_id=141261008 instance=ExtResource("16_about_window")]
initial_position = 2 unique_name_in_owner = true
size = Vector2i(848, 710) visible = false
layout_mode = 1
offset_left = 720.0
offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="VBoxContainer" type="VBoxContainer" parent="AboutPopupPanel"] [node name="WinnerWindow" parent="." unique_id=999999999 instance=ExtResource("17_winner_window")]
offset_left = 4.0 unique_name_in_owner = true
offset_top = 4.0 visible = false
offset_right = 844.0 layout_mode = 1
offset_bottom = 706.0 offset_left = 720.0
offset_top = 153.0
offset_right = 720.0
offset_bottom = 153.0
[node name="Label" type="Label" parent="AboutPopupPanel/VBoxContainer"] [node name="RepeatSongCheckButton" type="CheckButton" parent="." unique_id=776835053]
texture_filter = 1
layout_mode = 2
text = "Music Player Randomizer"
horizontal_alignment = 1
[node name="VersionLabel" type="Label" parent="AboutPopupPanel/VBoxContainer"]
texture_filter = 1
layout_mode = 2
horizontal_alignment = 1
[node name="AboutLabel" type="Label" parent="AboutPopupPanel/VBoxContainer"]
texture_filter = 1
layout_mode = 2
text = "Try your video game music knowledge with this VGM randomizer, invite your friends and see who is the best."
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="AboutPopupPanel/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="NewLabel" type="Label" parent="AboutPopupPanel/VBoxContainer/HBoxContainer"]
texture_filter = 1
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
text = "0.7-Beta: Can now hop between songs"
autowrap_mode = 2
[node name="ShortcutsLabel" type="Label" parent="AboutPopupPanel/VBoxContainer/HBoxContainer"]
texture_filter = 1
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
[node name="CommingLabel" type="Label" parent="AboutPopupPanel/VBoxContainer/HBoxContainer"]
texture_filter = 1
custom_minimum_size = Vector2(1, 1)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
text = "Fix reset buttons
Fix settings
Fix winner
Fix graphics in lists
Fix layout
Fix for local play
Change some buttons to icons
Add shortcuts"
autowrap_mode = 2
[node name="SettingsPopupPanel" type="PopupPanel" parent="."]
initial_position = 2
size = Vector2i(268, 233)
[node name="SettingsWindow" parent="SettingsPopupPanel" instance=ExtResource("11_k62u5")]
offset_left = 4.0
offset_top = 4.0
offset_right = 264.0
offset_bottom = 354.0
[node name="WinnerPopupPanel" type="PopupPanel" parent="."]
initial_position = 2
size = Vector2i(600, 350)
[node name="WinnerPicture" type="TextureRect" parent="WinnerPopupPanel"]
offset_left = 4.0
offset_top = 4.0
offset_right = 596.0
offset_bottom = 346.0
texture = ExtResource("11_1qef0")
expand_mode = 2
stretch_mode = 4
[node name="WinnerLabel" type="Label" parent="WinnerPopupPanel"]
texture_filter = 1
offset_left = 4.0
offset_top = 4.0
offset_right = 596.0
offset_bottom = 346.0
text = "Sansan won!!"
label_settings = SubResource("LabelSettings_hr75l")
horizontal_alignment = 1
vertical_alignment = 2
[node name="RepeatSongCheckButton" type="CheckButton" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 64.0 offset_left = 64.0
offset_top = 1032.0 offset_top = 1032.0
offset_right = 208.0 offset_right = 208.0
offset_bottom = 1063.0 offset_bottom = 1063.0
focus_mode = 0 focus_mode = 0
button_pressed = true
action_mode = 0 action_mode = 0
text = "Auto repeat" text = "Auto repeat"
[node name="DebugLabel" type="Label" parent="." unique_id=1959221257]
visible = false
layout_mode = 0
offset_left = 974.0
offset_top = 904.0
offset_right = 1014.0
offset_bottom = 927.0
scale = Vector2(3, 3)
text = "DEBUG"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="Log" parent="." unique_id=1289881388 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"] [connection signal="dir_selected" from="FileDialog" to="." method="_on_file_dialog_dir_selected"]
+37 -14
View File
@@ -55,6 +55,7 @@ func _ready() -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if audio_player.has_stream_playback() && !is_changing && !audio_player.stream_paused: if audio_player.has_stream_playback() && !is_changing && !audio_player.stream_paused:
if (!Settings.hide_beginning || audio_player.get_playback_position() > Settings.hide_for_seconds):
progress_slider.value = audio_player.get_playback_position() progress_slider.value = audio_player.get_playback_position()
if stream != null: if stream != null:
music_time_label.text = format_text(progress_slider.value, stream.get_length()) music_time_label.text = format_text(progress_slider.value, stream.get_length())
@@ -67,6 +68,13 @@ func format_time(time: float) -> String:
return mins + ":" + sec return mins + ":" + sec
func format_text(part: float, total: float) -> String: func format_text(part: float, total: float) -> String:
if (Settings.hide_beginning && part <= Settings.hide_for_seconds) && Settings.hide_length:
return "??:?? / ??:??"
elif Settings.hide_length:
return format_time(part) + " / ??:??"
elif Settings.hide_beginning && part < Settings.hide_for_seconds:
return "??:?? / " + format_time(total)
else:
return format_time(part) + " / " + format_time(total) return format_time(part) + " / " + format_time(total)
func play_or_pause() -> void: func play_or_pause() -> void:
@@ -79,6 +87,9 @@ func play_or_pause() -> void:
audio_player.seek(playback_position) audio_player.seek(playback_position)
print("continue") print("continue")
progress_slider.max_value = round(stream.get_length()) progress_slider.max_value = round(stream.get_length())
if Settings.hide_ticks:
progress_slider.tick_count = 0
else:
progress_slider.tick_count = round(stream.get_length() / 60) progress_slider.tick_count = round(stream.get_length() / 60)
else: else:
pause() pause()
@@ -148,45 +159,57 @@ func play_sound(sound_name: AudioStream) -> void:
song_finished = true song_finished = true
play_button.texture_normal = play_icon play_button.texture_normal = play_icon
progress_slider.value = 0 progress_slider.value = 0
if stream != null: #if stream != null:
music_time_label.text = format_text(progress_slider.value, stream.get_length()) # music_time_label.text = format_text(progress_slider.value, stream.get_length())
func play_song(body: PackedByteArray) -> void: func play_song(song: AudioStream) -> void:
var sound: AudioStream = AudioStreamMP3.new() audio_player.stream = song
sound.data = body
audio_player.stream = sound
audio_player.play() audio_player.play()
sound_player.stop() sound_player.stop()
song_finished = false song_finished = false
play_button.texture_normal = pause_icon play_button.texture_normal = pause_icon
stream = audio_player.stream stream = audio_player.stream
progress_slider.value = 0
progress_slider.max_value = round(stream.get_length()) progress_slider.max_value = round(stream.get_length())
if Settings.hide_ticks:
progress_slider.tick_count = 0
else:
progress_slider.tick_count = round(stream.get_length() / 60) progress_slider.tick_count = round(stream.get_length() / 60)
music_time_label.text = format_text(progress_slider.value, stream.get_length())
func play_song_object(song_object_no: int) -> void: func play_song_object(song_object_no: int) -> void:
print("play_song_object") print("play_song_object")
if audio_player.is_playing(): if audio_player.is_playing():
audio_player.stop() audio_player.stop()
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.5).timeout
audio_player.stream = Settings.song_object_array[song_object_no].song audio_player.stream = Playlist.get_song(song_object_no)
sound_player.stop() sound_player.stop()
audio_player.play() audio_player.play()
song_finished = false song_finished = false
play_button.texture_normal = pause_icon play_button.texture_normal = pause_icon
stream = audio_player.stream stream = audio_player.stream
progress_slider.value = 0
progress_slider.max_value = round(stream.get_length()) progress_slider.max_value = round(stream.get_length())
if Settings.hide_ticks:
progress_slider.tick_count = 0
else:
progress_slider.tick_count = round(stream.get_length() / 60) progress_slider.tick_count = round(stream.get_length() / 60)
Settings.currently_playing_song = song_object_no music_time_label.text = format_text(progress_slider.value, stream.get_length())
Settings.unset_is_playing() Playlist.set_currently_playing_song(song_object_no)
Playlist.unset_is_playing()
if !Settings.hide_next_track: if !Settings.hide_next_track:
print("Show answer now!!") print("Show answer now!!")
Settings.song_object_array[song_object_no].is_answered = true Playlist.song_is_answered(song_object_no)
Settings.song_object_array[song_object_no].has_played = true Playlist.song_has_played(song_object_no)
Settings.song_object_array[song_object_no].is_playing = true Playlist.song_is_playing(song_object_no)
update_song_list.emit() update_song_list.emit()
func get_sound_test_song() -> void: 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 ##### LOCAL
var local_path: String = '/Users/sebastian/ResilioSync/Sorterat_test/Metal Gear Solid 4 - Guns of the Patriots/2-16 Metal Gear Saga.mp3' var local_path: String = '/Users/sebastian/ResilioSync/Sorterat_test/Metal Gear Solid 4 - Guns of the Patriots/2-16 Metal Gear Saga.mp3'
@@ -205,4 +228,4 @@ func play_local_song() -> void:
play_sound(load_mp3(local_path)) play_sound(load_mp3(local_path))
func sound_test_local() -> void: func sound_test_local() -> void:
play_sound(preload("res://01. Opening.mp3")) play_sound(preload("res://sounds/01. Opening.mp3"))
+2 -2
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://ds15cgsf8vpvc"] [gd_scene load_steps=10 format=3 uid="uid://ds15cgsf8vpvc"]
[ext_resource type="Script" uid="uid://d1v0rquma6nt8" path="res://MusicPlayer.gd" id="1_t24ra"] [ext_resource type="Script" uid="uid://d1v0rquma6nt8" path="res://MusicPlayer.gd" id="1_t24ra"]
[ext_resource type="AudioStream" uid="uid://n2g8jddr85h2" path="res://01. Opening.mp3" id="2_xti80"] [ext_resource type="AudioStream" uid="uid://n2g8jddr85h2" path="res://sounds/01. Opening.mp3" id="2_xti80"]
[ext_resource type="Texture2D" uid="uid://comxqfiykp54f" path="res://icons/play_icon_light.svg" id="3_6g308"] [ext_resource type="Texture2D" uid="uid://comxqfiykp54f" path="res://icons/play_icon_light.svg" id="3_6g308"]
[ext_resource type="Texture2D" uid="uid://ccb6rvbldlgdg" path="res://icons/reload_light_icon.svg" id="4_jleuo"] [ext_resource type="Texture2D" uid="uid://ccb6rvbldlgdg" path="res://icons/reload_light_icon.svg" id="4_jleuo"]
[ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://volume_slider.tscn" id="5_iifuj"] [ext_resource type="PackedScene" uid="uid://w400rnew7453" path="res://volume_slider.tscn" id="5_iifuj"]
@@ -86,7 +86,7 @@ scrollable = false
[node name="MusicTimeLabel" type="Label" parent="MusicPlayerContainer"] [node name="MusicTimeLabel" type="Label" parent="MusicPlayerContainer"]
layout_mode = 2 layout_mode = 2
text = "1:00 / 3:00" text = "0:00 / 0:00"
[node name="VolumeSlider" parent="MusicPlayerContainer" instance=ExtResource("5_iifuj")] [node name="VolumeSlider" parent="MusicPlayerContainer" instance=ExtResource("5_iifuj")]
custom_minimum_size = Vector2(100, 0) custom_minimum_size = Vector2(100, 0)
+7 -2
View File
@@ -56,15 +56,20 @@ func minus_point() -> void:
func change_character() -> void: func change_character() -> void:
change_character_clicked.emit() change_character_clicked.emit()
func _on_control_character_selected_clicked(file_name: String) -> void: func character_selected(file_name: String) -> void:
print("Back in player list with: " + file_name) print("Back in player list with: " + file_name)
Settings.player_array[id].character = load("res://characters/" + file_name) Settings.player_array[id].character = load("res://characters/" + file_name)
set_player_character() set_player_character()
func new_character_selected(character_texture: ImageTexture) -> void:
print("Back in player list with new")
Settings.player_array[id].character = character_texture
set_player_character()
func set_player_character() -> void: func set_player_character() -> void:
character.custom_minimum_size = Vector2(80, 40) character.custom_minimum_size = Vector2(80, 40)
character.ignore_texture_size = true character.ignore_texture_size = true
character.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT character.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT_CENTERED
character.texture_normal = Settings.player_array[id].character character.texture_normal = Settings.player_array[id].character
func update_score() -> void: func update_score() -> void:
+1 -1
View File
@@ -42,7 +42,7 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_821k2")
custom_minimum_size = Vector2(130, 40) custom_minimum_size = Vector2(130, 40)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 1 size_flags_vertical = 1
text = "Sansansans: 100" text = ": 0"
vertical_alignment = 1 vertical_alignment = 1
[node name="Panel3" type="Panel" parent="HBoxContainer"] [node name="Panel3" type="Panel" parent="HBoxContainer"]
+1 -1
View File
@@ -21,7 +21,7 @@ var is_first_point: bool = true
var character: Texture = load("res://noCharacter.png") var character: Texture = load("res://noCharacter.png")
func _init(new_name: String, new_id: int): func _init(new_name: String, new_id: int) -> void:
player_name = new_name player_name = new_name
id = new_id id = new_id
player_score = 0 player_score = 0
+41
View File
@@ -0,0 +1,41 @@
extends Control
@onready
var qr_panel: Panel = $QRPanel
@onready
var qr_code_rect: QRCodeRect = $QRPanel/QRCodeRect
@onready
var url_label: Label = $QRPanel/URLLabel
func _ready() -> void:
qr_code_rect.light_module_color = Color.WHITE
qr_code_rect.dark_module_color = Color.BLACK
qr_code_rect.quiet_zone_size = 4
# Generate QR code for the search URL
var url: String = Settings.default_path + "/search"
qr_code_rect.data = url
url_label.text = qr_code_rect.data
print("QR code generated for: ", url)
func show_window() -> void:
visible = true
# Regenerate QR code in case settings changed
var url: String = Settings.default_path + "/search"
qr_code_rect.data = url
url_label.text = qr_code_rect.data
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), qr_panel.size).has_point(evLocal.position):
self.visible = false
func hide_window() -> void:
visible = false
+1
View File
@@ -0,0 +1 @@
uid://bsa6xg5xos6h7
+52
View File
@@ -0,0 +1,52 @@
[gd_scene format=3 uid="uid://btupbowehiyyu"]
[ext_resource type="Script" uid="uid://bsa6xg5xos6h7" path="res://QRWindow.gd" id="1_qr_script"]
[ext_resource type="Script" uid="uid://dynulhnyq5hpq" path="res://addons/kenyoni/qr_code/qr_code_rect.gd" id="2_jpsxt"]
[node name="QRControl" type="Control" unique_id=1996957585]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_qr_script")
[node name="QRPanel" type="Panel" parent="." unique_id=1021365843]
unique_name_in_owner = true
layout_mode = 0
offset_right = 450.0
offset_bottom = 520.0
[node name="QRCodeRect" type="TextureRect" parent="QRPanel" unique_id=1054378438]
layout_mode = 0
offset_left = 20.0
offset_top = 20.0
offset_right = 430.0
offset_bottom = 430.0
script = ExtResource("2_jpsxt")
auto_update = true
mode = 4
error_correction = 3
use_eci = true
eci_value = 26
data = ""
auto_version = true
auto_mask_pattern = true
light_module_color = Color(1, 1, 1, 1)
dark_module_color = Color(0, 0, 0, 1)
auto_module_size = false
module_size = 8
quiet_zone_size = 4
metadata/_custom_type_script = "uid://dynulhnyq5hpq"
[node name="URLLabel" type="Label" parent="QRPanel" unique_id=230761497]
unique_name_in_owner = true
layout_mode = 0
offset_left = 20.0
offset_top = 450.0
offset_right = 430.0
offset_bottom = 490.0
text = "URL"
horizontal_alignment = 1
vertical_alignment = 1
+78 -19
View File
@@ -1,27 +1,31 @@
extends Control extends Control
@onready @onready
var search_list := $ScrollContainer/VBoxContainer var search_list: VBoxContainer = $ScrollContainer/VBoxContainer
@onready @onready
var clear_button := $ClearButton var search_panel: Panel = %SearchPanel
@onready @onready
var close_button := $CloseButton var clear_button: Button = $ClearButton
@onready @onready
var search_bar := $Searchbar var close_button: Button = $CloseButton
var games := [] @onready
var search_bar: TextEdit = $Searchbar
var games: Array = []
var regex: RegEx
# 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_list_of_games()
clear_button.pressed.connect(clear) clear_button.pressed.connect(clear)
close_button.pressed.connect(close) close_button.pressed.connect(close)
search_bar.grab_focus() search_bar.grab_focus()
search_bar.text_changed.connect(search) search_bar.text_changed.connect(search)
visibility_changed.connect(focus) visibility_changed.connect(focus)
regex = RegEx.new()
func focus() -> void: func focus() -> void:
if self.visible == true: if self.visible == true:
@@ -35,21 +39,25 @@ func close() -> void:
func search() -> void: func search() -> void:
print(search_bar.text) print(search_bar.text)
Settings.delete_children(search_list) Settings.delete_children(search_list)
var search_text: String = search_bar.text.to_lower()
for game: String in games: 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) add_game(game)
for game: String in games: for game: String in games:
if is_match_contains(clean_term(search_bar.text), clean_term(game)): if is_match_regex(clean_search_text, clean_game(game)):
add_game(game)
for game: String in games:
if is_match_regex(clean_term(search_bar.text), clean_term(game)):
add_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() 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: func is_match_exact(search_term: String, game_name: String) -> bool:
search_term = search_term.to_lower()
game_name = game_name.to_lower() game_name = game_name.to_lower()
if search_term == "": if search_term == "":
@@ -76,7 +84,7 @@ func is_match_regex(search_term: String, game_name: String) -> bool:
return false return false
func add_game(game: String) -> void: func add_game(game: String) -> void:
var label := Label.new() var label: Label = Label.new()
label.text = game label.text = game
print("game: " + game) print("game: " + game)
label.autowrap_mode = TextServer.AUTOWRAP_WORD label.autowrap_mode = TextServer.AUTOWRAP_WORD
@@ -91,20 +99,21 @@ func check_if_game_exists(game: String) -> bool:
return game_exists return game_exists
func compile_regex(search_term: String) -> RegEx: func compile_regex(search_term: String) -> RegEx:
var regex = RegEx.new()
var regText: String = ".*" var regText: String = ".*"
for letter in search_term: for letter: String in search_term:
regText += letter + ".*" regText += letter + ".*"
regex.compile(regText) regex.compile(regText)
return regex return regex
func get_list_of_games() -> void: func get_list_of_games() -> void:
var handle_games = func handle_games(array): print("get_list_of_games")
var handle_games: Callable = func handle_games(array: Array) -> void:
if typeof(array) == TYPE_ARRAY: if typeof(array) == TYPE_ARRAY:
games = [] games = []
Settings.delete_children(search_list)
games.append_array(array) games.append_array(array)
for game in games: for game: String in games:
var label := Label.new() var label: Label = Label.new()
label.text = game label.text = game
label.autowrap_mode = TextServer.AUTOWRAP_WORD label.autowrap_mode = TextServer.AUTOWRAP_WORD
search_list.add_child(label) search_list.add_child(label)
@@ -112,8 +121,58 @@ func get_list_of_games() -> void:
print("Unexpected data") print("Unexpected data")
Settings.make_request2("/music/all/order", handle_games, true) Settings.make_request2("/music/all/order", handle_games, true)
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), search_panel.size).has_point(evLocal.position):
self.visible = false
func clear() -> void: func clear() -> void:
search_bar.text = "" search_bar.text = ""
search() search()
search_bar.grab_focus() 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
+4 -3
View File
@@ -11,7 +11,8 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_m7bij") script = ExtResource("1_m7bij")
[node name="Panel" type="Panel" parent="."] [node name="SearchPanel" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 0 layout_mode = 0
offset_right = 1152.0 offset_right = 1152.0
offset_bottom = 640.0 offset_bottom = 640.0
@@ -30,7 +31,7 @@ text = "Clear"
[node name="CloseButton" type="Button" parent="."] [node name="CloseButton" type="Button" parent="."]
texture_filter = 1 texture_filter = 1
layout_mode = 2 layout_mode = 0
offset_left = 1032.0 offset_left = 1032.0
offset_top = 24.0 offset_top = 24.0
offset_right = 1082.0 offset_right = 1082.0
@@ -51,7 +52,7 @@ scale = Vector2(2, 2)
placeholder_text = "Search" placeholder_text = "Search"
[node name="ScrollContainer" type="ScrollContainer" parent="."] [node name="ScrollContainer" type="ScrollContainer" parent="."]
layout_mode = 2 layout_mode = 0
offset_top = 128.0 offset_top = 128.0
offset_right = 576.0 offset_right = 576.0
offset_bottom = 384.0 offset_bottom = 384.0
+29 -44
View File
@@ -1,59 +1,34 @@
extends Node extends Node
var default_path: String = "https://music.sanplex.tech" const MAX_NUMBER_OF_PLAYERS: int = 7
var default_path: String = "https://music.sanplex.xyz"
var selected_server: int = 0 var selected_server: int = 0
#var default_path: String = "https://tmusic.sanplex.tech"
#var selected_server: int = 1
var is_local: bool = false var is_local: bool = false
var is_debug: bool = false
var stop_after_current: bool = true var stop_after_current: bool = true
var auto_repeat_song: bool = false var auto_repeat_song: bool = true
var hide_next_track: bool = true var hide_next_track: bool = true
var add_to_stats: bool = true var add_to_stats: bool = true
var use_low_played_mode: bool = false var use_low_played_mode: bool = false
var winning_score: int = 20 var winning_score: int = 20
var fullscreen: bool = false var fullscreen: bool = false
var quick_sync: bool = true
var play_local: bool = false var play_local: bool = false
var inspiration_list_speed: int = 1
var hide_for_seconds: float = 5.0
var hide_beginning: bool = false
var hide_length: bool = false
var hide_ticks: bool = false
var player_array: Array[PlayerObject] var player_array: Array[PlayerObject]
var song_object_array: Array[SongObject] = []
var latest_played_song: int = 0
var currently_playing_song: int = -1
var edit_players: bool = false var edit_players: bool = false
var currently_syncing: bool = false
var character_select_open: bool = false
var version: String = "1.5.0" var version: String = "1.8.5"
var whats_new: String = "Changelog:
1.5.0: Made big changes to players and the song list and how the local song list works
0.9.0-Beta: Fixed settings and updated the player view
0.8.0-Beta: Fixed reset buttons and some other small things
0.7.8-Beta: Added shortcuts. Added dialog for winner. Started cleaning code.
0.7.5-Beta: Added settings menu, most things don't do anythig yet
0.7-Beta: Can now hop between songs"
var whats_left: String = "Things left to do:
Fix graphics in lists
Fix layout
Fix for local play
Change some buttons to icons"
var shortcuts: String = "Shortcuts:
Alt + S = Search
Alt + A = Add Players
Alt + Z = Reset
Alt + X = Play/Pause
Alt + C = Next Song
Alt + V = Show Answer
Alt + Enter = Fullscreen
Alt + UP = Volume up
Alt + DOWN = Volume down
Alt + LEFT = Jump back in song
Alt + Ctrl = Restart song
Alt + RIGHT = Jump forward in song
Alt + 1, 2, 3, 4, 5, 6 = Give player point
Alt + Ctrl + 1, 2, 3, 4, 5, 6 = Take point from player"
func make_request2(address: String, func_name: Callable, expect_data: bool) -> void: func make_request2(address: String, func_name: Callable, expect_data: bool) -> void:
var error_handling: Callable = func(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void: var error_handling: Callable = func(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
@@ -73,7 +48,6 @@ func make_request2(address: String, func_name: Callable, expect_data: bool) -> v
elif func_name != null: elif func_name != null:
func_name.call(data_received) func_name.call(data_received)
else: else:
print("song_received")
print("data_received type: ", type_string(typeof(body))) print("data_received type: ", type_string(typeof(body)))
func_name.call(body) func_name.call(body)
@@ -101,6 +75,21 @@ func make_request3(address: String) -> void:
if request_error != OK: if request_error != OK:
push_error("An error occurred in the HTTP request.") push_error("An error occurred in the HTTP request.")
func make_put_request(address: String) -> void:
var error_handling: Callable = func(_result: int, response_code: int, _headers: PackedStringArray, _body: PackedByteArray) -> void:
print("request done to address: ", default_path + address)
if response_code != 200:
print("Error: " + str(response_code))
var http_request: HTTPRequest = HTTPRequest.new()
add_child(http_request)
http_request.request_completed.connect(error_handling)
# Perform a GET request. The URL below returns JSON as of writing.
var headers: PackedStringArray = ["Content-Type: application/json"]
var request_error: int = http_request.request(default_path + address, headers, HTTPClient.METHOD_PUT)
if request_error != OK:
push_error("An error occurred in the HTTP request.")
func delete_children(node: Node) -> void: func delete_children(node: Node) -> void:
for n: Node in node.get_children(): for n: Node in node.get_children():
node.remove_child(n) node.remove_child(n)
@@ -117,7 +106,3 @@ func delete_player_children(node: Node) -> void:
else: else:
node.remove_child(n) node.remove_child(n)
n.queue_free() n.queue_free()
func unset_is_playing() -> void:
for song_object: SongObject in song_object_array:
song_object.is_playing = false
+147 -26
View File
@@ -1,61 +1,122 @@
extends VBoxContainer extends Control
@onready @onready
var stop_after_current_button := $StopAfterCurrentCheckButton var settings_panel: Panel = %SettingsPanel
@onready @onready
var hide_next_track_button := $HideNextTrackCheckButton var stop_after_current_button: CheckButton = %StopAfterCurrentCheckButton
@onready @onready
var add_to_database_button := $AddToDatabaseCheckButton var hide_next_track_button: CheckButton = %HideNextTrackCheckButton
@onready @onready
var low_played_button := $LowPlayedCheckButton var add_to_database_button: CheckButton = %AddToDatabaseCheckButton
@onready @onready
var score_label := $HBoxContainer/ScoreLabel var low_played_button: CheckButton = %LowPlayedCheckButton
@onready @onready
var lower_winning_score_button := $HBoxContainer/LowerButton var hide_beginning_button: CheckButton = %HideBeginningCheckButton
@onready @onready
var increase_winning_score_button := $HBoxContainer/IncreaseButton var hide_length_button: CheckButton = %HideLengthCheckButton
@onready @onready
var select_server_button := $SelectServerButton var hide_ticks_button: CheckButton = %HideTicksCheckButton
@onready @onready
var fullscreen_button := $FullscreenButton var score_label: Label = %ScoreLabel
@onready @onready
var quick_sync_button := $QuickSyncButton var lower_winning_score_button: Button = %LowerButton
@onready @onready
var local_button := $LocalButton var increase_winning_score_button: Button = %IncreaseButton
@onready
var cache_label: Label = %CacheLabel
@onready
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 hide_for_seconds_label: Label = %HideForSecondsLabel
@onready
var lower_hide_for_seconds_button: Button = %LowerHideForSecondsButton
@onready
var increase_hide_for_seconds_button: Button = %IncreaseHideForSecondsButton
@onready
var select_server_button: OptionButton = %SelectServerButton
@onready
var fullscreen_button: CheckButton = %FullscreenButton
@onready
var local_button: CheckButton = %LocalButton
signal server_changed
# 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(): func _ready() -> void:
fullscreen_button.button_pressed = Settings.fullscreen
select_server_button.selected = Settings.selected_server
stop_after_current_button.pressed.connect(stop_after_current) stop_after_current_button.pressed.connect(stop_after_current)
hide_next_track_button.pressed.connect(hide_next_track) hide_next_track_button.pressed.connect(hide_next_track)
add_to_database_button.pressed.connect(add_to_database) add_to_database_button.pressed.connect(add_to_database)
low_played_button.pressed.connect(low_played) low_played_button.pressed.connect(low_played)
hide_beginning_button.pressed.connect(hide_beginning)
hide_length_button.pressed.connect(hide_length)
hide_ticks_button.pressed.connect(hide_ticks)
lower_winning_score_button.pressed.connect(lower_winning_score) lower_winning_score_button.pressed.connect(lower_winning_score)
increase_winning_score_button.pressed.connect(increase_winning_score) increase_winning_score_button.pressed.connect(increase_winning_score)
#select_server_button.pressed.connect(select_server) 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)
lower_hide_for_seconds_button.pressed.connect(lower_hide_for_seconds)
increase_hide_for_seconds_button.pressed.connect(increase_hide_for_seconds)
fullscreen_button.pressed.connect(fullscreen) fullscreen_button.pressed.connect(fullscreen)
quick_sync_button.pressed.connect(quick_sync)
local_button.pressed.connect(local_play) local_button.pressed.connect(local_play)
stop_after_current_button.button_pressed = Settings.stop_after_current stop_after_current_button.button_pressed = Settings.stop_after_current
hide_next_track_button.button_pressed = Settings.hide_next_track hide_next_track_button.button_pressed = Settings.hide_next_track
add_to_database_button.button_pressed = Settings.add_to_stats add_to_database_button.button_pressed = Settings.add_to_stats
low_played_button.button_pressed = Settings.use_low_played_mode low_played_button.button_pressed = Settings.use_low_played_mode
hide_beginning_button.button_pressed = Settings.hide_beginning
hide_length_button.button_pressed = Settings.hide_length
hide_ticks_button.button_pressed = Settings.hide_ticks
score_label.text = str(Settings.winning_score) 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)
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
fullscreen_button.button_pressed = Settings.fullscreen fullscreen_button.button_pressed = Settings.fullscreen
quick_sync_button.button_pressed = Settings.quick_sync update_hide_for_seconds_enabled()
select_server_button.select(Settings.selected_server) select_server_button.select(Settings.selected_server)
select_server_button.item_selected.connect(select_server) select_server_button.item_selected.connect(select_server)
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), settings_panel.size).has_point(evLocal.position):
self.visible = false
func fullscreen() -> void: func fullscreen() -> void:
Settings.fullscreen = !Settings.fullscreen Settings.fullscreen = !Settings.fullscreen
if Settings.fullscreen == true: if Settings.fullscreen == true:
@@ -63,36 +124,96 @@ func fullscreen() -> void:
if Settings.fullscreen == false: if Settings.fullscreen == false:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
func quick_sync() -> void: func local_play() -> void:
Settings.quick_sync = !Settings.quick_sync
func local_play():
Settings.play_local = !Settings.play_local Settings.play_local = !Settings.play_local
func stop_after_current(): func stop_after_current() -> void:
Settings.stop_after_current = !Settings.stop_after_current Settings.stop_after_current = !Settings.stop_after_current
func hide_next_track(): func hide_next_track() -> void:
Settings.hide_next_track = !Settings.hide_next_track Settings.hide_next_track = !Settings.hide_next_track
func add_to_database(): func add_to_database() -> void:
Settings.add_to_stats = !Settings.add_to_stats Settings.add_to_stats = !Settings.add_to_stats
func low_played(): func low_played() -> void:
Settings.use_low_played_mode = !Settings.use_low_played_mode Settings.use_low_played_mode = !Settings.use_low_played_mode
func lower_winning_score(): func hide_beginning() -> void:
Settings.hide_beginning = !Settings.hide_beginning
update_hide_for_seconds_enabled()
func update_hide_for_seconds_enabled() -> void:
var enabled: bool = Settings.hide_beginning
%HideForSecondsHBoxContainer.visible = enabled
func hide_length() -> void:
Settings.hide_length = !Settings.hide_length
func hide_ticks() -> void:
Settings.hide_ticks = !Settings.hide_ticks
func lower_winning_score() -> void:
Settings.winning_score -= 1 Settings.winning_score -= 1
score_label.text = str(Settings.winning_score) score_label.text = str(Settings.winning_score)
func increase_winning_score(): func increase_winning_score() -> void:
Settings.winning_score += 1 Settings.winning_score += 1
score_label.text = str(Settings.winning_score) 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:
Playlist.number_of_tracks_to_preload = 1
cache_label.text = str(Playlist.number_of_tracks_to_preload)
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 lower_hide_for_seconds() -> void:
Settings.hide_for_seconds -= 1.0
if Settings.hide_for_seconds < 0:
Settings.hide_for_seconds = 0
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
func increase_hide_for_seconds() -> void:
Settings.hide_for_seconds += 1.0
if Settings.hide_for_seconds > 10.0:
Settings.hide_for_seconds = 10.0
hide_for_seconds_label.text = str(Settings.hide_for_seconds)
func select_server(new_server: int) -> void: func select_server(new_server: int) -> void:
print("select_server")
Settings.default_path = select_server_button.get_item_text(new_server) Settings.default_path = select_server_button.get_item_text(new_server)
Settings.selected_server = new_server Settings.selected_server = new_server
print("Settings.default_path: " + Settings.default_path) print("Settings.default_path: " + Settings.default_path)
print("Settings.selected_server: " + str(Settings.selected_server)) print("Settings.selected_server: " + str(Settings.selected_server))
print("new_server: " + str(new_server)) print("new_server: " + str(new_server))
print("select_server_button.get_item_text(new_server): " + select_server_button.get_item_text(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)
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()
+164 -29
View File
@@ -1,105 +1,240 @@
[gd_scene load_steps=3 format=3 uid="uid://dldpeo5y3l5hq"] [gd_scene format=3 uid="uid://dldpeo5y3l5hq"]
[ext_resource type="Script" uid="uid://dukqyjoduf1af" path="res://SettingsWindow.gd" id="1_bt55j"] [ext_resource type="Script" uid="uid://dukqyjoduf1af" path="res://SettingsWindow.gd" id="1_bt55j"]
[sub_resource type="LabelSettings" id="LabelSettings_3xrlm"] [sub_resource type="LabelSettings" id="LabelSettings_3xrlm"]
font_size = 25 font_size = 25
[node name="VBoxContainer" type="VBoxContainer"] [node name="SettingsControl" type="Control" unique_id=1298840328]
clip_contents = true layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1_bt55j") script = ExtResource("1_bt55j")
[node name="Label" type="Label" parent="."] [node name="SettingsPanel" type="Panel" parent="." unique_id=45537159]
unique_name_in_owner = true
layout_mode = 0
offset_right = 500.0
offset_bottom = 640.0
[node name="ScrollContainer" type="ScrollContainer" parent="SettingsPanel" unique_id=1325795358]
layout_mode = 0
offset_right = 500.0
offset_bottom = 640.0
[node name="VBoxContainer" type="VBoxContainer" parent="SettingsPanel/ScrollContainer" unique_id=1796635163]
clip_contents = true
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1111531402]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 0 size_flags_vertical = 0
text = "Settings" text = "Settings"
label_settings = SubResource("LabelSettings_3xrlm") label_settings = SubResource("LabelSettings_3xrlm")
horizontal_alignment = 1 horizontal_alignment = 1
[node name="StopAfterCurrentCheckButton" type="CheckButton" parent="."] [node name="StopAfterCurrentCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=508305575]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
button_pressed = true button_pressed = true
action_mode = 0 action_mode = 0
text = "Stop after current" text = "Stop after current"
[node name="HideNextTrackCheckButton" type="CheckButton" parent="."] [node name="HideNextTrackCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1568244599]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
button_pressed = true button_pressed = true
action_mode = 0 action_mode = 0
text = "Hide next track" text = "Hide next track"
[node name="AddToDatabaseCheckButton" type="CheckButton" parent="."] [node name="AddToDatabaseCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1673750542]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
action_mode = 0 action_mode = 0
text = "Turn on played to database" text = "Turn on played to database"
[node name="LowPlayedCheckButton" type="CheckButton" parent="."] [node name="LowPlayedCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1672657048]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
action_mode = 0 action_mode = 0
text = "Use low played mode" text = "Use low played mode"
[node name="HBoxContainer" type="HBoxContainer" parent="."] [node name="HideBeginningCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1370617867]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
action_mode = 0
text = "Hide beginning of songs"
[node name="HideForSecondsHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1368485120]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
[node name="Label2" type="Label" parent="HBoxContainer"] [node name="HideForSecondsTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1822369383]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "Winning Score: " text = "Hide Start Seconds: "
[node name="ScoreLabel" type="Label" parent="HBoxContainer"] [node name="HideForSecondsLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1580108945]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "20" text = "5.0"
[node name="LowerButton" type="Button" parent="HBoxContainer"] [node name="LowerHideForSecondsButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=180643442]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12) custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
text = "-1" text = "-1"
[node name="IncreaseButton" type="Button" parent="HBoxContainer"] [node name="IncreaseHideForSecondsButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=340681770]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 2.08165e-12) custom_minimum_size = Vector2(30, 2.08165e-12)
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
action_mode = 0 action_mode = 0
text = "+1" text = "+1"
[node name="SelectServerButton" type="OptionButton" parent="."] [node name="HideLengthCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=67806372]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
action_mode = 0
text = "Hide length of songs"
[node name="HideTicksCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=706322752]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
action_mode = 0
text = "Hide ticks in playbar"
[node name="HBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=2140610992]
layout_mode = 2
[node name="Label2" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=1892907487]
layout_mode = 2
text = "Winning Score: "
[node name="ScoreLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=444542662]
unique_name_in_owner = true
layout_mode = 2
text = "20"
[node name="LowerButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=614806355]
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="IncreaseButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer" unique_id=1837169457]
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="CacheHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=658210492]
layout_mode = 2
[node name="CacheTitleLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=365012193]
layout_mode = 2
text = "Predownload songs: "
[node name="CacheLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1558370172]
unique_name_in_owner = true
layout_mode = 2
text = "1"
[node name="LowerCacheButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1990385038]
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="IncreaseCacheButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer" unique_id=1806295533]
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="InspirationHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1686756540]
layout_mode = 2
[node name="InspirationListSpeedTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=1397861506]
layout_mode = 2
text = "Inspiration List Speed: "
[node name="InspirationListSpeedLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=867387668]
unique_name_in_owner = true
layout_mode = 2
text = "1"
[node name="LowerInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer" unique_id=845209534]
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_id=1122701153]
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_id=434350694]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
selected = 0 selected = 0
item_count = 4 item_count = 5
popup/item_0/text = "https://music.sanplex.tech" popup/item_0/text = "https://music.sanplex.xyz"
popup/item_0/id = 1 popup/item_0/id = 1
popup/item_1/text = "https://tmusic.sanplex.tech" popup/item_1/text = "https://tmusic.sanplex.xyz"
popup/item_1/id = 1 popup/item_1/id = 2
popup/item_2/text = "http://192.168.86.100:8085" popup/item_2/text = "https://rmusic.sanplex.xyz"
popup/item_2/id = 2 popup/item_2/id = 3
popup/item_3/text = "http://localhost:8080" popup/item_3/text = "https://old-music.sanplex.xyz"
popup/item_3/id = 3 popup/item_3/id = 4
popup/item_4/text = "http://localhost:8080"
popup/item_4/id = 5
[node name="FullscreenButton" type="CheckButton" parent="."] [node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=400304684]
unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
text = "Fullscreen" text = "Fullscreen"
[node name="QuickSyncButton" type="CheckButton" parent="."] [node name="QuickSyncButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=49497448]
visible = false
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
button_pressed = true button_pressed = true
action_mode = 0 action_mode = 0
text = "Quick sync" text = "Quick sync"
[node name="LocalButton" type="CheckButton" parent="."] [node name="LocalButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=905844805]
unique_name_in_owner = true
visible = false
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
disabled = true disabled = true
+4 -2
View File
@@ -31,7 +31,10 @@ func get_song_title() -> String:
return "??????" return "??????"
func get_song_info() -> String: func get_song_info() -> String:
if is_answered: if Settings.is_debug:
var format_string: String = "%d. %s - %s | played: %s | answered: %s"
return format_string % [(song_number + 1), game_title, song_title, has_played, is_answered]
elif is_answered:
var format_string: String = "%d. %s - %s" var format_string: String = "%d. %s - %s"
return format_string % [(song_number + 1), game_title, song_title] return format_string % [(song_number + 1), game_title, song_title]
else: else:
@@ -39,7 +42,6 @@ func get_song_info() -> String:
func add_point(id: int) -> void: func add_point(id: int) -> void:
print("add_point") print("add_point")
if !players_given_point.has(id):
players_given_point.append(id) players_given_point.append(id)
players_given_point.sort() players_given_point.sort()
+150
View File
@@ -0,0 +1,150 @@
[gd_scene load_steps=3 format=3 uid="uid://dpdem7pdxweb5"]
[ext_resource type="Script" uid="uid://c3ejukwth512a" path="res://sync_window.gd" id="1_8ba47"]
[sub_resource type="LabelSettings" id="LabelSettings_anbfi"]
font_size = 25
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_8ba47")
[node name="SyncPanel" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_right = 1152.0
offset_bottom = 640.0
[node name="ScrollContainer" type="ScrollContainer" parent="SyncPanel"]
layout_mode = 0
offset_right = 1152.0
offset_bottom = 640.0
[node name="SyncVBoxContainer" type="VBoxContainer" parent="SyncPanel/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="SyncTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
text = "Sync"
label_settings = SubResource("LabelSettings_anbfi")
horizontal_alignment = 1
[node name="NoChangesLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_vertical = 0
text = "No changes since last sync"
label_settings = SubResource("LabelSettings_anbfi")
horizontal_alignment = 1
[node name="ProgressHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="SyncProgressBar" type="ProgressBar" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/ProgressHBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(1000, 0)
layout_mode = 2
size_flags_horizontal = 6
step = 1.0
rounded = true
[node name="SyncHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 4
theme_override_constants/separation = 30
[node name="VSeparator6" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
layout_mode = 2
[node name="GamesAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesAddedVBox"]
layout_mode = 2
text = "GamesAdded"
horizontal_alignment = 1
[node name="GamesAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesReAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesReAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesReAddedVBox"]
layout_mode = 2
text = "GamesReAdded"
[node name="GamesReAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesChangedTitleVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesChangedTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesChangedTitleVBox"]
layout_mode = 2
text = "GamesChangedTitle"
[node name="GamesChangedTitleSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesChangedContentVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesChangedContentLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesChangedContentVBox"]
layout_mode = 2
text = "GamesChangedContent"
[node name="GamesChangedContentSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesRemovedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="GamesRemovedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesRemovedVBox"]
layout_mode = 2
text = "GamesRemoved"
[node name="GamesRemovedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="SyncTime" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Sync time: "
horizontal_alignment = 1
[node name="CatchedErrorsVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="CatchedErrorsLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/CatchedErrorsVBox"]
layout_mode = 2
text = "CatchedErrors"
horizontal_alignment = 1
[node name="SyncTimer" type="Timer" parent="."]
unique_name_in_owner = true
+54
View File
@@ -0,0 +1,54 @@
[gd_scene format=3 uid="uid://cxlsmxnrp0agh"]
[ext_resource type="Script" uid="uid://dxpb22xbwf3t1" path="res://winner_window.gd" id="1_winner_script"]
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="2_no_character"]
[sub_resource type="LabelSettings" id="LabelSettings_hr75l"]
font_size = 35
[node name="WinnerControl" type="Control" unique_id=1111111111]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_winner_script")
[node name="WinnerPanel" type="Panel" parent="." unique_id=89212869]
unique_name_in_owner = true
layout_mode = 0
offset_right = 500.0
offset_bottom = 600.0
[node name="VBoxContainer" type="VBoxContainer" parent="WinnerPanel" unique_id=471159349]
layout_mode = 0
offset_top = 25.0
offset_right = 500.0
offset_bottom = 282.0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
[node name="WinnerPicture" type="TextureRect" parent="WinnerPanel/VBoxContainer" unique_id=1543774067]
unique_name_in_owner = true
custom_minimum_size = Vector2(480, 200)
layout_mode = 2
texture = ExtResource("2_no_character")
expand_mode = 3
stretch_mode = 5
[node name="WinnerLabel" type="Label" parent="WinnerPanel/VBoxContainer" unique_id=1437597286]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
text = "Winner!"
label_settings = SubResource("LabelSettings_hr75l")
horizontal_alignment = 1
vertical_alignment = 2
[node name="PlayersList" type="VBoxContainer" parent="WinnerPanel/VBoxContainer" unique_id=471159350]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
+7
View File
@@ -0,0 +1,7 @@
Copyright 2022-present Iceflower S (iceflower@gmx.de)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+75
View File
@@ -0,0 +1,75 @@
extends RefCounted
var _data: PackedByteArray = []
func duplicate():
var dup = new()
dup._data = self._data.duplicate()
return dup
func resize(size: int) -> void:
self._data.resize(size)
func size() -> int:
return self._data.size()
func clear() -> void:
return self._data.clear()
func get_array() -> PackedByteArray:
return self._data
func to_byte_array() -> PackedByteArray:
var byte_arr: PackedByteArray = []
var cur_byte: int = 0
for idx: int in range(self._data.size()):
var byte_idx: int = 7 - idx & 7
if self._data[idx]:
cur_byte |= (1 << byte_idx)
if (idx != 0 && byte_idx == 0) || idx == self._data.size() - 1:
byte_arr.append(cur_byte)
cur_byte = 0
return byte_arr
func prepend_bit(bit: bool) -> void:
self._data.insert(0, int(bit))
func append_bit(bit: bool) -> void:
self._data.append(int(bit))
func append_stream(stream) -> void:
self._data.append_array(stream.get_array())
func append_byte_array(arr: PackedByteArray) -> void:
for val: int in arr:
self.append(val, 8)
func prepend(value: int, total_bits: int) -> void:
for idx: int in range(total_bits - 1, -1, -1):
self._data.insert(0, int((value & (1 << idx)) != 0))
func append(value: int, total_bits: int) -> void:
for idx: int in range(total_bits - 1, -1, -1):
self._data.append(int((value & (1 << idx)) != 0))
func set_bit(idx: int, bit: bool) -> void:
self._data[idx] = int(bit)
func get_bit(idx: int) -> bool:
return bool(self._data[idx])
func _to_string() -> String:
var val: String = ""
for idx: int in range(self._data.size()):
if (idx + 1) & 7 == 1:
val += "["
val += str(self._data[idx])
if (idx + 1) & 7 == 0:
val += "]"
if (idx + 1) & 3 == 0:
val += " "
val = val.strip_edges()
if val[-1] != "]":
val += "]"
return val
+1
View File
@@ -0,0 +1 @@
uid://dyt1tls86b518
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
version="1.1"
viewBox="0 0 16 16"
id="svg4"
xmlns="http://www.w3.org/2000/svg"
>
<defs
id="defs4" />
<path
id="rect4"
style="fill:#8eef97;fill-opacity:1;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="M 0,0 V 6 H 6 V 0 Z M 1,1 H 5 V 5 H 1 Z" />
<path
id="rect4-4-4"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
transform="rotate(90)"
d="m 2,-4 h 2 v 2 H 2 Z" />
<path
id="rect4-9"
style="fill:#8eef97;fill-opacity:1;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 10,0 v 6 h 6 V 0 Z m 1,1 h 4 v 4 h -4 z" />
<path
id="rect4-4-4-7"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
transform="rotate(90)"
d="m 2,-14 h 2 v 2 H 2 Z" />
<path
id="rect4-90"
style="fill:#8eef97;fill-opacity:1;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 0,10 v 6 h 6 v -6 z m 1,1 h 4 v 4 H 1 Z" />
<path
id="rect4-4-4-8"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
transform="rotate(90)"
d="m 12,-4 h 2 v 2 h -2 z" />
<path
id="rect5"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 10,12 h 2 v 2 h -2 z" />
<path
id="rect5-31"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 14,8 h 2 v 2 h -2 z" />
<path
id="rect5-3"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 8,14 h 2 v 2 H 8 Z" />
<path
id="rect5-0"
style="fill:#8eef97;fill-opacity:1;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 14,12 v 2 h -2 v 2 h 4 v -4 z" />
<path
id="rect5-0-2-7"
style="fill:#8eef97;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 12,10 h 2 v 2 h -2 z" />
<path
id="rect5-5"
style="fill:#8eef97;fill-opacity:1;fill-rule:evenodd;stroke-width:32;paint-order:fill markers stroke"
d="m 8,8 v 4 h 2 v -2 h 2 V 8 Z" />
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+43
View File
@@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cn383mw8drmm5"
path="res://.godot/imported/icon.svg-f2b8283af99fea807d6be2c96605b944.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/kenyoni/qr_code/icon.svg"
dest_files=["res://.godot/imported/icon.svg-f2b8283af99fea807d6be2c96605b944.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
+20
View File
@@ -0,0 +1,20 @@
[plugin]
name="QR Code"
description="QR Code generator."
author="Kenyoni Software"
version="2.0.0"
script="plugin.gd"
license="MIT"
repository="https://github.com/kenyoni-software/godot-addons"
keywords=[
"node",
"tool"
]
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License"
]
[plugin.dependencies]
godot=">=4.4"
+10
View File
@@ -0,0 +1,10 @@
@tool
extends EditorPlugin
const QrCodeRect := preload("res://addons/kenyoni/qr_code/qr_code_rect.gd")
func _enter_tree() -> void:
self.add_custom_type("QRCodeRect", "TextureRect", QrCodeRect, preload("res://addons/kenyoni/qr_code/icon.svg"))
func _exit_tree() -> void:
self.remove_custom_type("QRCodeRect")
+1
View File
@@ -0,0 +1 @@
uid://bepdve2jn8q0i
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
uid://c7aw4f3o7g8sc
+415
View File
@@ -0,0 +1,415 @@
@tool
@icon("res://addons/kenyoni/qr_code/icon.svg")
extends TextureRect
class_name QRCodeRect
const QRCode := preload("res://addons/kenyoni/qr_code/qr_code.gd")
const ShiftJIS := preload("res://addons/kenyoni/qr_code/shift_jis.gd")
var mode: QRCode.Mode:
set = set_mode,
get = get_mode
var error_correction: QRCode.ErrorCorrection:
set = set_error_correction,
get = get_error_correction
## Use Extended Channel Interpretation (ECI).
var use_eci: bool:
set = set_use_eci,
get = get_use_eci
## Extended Channel Interpretation (ECI) Value.
var eci_value: int:
set = set_eci_value,
get = get_eci_value
var data: Variant = "":
set = set_data,
get = get_data
## Automatically update the QR Code when a property changes.
var auto_update: bool = true:
set = set_auto_update
## Use automatically the smallest version possible.
var auto_version: bool = true:
set = set_auto_version,
get = get_auto_version
var version: int = 1:
set = set_version,
get = get_version
## Use automatically the best mask pattern.
var auto_mask_pattern: bool = true:
set = set_auto_mask_pattern,
get = get_auto_mask_pattern
## Used mask pattern.
var mask_pattern: int = 0:
set = set_mask_pattern,
get = get_mask_pattern
var light_module_color: Color = Color.WHITE:
set = set_light_module_color
var dark_module_color: Color = Color.BLACK:
set = set_dark_module_color
## Automatically set the module pixel size based on the size.
## Do not use expand mode KEEP_SIZE when using it.
## Turn this off when the QR Code is resized often, as it impacts the performance quite heavily.
var auto_module_size: bool = true:
set = set_auto_module_size
## Use that many pixel for one module.
## If auto_module_size is set, this value might by only occasionally updated. In this case do not rely on it.
var module_size: int = 1:
set = set_module_size
## Use that many modules for the quiet zone. A value of 4 is recommended.
var quiet_zone_size: int = 4:
set = set_quiet_zone_size
var _qr: QRCode = QRCode.new()
var _update_fn: Callable = self.update
var _cached_data: PackedByteArray = PackedByteArray()
func set_mode(new_mode: QRCode.Mode) -> void:
self._qr.mode = new_mode
self.notify_property_list_changed()
if self.auto_update:
self.update()
func get_mode() -> QRCode.Mode:
return self._qr.mode
func set_error_correction(new_error_correction: QRCode.ErrorCorrection) -> void:
self._qr.error_correction = new_error_correction
if self.auto_update:
self.update()
func get_error_correction() -> QRCode.ErrorCorrection:
return self._qr.error_correction
func set_use_eci(new_use_eci: bool) -> void:
self._qr.use_eci = new_use_eci
self.notify_property_list_changed()
if self.auto_update:
self.update()
func get_use_eci() -> bool:
return self._qr.use_eci
func set_eci_value(new_eci_value: int) -> void:
if self._qr.eci_value == new_eci_value:
return
self._qr.eci_value = new_eci_value
self.notify_property_list_changed()
if self.auto_update:
self.update()
func get_eci_value() -> int:
return self._qr.eci_value
func set_data(new_data: Variant) -> void:
match self._qr.mode:
QRCode.Mode.NUMERIC:
self._qr.put_numeric(new_data)
QRCode.Mode.ALPHANUMERIC:
self._qr.put_alphanumeric(new_data)
QRCode.Mode.BYTE:
if typeof(new_data) == TYPE_PACKED_BYTE_ARRAY || ! self.use_eci:
self._qr.put_byte(new_data)
return
match self.eci_value:
QRCode.ECI.ISO_8859_1:
self._qr.put_byte(new_data.to_ascii_buffer())
QRCode.ECI.SHIFT_JIS:
self._qr.put_byte(ShiftJIS.to_shift_jis_2004_buffer(new_data))
QRCode.ECI.UTF_8:
self._qr.put_byte(new_data.to_utf8_buffer())
QRCode.ECI.UTF_16:
self._qr.put_byte(new_data.to_utf16_buffer())
QRCode.ECI.US_ASCII:
self._qr.put_byte(new_data.to_ascii_buffer())
_:
self._qr.put_byte(new_data)
QRCode.Mode.KANJI:
self._qr.put_kanji(new_data)
if self.auto_update:
self.update()
func get_data() -> Variant:
var input_data: Variant = self._qr.get_input_data()
if self.mode == QRCode.Mode.BYTE && self.use_eci:
match self.eci_value:
QRCode.ECI.ISO_8859_1:
return input_data.get_string_from_ascii()
QRCode.ECI.SHIFT_JIS:
return ShiftJIS.get_string_from_shift_jis_2004(input_data)
QRCode.ECI.UTF_8:
return input_data.get_string_from_utf8()
QRCode.ECI.UTF_16:
return input_data.get_string_from_utf16()
QRCode.ECI.US_ASCII:
return input_data.get_string_from_ascii()
return self._qr.get_input_data()
func set_auto_update(new_auto_update: bool) -> void:
if auto_update == new_auto_update:
return
auto_update = new_auto_update
self.notify_property_list_changed()
if auto_update:
self.update()
func set_auto_version(new_auto_version: bool) -> void:
if self._qr.auto_version == new_auto_version:
return
self._qr.auto_version = new_auto_version
self.notify_property_list_changed()
if self.auto_update:
self.update()
func get_auto_version() -> bool:
return self._qr.auto_version
func set_version(new_version: int) -> void:
if self.auto_version || self._qr.version == new_version:
return
self._qr.version = new_version
if self.auto_update:
self.update()
func get_version() -> int:
return self._qr.version
func set_auto_mask_pattern(new_auto_mask_pattern: bool) -> void:
if self._qr.auto_mask_pattern == new_auto_mask_pattern:
return
self._qr.auto_mask_pattern = new_auto_mask_pattern
self.notify_property_list_changed()
if self.auto_update:
self.update()
func get_auto_mask_pattern() -> bool:
return self._qr.auto_mask_pattern
func set_mask_pattern(new_mask_pattern: int) -> void:
if self.auto_mask_pattern || self._qr.mask_pattern == new_mask_pattern:
return
self._qr.mask_pattern = new_mask_pattern
if self.auto_update:
self.update()
func get_mask_pattern() -> int:
return self._qr.mask_pattern
func set_light_module_color(new_light_module_color: Color) -> void:
if light_module_color == new_light_module_color:
return
light_module_color = new_light_module_color
if self.auto_update:
self._update_texture()
func set_dark_module_color(new_dark_module_color: Color) -> void:
if dark_module_color == new_dark_module_color:
return
dark_module_color = new_dark_module_color
if self.auto_update:
self._update_texture()
func set_auto_module_size(new_auto_module_size: bool) -> void:
if auto_module_size == new_auto_module_size:
return
auto_module_size = new_auto_module_size
self.notify_property_list_changed()
self.update_configuration_warnings()
if self.auto_update:
self._update_texture()
func set_module_size(new_module_size: int) -> void:
if module_size == new_module_size:
return
module_size = new_module_size
# if not auto it was set directly
if ! self.auto_module_size && self.auto_update:
self._update_texture()
func set_quiet_zone_size(new_quiet_zone_size: int) -> void:
if quiet_zone_size == new_quiet_zone_size:
return
quiet_zone_size = maxi(0, new_quiet_zone_size)
if self.auto_module_size && self.auto_update:
self._update_texture()
elif self.auto_module_size:
self._update_module_size()
func _ready() -> void:
if self.texture != null && self.auto_update:
self.update()
func update() -> void:
self._cached_data = self._qr.encode()
self._update_texture()
func _set(property: StringName, value: Variant) -> bool:
if property == "expand_mode":
self.update_configuration_warnings()
return false
func _get_property_list() -> Array[Dictionary]:
var data_prop: Dictionary = {
"name": "data",
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
}
match self.mode:
QRCode.Mode.NUMERIC:
data_prop["type"] = TYPE_STRING
QRCode.Mode.ALPHANUMERIC, QRCode.Mode.KANJI:
data_prop["type"] = TYPE_STRING
data_prop["hint"] = PROPERTY_HINT_MULTILINE_TEXT
QRCode.Mode.BYTE:
# these encoding is natively supported
if self.use_eci && self.eci_value in [QRCode.ECI.ISO_8859_1, QRCode.ECI.SHIFT_JIS, QRCode.ECI.UTF_8, QRCode.ECI.UTF_16, QRCode.ECI.US_ASCII]:
data_prop["type"] = TYPE_STRING
data_prop["hint"] = PROPERTY_HINT_MULTILINE_TEXT
else:
data_prop["type"] = TYPE_PACKED_BYTE_ARRAY
return [
{
"name": "_update_fn",
"type": TYPE_CALLABLE,
"usage": PROPERTY_USAGE_NONE if self.auto_update else PROPERTY_USAGE_EDITOR,
"hint": PROPERTY_HINT_TOOL_BUTTON,
"hint_string": "Update"
},
{
"name": "auto_update",
"type": TYPE_BOOL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "mode",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
"hint": PROPERTY_HINT_ENUM,
"hint_string": "Numeric:1,Alphanumeric:2,Byte:4,Kanji:8"
},
{
"name": "error_correction",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
"hint": PROPERTY_HINT_ENUM,
"hint_string": "Low:1,Medium:0,Quartile:3,High:2"
},
{
"name": "use_eci",
"type": TYPE_BOOL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "eci_value",
"type": TYPE_INT,
"usage": (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE) if self.use_eci else (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY),
"hint": PROPERTY_HINT_ENUM,
"hint_string": "Code Page 437:2,ISO 8859-1:3,ISO 8859-2:4,ISO 8859-3:5,ISO 8859-4:6,ISO 8859-5:7,ISO 8859-6:8,ISO 8859-7:9,ISO 8859-8:10,ISO 8859-9:11,ISO 8859-10:12,ISO 8859-11:13,ISO 8859-12:14,ISO 8859-13:15,ISO 8859-14:16,ISO 8859-15:17,ISO 8859-16:18,Shift JIS:20,Windows 1250:21,Windows 1251:22,Windows 1252:23,Windows 1256:24,UTF-16:25,UTF-8:26,US ASCII:27,BIG 5:28,GB 18030:29,EUC KR:30"
},
data_prop,
{
"name": "auto_version",
"type": TYPE_BOOL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "version",
"type": TYPE_INT,
"usage": (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY) if self.auto_version else (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE),
"hint": PROPERTY_HINT_RANGE,
"hint_string": "1,40"
},
{
"name": "auto_mask_pattern",
"type": TYPE_BOOL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "mask_pattern",
"type": TYPE_INT,
"usage": (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY) if self.auto_mask_pattern else (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE),
"hint": PROPERTY_HINT_RANGE,
"hint_string": "0,7"
},
{
"name": "Appearance",
"type": TYPE_NIL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_GROUP,
},
{
"name": "light_module_color",
"type": TYPE_COLOR,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "dark_module_color",
"type": TYPE_COLOR,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "auto_module_size",
"type": TYPE_BOOL,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
},
{
"name": "module_size",
"type": TYPE_INT,
"usage": (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY) if self.auto_module_size else (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE),
"hint": PROPERTY_HINT_RANGE,
"hint_string": "1,1,or_greater"
},
{
"name": "quiet_zone_size",
"type": TYPE_INT,
"usage": PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE,
"hint_string": "0,1,or_greater",
},
]
func _validate_property(property: Dictionary) -> void:
if property.name == "texture":
property.usage &= ~(PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE)
func _property_can_revert(property: StringName) -> bool:
return property in ["eci_value", "auto_version", "auto_mask_pattern", "light_module_color", "dark_module_color", "auto_module_size", "quiet_zone_size"]
func _property_get_revert(property: StringName) -> Variant:
match property:
"eci_value":
return QRCode.ECI.ISO_8859_1
"auto_version":
return true
"auto_mask_pattern":
return true
"light_module_color":
return Color.WHITE
"dark_module_color":
return Color.BLACK
"auto_module_size":
return true
"quiet_zone_size":
return 4
_:
return null
func _get_configuration_warnings() -> PackedStringArray:
if self.auto_module_size && self.expand_mode == EXPAND_KEEP_SIZE:
return ["Do not use auto module px size AND keep size expand mode."]
return []
func _notification(what: int) -> void:
match what:
NOTIFICATION_RESIZED:
if self.auto_module_size && self.auto_update:
self._update_texture()
elif self.auto_module_size:
self._update_module_size()
func _update_module_size() -> void:
self.module_size = mini(self.size.x, self.size.y) / (self._qr.get_dimension() + 2 * self.quiet_zone_size)
func _update_texture() -> void:
if self.auto_module_size:
self._update_module_size()
self.texture = ImageTexture.create_from_image(QRCode.generate_image(self._cached_data, self.module_size, self.light_module_color, self.dark_module_color, self.quiet_zone_size))
@@ -0,0 +1 @@
uid://dynulhnyq5hpq
+76
View File
@@ -0,0 +1,76 @@
# log -> exponent/antilog
static var _anti_log_table: PackedByteArray = []
# exponent/antilog -> log
static var _log_table: PackedByteArray = []
static func _static_init() -> void:
_create_log_anti_log_tables()
static func _anti_log(degree: int) -> int:
var res: int = 1
var alpha: int = 2
while degree != 0:
if degree & 1 == 1:
res = mul(res, alpha)
degree = degree >> 1
alpha = mul(alpha, alpha)
return res
static func _create_log_anti_log_tables() -> void:
_anti_log_table.resize(256)
_anti_log_table.fill(0)
_log_table.resize(256)
_log_table.fill(0)
for degree: int in range(0, 256):
var value: int = _anti_log(degree)
_anti_log_table[degree] = value
_log_table[value] = degree % 255
# Russian Peasant Multiplication algorithm, adapted to reed solomon
static func mul(lhs: int, rhs: int) -> int:
var res: int = 0
while rhs > 0:
if rhs & 1:
res = res ^ lhs
lhs = lhs << 1 # lhs * 2
rhs = rhs >> 1 # rhs / 2
if lhs & 256:
lhs = lhs ^ 0x11D
return res
static func generator_polynom(size: int) -> PackedByteArray:
var res: PackedByteArray = []
res.resize(size + 1)
res.fill(0)
res[0] = 1
var a_j: int = 1
for exp: int in range(0, size):
var cur_val: int = a_j
for cur_exp: int in range(1, exp + 1):
var old_res: int = res[cur_exp]
res[cur_exp] = cur_val ^ old_res
cur_val = mul(old_res, a_j)
res[exp + 1] = cur_val
a_j = mul(a_j, 0x02)
return res
static func encode(data: PackedByteArray, code_words: int) -> PackedByteArray:
assert(len(data) + code_words <= 255, "message to encode is to long")
var gen_poly: PackedByteArray = generator_polynom(code_words)
var enc_msg: PackedByteArray = []
enc_msg.resize(len(data) + len(gen_poly) - 1)
enc_msg.fill(0)
for idx: int in range(len(data)):
enc_msg[idx] = data[idx]
for idx: int in range(len(data)):
var coef: int = enc_msg[idx]
for p_idx: int in range(1, len(gen_poly)):
enc_msg[idx+p_idx] ^= mul(gen_poly[p_idx], coef)
return enc_msg.slice(len(data))
@@ -0,0 +1 @@
uid://g8jskaqqsmlg
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
uid://8yd22fd2gbxt
+46
View File
@@ -0,0 +1,46 @@
class_name Character
extends Control
@onready
var panel: Panel = $Panel
@onready
var character_image: TextureRect = %CharacterTextureRect
@onready
var character_name_label: Label = %CharacterName
signal new_character_selected(img_texture: ImageTexture)
func set_character_name(character_name: String) -> void:
panel.size = Vector2(240, 145)
#margin.size = Vector2(240, 145)
#margin set margin 15, 10, 15, 0
character_name_label.text = character_name.split(".")[0]
character_name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
var image_fetched: Callable = func image_fetched(image: PackedByteArray) -> void:
var img: Image = Image.new()
var err: Error = img.load_png_from_buffer(image)
if err != OK:
print(err)
var err2: Error = img.load_jpg_from_buffer(image)
if err2 != OK:
print(err2)
var new_image: ImageTexture = ImageTexture.new()
new_image.set_image(img)
character_image.custom_minimum_size = Vector2(200, 100)
character_image.size = Vector2(200, 100)
character_image.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
character_image.size_flags_vertical = Control.SIZE_SHRINK_CENTER
character_image.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
character_image.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
character_image.texture = new_image
Settings.make_request2("/character?name=" + character_name.uri_encode(), image_fetched, true)
func _input(event: InputEvent) -> void:
if self.visible == true && Settings.character_select_open == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if Rect2(Vector2(0, 0), panel.size).has_point(evLocal.position):
print(character_name_label.text)
new_character_selected.emit(character_image.texture)
+1
View File
@@ -0,0 +1 @@
uid://i35b3scbpwpu
+45
View File
@@ -0,0 +1,45 @@
[gd_scene load_steps=4 format=3 uid="uid://c7ecjj2af6usf"]
[ext_resource type="Script" uid="uid://i35b3scbpwpu" path="res://character.gd" id="1_pjt0s"]
[ext_resource type="Texture2D" uid="uid://cv3hdd6bsruau" path="res://icon.svg" id="2_pjt0s"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pjt0s"]
bg_color = Color(0.302, 0.302, 0.302, 1)
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_pjt0s")
[node name="Panel" type="Panel" parent="."]
layout_mode = 0
offset_right = 240.0
offset_bottom = 145.0
theme_override_styles/panel = SubResource("StyleBoxFlat_pjt0s")
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
layout_mode = 0
offset_right = 240.0
offset_bottom = 145.0
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 15
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"]
layout_mode = 2
[node name="CharacterTextureRect" type="TextureRect" parent="Panel/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 100)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("2_pjt0s")
expand_mode = 3
stretch_mode = 5
[node name="CharacterName" type="Label" parent="Panel/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Aloy"
horizontal_alignment = 1
+29
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
View File
@@ -0,0 +1 @@
uid://cw41y87l64qo7
+85
View File
@@ -0,0 +1,85 @@
extends Control
@onready
var character_panel: Panel = %CharacterPanel
@onready
var title_label: Label = %TitleLabel
@onready
var character_grid: GridContainer = %CharacterGridContainer
@onready
var close_timer: Timer = %CloseTimer
signal character_selected(file_name: String)
signal new_new_character_selected(file_name: String)
var character: PackedScene = preload("res://character.tscn")
func _ready() -> void:
close_timer.timeout.connect(_on_close_timeout)
func select_character(file_name: String) -> void:
print("select_character")
character_selected.emit(file_name)
func _on_close_timeout() -> void:
print("_on_close_timeout!")
Settings.character_select_open = false
close_timer.stop()
func load_characters() -> void:
print("load_characters")
var fetch_character_list: Callable = func fetch_character_list(list) -> void:
print("fetch_character_list")
Settings.delete_children(character_grid)
if typeof(list) == TYPE_ARRAY:
for character_name: String in list:
print("character_name ", character_name)
var character_box: Character = character.instantiate()
character_grid.add_child(character_box)
character_box.custom_minimum_size = Vector2(235, 145)
character_box.size = Vector2(235, 145)
character_box.set_character_name(character_name)
character_box.connect("new_character_selected", _on_character_selected)
Settings.make_request2("/characters", fetch_character_list, true)
func show_grid(player_name: String) -> void:
print("show_grid")
title_label.text = "Select character for " + player_name
close_timer.stop()
self.visible = true
Settings.character_select_open = true
func _on_character_selected(texture: ImageTexture) -> void:
print("_on_character_selected")
self.visible = false
new_new_character_selected.emit(texture)
close_timer.start()
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), character_panel.size).has_point(evLocal.position):
self.visible = false
Settings.character_select_open = false
func load_characters_local() -> void:
var characters: DirAccess = DirAccess.open("res://characters/")
if characters:
characters.list_dir_begin()
var file_name: String = characters.get_next()
while file_name != "":
file_name = file_name.replace('.import', '') # <--- remove the .import
if file_name.ends_with(".png"):
var texture: Resource = load("res://characters/" + file_name)
var texture_btn: TextureButton = TextureButton.new()
character_grid.add_child(texture_btn)
texture_btn.custom_minimum_size = Vector2(80, 40)
texture_btn.ignore_texture_size = true
texture_btn.stretch_mode = TextureButton.STRETCH_KEEP_ASPECT
texture_btn.texture_normal = texture
texture_btn.pressed.connect(select_character.bind(file_name))
file_name = characters.get_next()
+1
View File
@@ -0,0 +1 @@
uid://cvffg87wr6r3y
+56
View File
@@ -0,0 +1,56 @@
[gd_scene load_steps=3 format=3 uid="uid://cdy4kvemwaiom"]
[ext_resource type="Script" uid="uid://cvffg87wr6r3y" path="res://new_character_select.gd" id="1_h4tdp"]
[sub_resource type="LabelSettings" id="LabelSettings_p4iny"]
font_size = 25
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_h4tdp")
[node name="CharacterPanel" type="Panel" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_right = 1260.0
offset_bottom = 665.0
[node name="VBoxContainer" type="VBoxContainer" parent="CharacterPanel"]
layout_mode = 0
offset_right = 1263.0
offset_bottom = 659.0
size_flags_horizontal = 3
[node name="TitleLabel" type="Label" parent="CharacterPanel/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
text = "Character Select"
label_settings = SubResource("LabelSettings_p4iny")
horizontal_alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="CharacterPanel/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 10
[node name="ScrollContainer" type="ScrollContainer" parent="CharacterPanel/VBoxContainer/MarginContainer"]
custom_minimum_size = Vector2(0, 600)
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="CharacterGridContainer" type="GridContainer" parent="CharacterPanel/VBoxContainer/MarginContainer/ScrollContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(1150, 600)
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/h_separation = 10
theme_override_constants/v_separation = 10
columns = 5
[node name="CloseTimer" type="Timer" parent="CharacterPanel"]
unique_name_in_owner = true
+99
View File
@@ -0,0 +1,99 @@
extends Node
var song_object_array: Array[SongObject] = []
var latest_played_song: int = 0
var currently_playing_song: int = -1
var first_song_downloaded: bool = false
var first_song_played: bool = false
var number_of_tracks_to_preload: int = 1
var is_song_downloading: bool = false
func get_next_song() -> SongObject:
return song_object_array[latest_played_song]
func set_latest_played_song() -> void:
latest_played_song += 1
if latest_played_song > song_object_array.size() - 1:
latest_played_song = song_object_array.size() - 1
func update_last_played_song() -> void:
latest_played_song = song_object_array.size()
func get_preloaded_songs() -> int:
var number_of_tracks_preloaded: int = 0
for song: SongObject in song_object_array:
if !song.has_played:
number_of_tracks_preloaded += 1
return number_of_tracks_preloaded
func should_preload_more_songs() -> bool:
return number_of_tracks_to_preload > get_preloaded_songs()
func set_last_played_answered() -> void:
if song_object_array[latest_played_song].has_played && !song_object_array[latest_played_song].is_answered:
song_object_array[latest_played_song].is_answered = true
func song_is_answered(song_no: int = currently_playing_song) -> void:
print("show_answer_pressed song_object: ", song_object_array[song_no]._to_string())
song_object_array[song_no].is_answered = true
if Settings.add_to_stats:
print("add to stats: ", song_no)
Settings.make_put_request("/music/played?song="+str(song_no))
func add_to_playlist(new_song_object: SongObject) -> void:
song_object_array.append(new_song_object)
func get_playlist() -> Array[SongObject]:
if Settings.is_debug:
return song_object_array
else:
var temp_list: Array[SongObject] = []
for s: SongObject in song_object_array:
if s.has_played:
temp_list.append(s)
return temp_list
func reset_playlist() -> void:
currently_playing_song = -1
latest_played_song = 0
clear_song_list()
func clear_song_list() -> void:
song_object_array.clear()
func unset_is_playing() -> void:
for song_object: SongObject in song_object_array:
song_object.is_playing = false
func set_currently_playing_song(value: int) -> void:
currently_playing_song = value
func get_current_game_title() -> String:
return song_object_array[currently_playing_song].get_game_title()
func get_current_song_title() -> String:
return song_object_array[currently_playing_song].get_song_title()
func add_point(player_id: int) -> void:
song_object_array[currently_playing_song].add_point(player_id)
func remove_point(player_id: int) -> void:
song_object_array[currently_playing_song].remove_point(player_id)
func remove_player_from_list(player_to_remove: int) -> void:
for song_list_object: SongObject in song_object_array:
song_object_array[song_list_object.song_number].players_given_point.remove_at(song_object_array[song_list_object.song_number].players_given_point.find(player_to_remove))
func get_song(song_no: int) -> AudioStream:
return song_object_array[song_no].song
func add_song_to_song_object(song_no: int, sound: AudioStream) -> void:
song_object_array[song_no].song = sound
func song_has_played(song_no: int = latest_played_song) -> void:
song_object_array[song_no].has_played = true
func song_is_playing(song_no: int = latest_played_song) -> void:
song_object_array[song_no].is_playing = true
+1
View File
@@ -0,0 +1 @@
uid://bgei7qocdnolw
+5
View File
@@ -0,0 +1,5 @@
class_name ProgressResponse
extends Node
var progress: String
var total_time: String
+1
View File
@@ -0,0 +1 @@
uid://e74iuu78stc3
+10 -2
View File
@@ -8,20 +8,24 @@
config_version=5 config_version=5
[animation]
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
[application] [application]
config/name="MusicPlayer" config/name="MusicPlayer"
run/main_scene="res://MainWindow.tscn" run/main_scene="res://MainWindow.tscn"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.6", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[autoload] [autoload]
Settings="*res://Settings.gd" Settings="*res://Settings.gd"
Playlist="*res://playlist.gd"
[debug] [debug]
settings/stdout/print_fps=true
gdscript/warnings/untyped_declaration=1 gdscript/warnings/untyped_declaration=1
gdscript/warnings/inferred_declaration=1 gdscript/warnings/inferred_declaration=1
@@ -37,6 +41,10 @@ window/vsync/vsync_mode=2
project/assembly_name="MusicPlayer" project/assembly_name="MusicPlayer"
[editor_plugins]
enabled=PackedStringArray("res://addons/kenyoni/qr_code/plugin.cfg")
[input] [input]
ui_accept={ ui_accept={
+47
View File
@@ -0,0 +1,47 @@
[gd_scene load_steps=2 format=3 uid="uid://bd1by80q1v27e"]
[ext_resource type="Script" uid="uid://rolypd0cqd6h" path="res://shortcuts_window.gd" id="1_12pxi"]
[node name="ShorcutsControl" 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_12pxi")
[node name="ShortcutsPanel" type="Panel" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(700, 700)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="ScrollContainer" type="ScrollContainer" parent="ShortcutsPanel"]
custom_minimum_size = Vector2(700, 700)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="shortcutsVBox" type="VBoxContainer" parent="ShortcutsPanel/ScrollContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(700, 700)
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="ShortcutsPanel/ScrollContainer/shortcutsVBox"]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="ShortcutsPanel/ScrollContainer/shortcutsVBox/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "testar"
horizontal_alignment = 1
[node name="Label2" type="Label" parent="ShortcutsPanel/ScrollContainer/shortcutsVBox/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "testera 2"
horizontal_alignment = 1
+86
View File
@@ -0,0 +1,86 @@
extends Control
@onready
var shortcuts_vbox: VBoxContainer = %shortcutsVBox
@onready
var shortcuts_panel: Panel = %ShortcutsPanel
var shortcuts_dic: Dictionary = {
"Alt + S": "Search",
"Alt + A": "Add Players",
"Alt + Z": "Reset",
"Alt + X": "Play/Pause",
"Alt + C": "Next Song",
"Alt + V": "Show Answer",
"Alt + L": "Show Debug Log",
"Alt + K": "Show shortcuts",
"Alt + Enter": "Fullscreen",
"Alt + UP": "Volume up",
"Alt + DOWN": "Volume down",
"Alt + LEFT": "Jump back in song",
"Alt + Ctrl + LEFT": "Restart song",
"Alt + RIGHT": "Jump forward in song",
"Alt + 1 - 9": "Give player point",
"Alt + Ctrl + 1 - 9": "Take point from player",
}
#Color(0.18, 0.18, 0.18)
#Color(0.302, 0.302, 0.302)
#Color(0.259, 0.259, 0.259)
func _input(event: InputEvent) -> void:
if self.visible == true:
if shortcuts_panel == null:
return
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), shortcuts_panel.size).has_point(evLocal.position):
self.visible = false
func _ready() -> void:
shortcuts_dic.sort()
Settings.delete_children(shortcuts_vbox)
var title: Label = Label.new()
title.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
title.add_theme_font_size_override("font_size", 20)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
title.text = "Shortcuts"
shortcuts_vbox.add_child(title)
var count: int = 0
for shortcut: String in shortcuts_dic.keys():
var panel: PanelContainer = PanelContainer.new()
var hbox: HBoxContainer = HBoxContainer.new()
hbox.alignment = BoxContainer.ALIGNMENT_CENTER
var label: Label = Label.new()
label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
label.add_theme_font_size_override("font_size", 20)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.text = shortcut
label.autowrap_mode = TextServer.AUTOWRAP_WORD
label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var label2: Label = Label.new()
label2.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
label2.add_theme_font_size_override("font_size", 20)
label2.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label2.text = shortcuts_dic[shortcut]
label2.autowrap_mode = TextServer.AUTOWRAP_WORD
label2.size_flags_horizontal = Control.SIZE_EXPAND_FILL
if count % 2 == 0:
var new_stylebox_normal: Resource = panel.get_theme_stylebox("panel").duplicate()
new_stylebox_normal.bg_color = Color(0.18, 0.18, 0.18)
panel.add_theme_stylebox_override("panel", new_stylebox_normal)
#label.add_theme_stylebox_override("normal", new_stylebox_normal)
#label2.add_theme_stylebox_override("normal", new_stylebox_normal)
hbox.add_child(label)
hbox.add_child(label2)
panel.add_child(hbox)
shortcuts_vbox.add_child(panel)
count += 1
+1
View File
@@ -0,0 +1 @@
uid://rolypd0cqd6h
+1 -1
View File
@@ -44,7 +44,7 @@ func update_players() -> void:
if player.id == player_id: if player.id == player_id:
var texture: TextureRect = TextureRect.new() var texture: TextureRect = TextureRect.new()
texture.texture = player.character texture.texture = player.character
texture.expand_mode = TextureRect.EXPAND_IGNORE_SIZE texture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture.custom_minimum_size = Vector2(50, 25) texture.custom_minimum_size = Vector2(50, 25)
song_list_players.add_child(texture) song_list_players.add_child(texture)
+19
View File
@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://n2g8jddr85h2"
path="res://.godot/imported/01. Opening.mp3-559a476b5f0faf13d7bec359898ef47c.mp3str"
[deps]
source_file="res://sounds/01. Opening.mp3"
dest_files=["res://.godot/imported/01. Opening.mp3-559a476b5f0faf13d7bec359898ef47c.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
+10
View File
@@ -0,0 +1,10 @@
class_name SyncResponse
extends Node
var games_added: Array
var games_re_added: Array
var games_changed_title: Array
var games_changed_content: Array
var games_removed: Array
var catched_errors: Array
var total_time: String
+1
View File
@@ -0,0 +1 @@
uid://dtfsuob2aidl7
+201
View File
@@ -0,0 +1,201 @@
extends Control
@onready
var sync_panel: Panel = %SyncPanel
@onready
var sync_title_label: Label = %SyncTitleLabel
@onready
var no_changes_label: Label = %NoChangesLabel
@onready
var progress_hbox: HBoxContainer = %ProgressHBoxContainer
@onready
var sync_hbox: HBoxContainer = %SyncHBoxContainer
@onready
var sync_progress_bar: ProgressBar = %SyncProgressBar
@onready
var games_added_vbox: VBoxContainer = %GamesAddedVBox
@onready
var games_added_separator: VSeparator = %GamesAddedSeparator
@onready
var games_readded_vbox: VBoxContainer = %GamesReAddedVBox
@onready
var games_readded_separator: VSeparator = %GamesReAddedSeparator
@onready
var games_changed_title_vbox: VBoxContainer = %GamesChangedTitleVBox
@onready
var games_changed_title_separator: VSeparator = %GamesChangedTitleSeparator
@onready
var games_changed_content_vbox: VBoxContainer = %GamesChangedContentVBox
@onready
var games_changed_content_separator: VSeparator = %GamesChangedContentSeparator
@onready
var games_removed_vbox: VBoxContainer = %GamesRemovedVBox
@onready
var games_removed_separator: VSeparator = %GamesRemovedSeparator
@onready
var catched_errors_vbox: VBoxContainer = %CatchedErrorsVBox
@onready
var sync_time: Label = %SyncTime
@onready
var sync_timer: Timer = %SyncTimer
var changes: bool = false
var has_synced: bool = false
signal sync_started
signal sync_finished
func _ready() -> void:
sync_timer.timeout.connect(_on_sync_timeout)
func _input(event: InputEvent) -> void:
if self.visible == true:
if event is InputEventMouseButton && event.is_pressed():
var evLocal: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), sync_panel.size).has_point(evLocal.position):
self.visible = false
func start_sync() -> void:
print("start_sync")
self.visible = true
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!")
var get_progress: Callable = func get_progress(data_received: Dictionary) -> void:
print("get_progress")
print("data_received: ", data_received)
if data_received != null:
if data_received.has("progress"):
sync_progress_bar.value = int(data_received.progress)
sync_time.text = data_received.time_spent
else:
on_sync_finished(data_received)
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
list_visible(games_added_vbox, games_added_separator)
make_list(data_received.games_added, games_added_vbox, "GamesAdded")
if data_received.games_re_added != null:
changes = true
list_visible(games_readded_vbox, games_readded_separator)
make_list(data_received.games_re_added, games_readded_vbox, "GamesReAdded")
if data_received.games_changed_title != null:
changes = true
list_visible(games_changed_title_vbox, games_changed_title_separator)
Settings.delete_children(games_changed_title_vbox)
make_header_label(games_changed_title_vbox, "GamesChangedTitle")
var row: int = 0
for old_game_title: String in data_received.games_changed_title:
var label: Label = make_game_label(old_game_title + " changed title to " + data_received.games_changed_title[old_game_title])
if row % 2 != 0:
label.add_theme_color_override("font_color", Color(1, 0.5, 0))
games_changed_title_vbox.add_child(label)
if data_received.games_changed_content != null:
changes = true
list_visible(games_changed_content_vbox, games_changed_content_separator)
make_list(data_received.games_changed_content, games_changed_content_vbox, "GamesChangedContent")
if data_received.games_removed != null:
changes = true
list_visible(games_removed_vbox, games_removed_separator)
make_list(data_received.games_removed, games_removed_vbox, "GamesRemoved")
if data_received.catched_errors != null:
catched_errors_vbox.visible = true
make_list(data_received.catched_errors, catched_errors_vbox, "CatchedErrors")
if !changes:
no_changes_label.visible = true
sync_time.text = data_received.total_time
Settings.currently_syncing = false
sync_timer.stop()
print("sync finished")
show_sync_result()
sync_finished.emit()
func list_visible(vbox: VBoxContainer, seperator: VSeparator) -> void:
vbox.visible = true
seperator.visible = true
func make_header_label(vbox: VBoxContainer, text: String) -> void:
var label: Label = Label.new()
label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
label.add_theme_font_size_override("font_size", 20)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.text = text
vbox.add_child(label)
func make_game_label(text: String) -> Label:
var label: Label = Label.new()
label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
label.add_theme_font_size_override("font_size", 20)
label.text = text
label.autowrap_mode = TextServer.AUTOWRAP_WORD
return label
func reset_sync_result() -> void:
sync_progress_bar.value = 0
sync_time.text = ""
changes = false
no_changes_label.visible = false
games_added_vbox.visible = false
games_added_separator.visible = false
games_readded_vbox.visible = false
games_readded_separator.visible = false
games_changed_title_vbox.visible = false
games_changed_title_separator.visible = false
games_changed_content_vbox.visible = false
games_changed_content_separator.visible = false
games_removed_vbox.visible = false
games_removed_separator.visible = false
catched_errors_vbox.visible = false
func make_list(list: Array, vbox: VBoxContainer, text: String) -> void:
Settings.delete_children(vbox)
make_header_label(vbox, text)
var row: int = 0
for game: String in list:
var label: Label = make_game_label(game)
if row % 2 != 0:
label.add_theme_color_override("font_color", Color(1, 0.5, 0))
vbox.add_child(label)
func show_sync_result() -> void:
sync_title_label.text = "Sync Result"
progress_hbox.visible = false
sync_hbox.visible = true
func show_sync_progress() -> void:
sync_title_label.text = "Sync in Progress"
progress_hbox.visible = true
no_changes_label.visible = false
sync_hbox.visible = false
catched_errors_vbox.visible = false
+1
View File
@@ -0,0 +1 @@
uid://c3ejukwth512a
+63
View File
@@ -0,0 +1,63 @@
extends Control
@onready
var winner_panel: Panel = %WinnerPanel
@onready
var winner_picture: TextureRect = %WinnerPicture
@onready
var winner_label: Label = %WinnerLabel
@onready
var players_list: VBoxContainer = %PlayersList
func _ready() -> void:
visible = false
func show_winner(winning_player_id: int) -> void:
visible = true
# Set winner info
var winner: PlayerObject = Settings.player_array[winning_player_id]
winner_label.text = winner.player_name + " won with " + str(winner.player_score) + \
" points!!"
winner_picture.texture = winner.character
winner_picture.custom_minimum_size = Vector2(480, 200)
winner_picture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
winner_picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
# Clear previous player list entries
for child: Node in players_list.get_children():
child.queue_free()
# Sort players by score (descending) and add to list
var sorted_players: Array = Settings.player_array.duplicate()
sorted_players.sort_custom(
func(a: PlayerObject, b: PlayerObject) -> bool:
return a.player_score > b.player_score
)
var placing: int = 2
for player: PlayerObject in sorted_players:
if player.id == winning_player_id:
continue # Skip the winner, already shown above
var label: Label = Label.new()
label.text = str(placing) + ". " + player.player_name + " - " + \
str(player.player_score) + " points"
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
players_list.add_child(label)
placing += 1
func hide_window() -> void:
visible = false
func _input(event: InputEvent) -> void:
if visible:
if event is InputEventMouseButton and event.is_pressed():
var ev_local: InputEvent = make_input_local(event)
if !Rect2(Vector2(0, 0), winner_panel.size).has_point(ev_local.position):
visible = false
+1
View File
@@ -0,0 +1 @@
uid://dxpb22xbwf3t1