Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8da6fc442f | ||
|
|
235bdcbcb5 | ||
|
|
6989b53dda | ||
|
|
899e99864f |
No files matched your search
@@ -9,7 +9,7 @@ on:
|
||||
branches: [main, develop]
|
||||
|
||||
env:
|
||||
GODOT_VERSION: 4.6
|
||||
GODOT_VERSION: 4.7
|
||||
PROJECT_PATH: .
|
||||
EXPORT_NAME: MusicPlayer
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ on:
|
||||
- '*.*'
|
||||
|
||||
env:
|
||||
GODOT_VERSION: 4.6
|
||||
GODOT_VERSION: 4.7
|
||||
PROJECT_PATH: .
|
||||
PROJECT_NAME: MusicPlayer
|
||||
GAME_VERSION: ${{gitea.ref_name}}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
When writing or reviewing GDScript code, strictly follow the official Godot Engine GDScript style guide and file naming conventions:
|
||||
|
||||
---
|
||||
|
||||
### **Code Formatting**
|
||||
1. **Indentation**: Use **4 spaces** (no tabs).
|
||||
2. **Line Length**: Keep lines under **100 characters** where possible.
|
||||
3. **Naming Conventions**:
|
||||
- **Variables/functions**: `snake_case` (e.g., `player_health`, `calculate_damage()`).
|
||||
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `MAX_SPEED = 100`).
|
||||
- **Class Names**: `PascalCase` (e.g., `class_name Player.gd`).
|
||||
- **Signals**: `snake_case` (e.g., `signal player_died`).
|
||||
4. **Spacing**:
|
||||
- Add spaces around operators (`x = y + z`, not `x=y+z`).
|
||||
- No space after `(` or before `)` in function calls (e.g., `func(a, b)`).
|
||||
5. **Braces**: Open braces on the same line for `if`, `for`, `func`, etc.:
|
||||
```gdscript
|
||||
if x > 0:
|
||||
print("Positive")
|
||||
```
|
||||
6. **Docstrings**: Use **Godot’s built-in docstring format** for functions:
|
||||
```gdscript
|
||||
## Calculates the player's speed based on input.
|
||||
## @param delta: Time since last frame (float).
|
||||
## @return: The adjusted speed (float).
|
||||
func calculate_speed(delta: float) -> float:
|
||||
return base_speed * delta
|
||||
```
|
||||
7. **Type Hints**: Always include type hints for parameters and return values (Godot 4+).
|
||||
8. **Avoid Redundancy**: Omit redundant `self.` unless required for clarity.
|
||||
|
||||
---
|
||||
### **File Naming Conventions**
|
||||
1. **Script Files**:
|
||||
- Use **`snake_case`** for `.gd` files (e.g., `player.gd`, `enemy_ai.gd`).
|
||||
- Match the filename to the **class name** (if the script defines a class).
|
||||
Example: If the class is `Player`, the file should be `player.gd`.
|
||||
2. **Scene Files**:
|
||||
- Use **`PascalCase`** for `.tscn` files (e.g., `Player.tscn`, `MainMenu.tscn`).
|
||||
- Match the filename to the **root node** of the scene.
|
||||
3. **Resource Files**:
|
||||
- Use **`snake_case`** for `.tres` or `.res` files (e.g., `player_stats.tres`).
|
||||
4. **Folders**:
|
||||
- Use **`snake_case`** for directories (e.g., `scripts/`, `assets/sprites/`).
|
||||
- Group related files logically (e.g., `player/` for `player.gd`, `player.tscn`).
|
||||
|
||||
---
|
||||
**Reference**: [Godot GDScript Style Guide](https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_styleguide.html).
|
||||
@@ -13,6 +13,15 @@ var whats_new_label: Label = %WhatsNewLabel
|
||||
|
||||
# Changelog as Dictionary with version as key and description as value
|
||||
const WHATS_NEW: Dictionary = {
|
||||
"1.9.0": "Made improvements to the Search window
|
||||
Made small changes to the inspiration list scrolling
|
||||
Made small changes to the player list
|
||||
Changed the term game to soundtrack
|
||||
#28: Made changes to the sync window
|
||||
#34: Fixed bug in Character Select when clicking or scrolling",
|
||||
"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
|
||||
|
||||
@@ -1,34 +1,38 @@
|
||||
extends ScrollContainer
|
||||
|
||||
var SCROLL: float = 0
|
||||
var delay: float = 0.02 #seconds
|
||||
var wait: float = 0
|
||||
# Scroll direction: 1 = down, -1 = up
|
||||
var scroll_direction: int = 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
wait = delay
|
||||
scroll_direction = 1
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
wait -= delta
|
||||
if wait < 0:
|
||||
wait = delay
|
||||
#SCROLL DOWN
|
||||
if SCROLL == 1:
|
||||
if (scroll_vertical + get_v_scroll_bar().page) < get_v_scroll_bar().max_value:
|
||||
scroll_vertical += Settings.inspiration_list_speed
|
||||
else:
|
||||
scroll_back_up()
|
||||
#SCROLL UP
|
||||
elif SCROLL == -1:
|
||||
if scroll_vertical != 0:
|
||||
scroll_vertical -= Settings.inspiration_list_speed
|
||||
else:
|
||||
scroll_to_bottom()
|
||||
var speed_pixels_per_second: float = float(Settings.inspiration_list_speed) * 60.0
|
||||
var scroll_amount: float = speed_pixels_per_second * delta * float(scroll_direction)
|
||||
|
||||
var scroll_bar = get_v_scroll_bar()
|
||||
|
||||
# Don't scroll if list is empty or too short
|
||||
if scroll_bar.max_value <= 0:
|
||||
return
|
||||
|
||||
func scroll_back_up() -> void:
|
||||
SCROLL = -1
|
||||
var current_pos = scroll_bar.value
|
||||
|
||||
func scroll_to_bottom() -> void:
|
||||
scroll_vertical = 0 #Reset to top first.
|
||||
SCROLL = 1
|
||||
if scroll_direction == 1:
|
||||
# Scrolling down
|
||||
if current_pos + scroll_bar.page < scroll_bar.max_value:
|
||||
scroll_bar.value = min(current_pos + scroll_amount, scroll_bar.max_value - scroll_bar.page)
|
||||
else:
|
||||
# Reached bottom, reverse direction
|
||||
scroll_direction = -1
|
||||
scroll_bar.value = scroll_bar.max_value - scroll_bar.page
|
||||
else:
|
||||
# Scrolling up
|
||||
if current_pos > 0:
|
||||
scroll_bar.value = max(current_pos + scroll_amount, 0)
|
||||
else:
|
||||
# Reached top, reverse direction
|
||||
scroll_direction = 1
|
||||
scroll_bar.value = 0
|
||||
+32
-41
@@ -23,7 +23,7 @@ var inspiration_scroll: ScrollContainer = $ScrollContainer
|
||||
var inspiration_list: VBoxContainer = $ScrollContainer/VBoxContainer
|
||||
|
||||
@onready
|
||||
var game_label: Label = $VBoxContainer/GameLabel
|
||||
var soundtrack_label: Label = $VBoxContainer/SoundtrackLabel
|
||||
|
||||
@onready
|
||||
var song_label: Label = $VBoxContainer/SongLabel
|
||||
@@ -67,6 +67,9 @@ var shortcuts_window: Control = %ShortcutsWindow
|
||||
@onready
|
||||
var qr_window: Control = %QRWindow
|
||||
|
||||
@onready
|
||||
var winner_window: Control = %WinnerWindow
|
||||
|
||||
@onready
|
||||
var qr_button: Button = $QRButton
|
||||
|
||||
@@ -103,6 +106,9 @@ var music_list: VBoxContainer = $MusicListPanel/ScrollContainer/MusicList
|
||||
@onready
|
||||
var player_container: VBoxContainer = $Players/VBoxContainer
|
||||
|
||||
@onready
|
||||
var players_list_container: VBoxContainer = $Players/VBoxContainer/ScrollContainer/PlayersListVBoxContainer
|
||||
|
||||
@onready
|
||||
var character_select: Control = $CharacterSelect
|
||||
|
||||
@@ -115,15 +121,6 @@ var search_button: Button = $SearchButton
|
||||
@onready
|
||||
var search_view: Control= $Search
|
||||
|
||||
@onready
|
||||
var winner_popup: PopupPanel = $WinnerPopupPanel
|
||||
|
||||
@onready
|
||||
var winner_label: Label = %WinnerLabel
|
||||
|
||||
@onready
|
||||
var winner_picture: TextureRect = %WinnerPicture
|
||||
|
||||
@onready
|
||||
var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton
|
||||
|
||||
@@ -131,7 +128,7 @@ var auto_repeat_song_button: CheckButton = $RepeatSongCheckButton
|
||||
var music_player_container: PanelContainer = $MusicPlayer
|
||||
|
||||
@onready
|
||||
var log: Control = %Log
|
||||
var log_window: Control = %Log
|
||||
|
||||
@onready
|
||||
var debug_label: Label = $DebugLabel
|
||||
@@ -140,7 +137,7 @@ var player: PackedScene = preload("res://Player.tscn")
|
||||
var song_list_object: PackedScene = preload("res://song_list_object.tscn")
|
||||
|
||||
var songs: Array= []
|
||||
var games: Array = []
|
||||
var soundtracks: Array = []
|
||||
var current_player: Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -158,7 +155,7 @@ func _ready() -> void:
|
||||
next_button.pressed.connect(play_next_song)
|
||||
show_answer_button.pressed.connect(show_answer_pressed)
|
||||
search_button.pressed.connect(show_search)
|
||||
sync_button.pressed.connect(sync_games)
|
||||
sync_button.pressed.connect(sync_soundtracks)
|
||||
sound_test_button.pressed.connect(music_player_container.get_sound_test_song)
|
||||
statistics_button.pressed.connect(get_statistics)
|
||||
shortcuts_button.pressed.connect(show_shortcuts)
|
||||
@@ -186,7 +183,7 @@ func _ready() -> void:
|
||||
get_suggestion_list()
|
||||
fetch_song_list_at_start()
|
||||
fetch_song()
|
||||
search_view.get_list_of_games()
|
||||
search_view.get_list_of_soundtracks()
|
||||
new_character_select.load_characters()
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -217,7 +214,7 @@ func _input(event: InputEvent) -> void:
|
||||
if event.alt_pressed && event.keycode == KEY_K:
|
||||
shortcuts_window.visible = !shortcuts_window.visible
|
||||
if event.alt_pressed && event.keycode == KEY_L:
|
||||
log.visible = !log.visible
|
||||
log_window.visible = !log_window.visible
|
||||
|
||||
func server_updated() -> void:
|
||||
print("server_updated")
|
||||
@@ -226,7 +223,7 @@ func server_updated() -> void:
|
||||
|
||||
func update_from_server() -> void:
|
||||
print("update_from_server")
|
||||
search_view.get_list_of_games()
|
||||
search_view.get_list_of_soundtracks()
|
||||
get_suggestion_list()
|
||||
reset_playlist()
|
||||
new_character_select.load_characters()
|
||||
@@ -251,7 +248,7 @@ func fetch_song_list_at_start() -> void:
|
||||
for d: Dictionary in data:
|
||||
var new_song_object: SongObject = SongObject.new()
|
||||
new_song_object.song_number = d.SongNo
|
||||
new_song_object.game_title = d.Game
|
||||
new_song_object.soundtrack_title = d.Soundtrack
|
||||
new_song_object.song_title = d.Song
|
||||
new_song_object.is_answered = true
|
||||
new_song_object.has_played = true
|
||||
@@ -297,7 +294,7 @@ func fetch_song() -> void:
|
||||
var fetch_song_info_done: Callable = func fetch_song_info_done(data_received: Dictionary) -> void:
|
||||
print("fetch_song_info_done")
|
||||
new_song_object.song_number = data_received.SongNo
|
||||
new_song_object.game_title = data_received.Game
|
||||
new_song_object.soundtrack_title = data_received.Soundtrack
|
||||
new_song_object.song_title = data_received.Song
|
||||
|
||||
print("new_song_object: ", new_song_object.to_string())
|
||||
@@ -318,7 +315,7 @@ func fetch_song() -> void:
|
||||
func update_song_list() -> void:
|
||||
print("update_song_list")
|
||||
if Playlist.currently_playing_song >= 0:
|
||||
game_label.text = Playlist.get_current_game_title()
|
||||
soundtrack_label.text = Playlist.get_current_soundtrack_title()
|
||||
song_label.text = Playlist.get_current_song_title()
|
||||
Settings.delete_children(music_list)
|
||||
for s: SongObject in Playlist.get_playlist():
|
||||
@@ -377,10 +374,10 @@ func show_qr() -> void:
|
||||
func get_statistics() -> void:
|
||||
print("get_statistics")
|
||||
statistic_popup.visible = true
|
||||
statistic_label.text = "Total amount of games in the playlist: " + str(games.size())
|
||||
statistic_label.text = "Total amount of soundtracks in the playlist: " + str(soundtracks.size())
|
||||
|
||||
func sync_games() -> void:
|
||||
print("sync_games")
|
||||
func sync_soundtracks() -> void:
|
||||
print("sync_soundtracks")
|
||||
sync_window.start_sync()
|
||||
|
||||
func _on_sync_started() -> void:
|
||||
@@ -403,17 +400,16 @@ func get_suggestion_list() -> void:
|
||||
print("get_suggestion_list")
|
||||
var populate_list: Callable = func populate_list(array) -> void:
|
||||
if typeof(array) == TYPE_ARRAY:
|
||||
games = []
|
||||
soundtracks = []
|
||||
Settings.delete_children(inspiration_list)
|
||||
games.append_array(array)
|
||||
for game: String in games:
|
||||
soundtracks.append_array(array)
|
||||
for soundtrack: String in soundtracks:
|
||||
var inspiration_label: Label = Label.new()
|
||||
inspiration_label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
inspiration_label.add_theme_font_size_override("font_size", 20)
|
||||
inspiration_label.text = game
|
||||
inspiration_label.text = soundtrack
|
||||
inspiration_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
inspiration_list.add_child(inspiration_label)
|
||||
inspiration_scroll.scroll_to_bottom()
|
||||
else:
|
||||
print("Unexpected data")
|
||||
Settings.make_request2("/music/all", populate_list, true)
|
||||
@@ -440,7 +436,7 @@ func add_player() -> void:
|
||||
|
||||
func load_players() -> void:
|
||||
print("load_players")
|
||||
Settings.delete_player_children(player_container)
|
||||
Settings.delete_player_children(players_list_container)
|
||||
var counter: int = 0
|
||||
for player_object: PlayerObject in Settings.player_array:
|
||||
print(player_object.player_name)
|
||||
@@ -451,12 +447,12 @@ func load_players() -> void:
|
||||
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))
|
||||
|
||||
player_container.add_child(new_player)
|
||||
players_list_container.add_child(new_player)
|
||||
counter += 1
|
||||
|
||||
func _on_point_given(player_given_point: int) -> void:
|
||||
print("_on_point_given")
|
||||
log.add_log_row(Settings.player_array[player_given_point].player_name + " got a point")
|
||||
log_window.add_log_row(Settings.player_array[player_given_point].player_name + " got a point")
|
||||
if Playlist.currently_playing_song >= 0:
|
||||
Playlist.add_point(player_given_point)
|
||||
update_song_list()
|
||||
@@ -466,7 +462,7 @@ func _on_make_point_given_sound() -> void:
|
||||
|
||||
func _on_point_taken(player_taken_point: int) -> void:
|
||||
print("_on_point_taken")
|
||||
log.add_log_row(Settings.player_array[player_taken_point].player_name + " lost a point")
|
||||
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"))
|
||||
if Playlist.currently_playing_song >= 0:
|
||||
Playlist.remove_point(player_taken_point)
|
||||
@@ -474,12 +470,7 @@ func _on_point_taken(player_taken_point: int) -> void:
|
||||
|
||||
func _on_player_won(winning_player_id: int) -> void:
|
||||
print("_on_player_won")
|
||||
winner_popup.visible = true
|
||||
winner_label.text = Settings.player_array[winning_player_id].player_name + " won!!"
|
||||
winner_picture.custom_minimum_size = Vector2(692, 300)
|
||||
winner_picture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
|
||||
winner_picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
winner_picture.texture = Settings.player_array[winning_player_id].character
|
||||
winner_window.show_winner(winning_player_id)
|
||||
music_player_container.play_song(preload("res://sounds/winning.mp3"))
|
||||
Settings.add_to_stats = false
|
||||
|
||||
@@ -530,11 +521,11 @@ func dir_contents(path: String) -> void:
|
||||
dir.list_dir_begin()
|
||||
var file_name: String = dir.get_next()
|
||||
songs.clear()
|
||||
games = []
|
||||
soundtracks = []
|
||||
while file_name != "":
|
||||
if dir.current_is_dir():
|
||||
#print("Found directory: " + file_name)
|
||||
games.append(file_name)
|
||||
soundtracks.append(file_name)
|
||||
else:
|
||||
#print("Found file: " + file_name)
|
||||
if file_name.ends_with(".mp3"):
|
||||
@@ -543,7 +534,7 @@ func dir_contents(path: String) -> void:
|
||||
else:
|
||||
print("An error occurred when trying to access the path.")
|
||||
|
||||
for game: String in games:
|
||||
for soundtrack: String in soundtracks:
|
||||
var local_inspiration_label: Label = Label.new()
|
||||
local_inspiration_label.text = game
|
||||
local_inspiration_label.text = soundtrack
|
||||
inspiration_list.add_child(local_inspiration_label)
|
||||
+35
-60
@@ -11,12 +11,12 @@
|
||||
[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://dpdem7pdxweb5" path="res://SyncWindow.tscn" id="10_yxw0b"]
|
||||
[ext_resource type="Texture2D" uid="uid://r4as0nmtoa7p" path="res://noCharacter.png" id="11_1qef0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dldpeo5y3l5hq" path="res://SettingsWindow.tscn" id="11_k62u5"]
|
||||
[ext_resource type="PackedScene" uid="uid://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"]
|
||||
font_size = 25
|
||||
@@ -68,9 +68,6 @@ keycode = 83
|
||||
[sub_resource type="Shortcut" id="Shortcut_fbju4"]
|
||||
events = [SubResource("InputEventKey_ujjlu")]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_hr75l"]
|
||||
font_size = 35
|
||||
|
||||
[node name="Control" type="Control" unique_id=407149696]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
@@ -154,7 +151,7 @@ offset_top = 64.0
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 384.0
|
||||
|
||||
[node name="GameLabel" type="Label" parent="VBoxContainer" unique_id=173147793]
|
||||
[node name="SoundtrackLabel" type="Label" parent="VBoxContainer" unique_id=173147793]
|
||||
texture_filter = 1
|
||||
custom_minimum_size = Vector2(1, 1)
|
||||
layout_mode = 2
|
||||
@@ -256,13 +253,21 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_k1ygi")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Players/VBoxContainer" unique_id=1000000001]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 15
|
||||
|
||||
[node name="PlayersListVBoxContainer" type="VBoxContainer" parent="Players/VBoxContainer/ScrollContainer" unique_id=1000000002]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 15
|
||||
|
||||
[node name="ResetPlaylistButton" type="Button" parent="." unique_id=1754155620]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 1359.0
|
||||
offset_top = 66.0
|
||||
offset_right = 1470.0
|
||||
offset_bottom = 97.0
|
||||
offset_left = 1360.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1471.0
|
||||
offset_bottom = 95.0
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Reset playlist"
|
||||
@@ -270,10 +275,10 @@ text = "Reset playlist"
|
||||
[node name="ResetPointsButton" type="Button" parent="." unique_id=942880776]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 1487.0
|
||||
offset_top = 66.0
|
||||
offset_right = 1598.0
|
||||
offset_bottom = 97.0
|
||||
offset_left = 1488.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1599.0
|
||||
offset_bottom = 95.0
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Reset points"
|
||||
@@ -281,21 +286,21 @@ text = "Reset points"
|
||||
[node name="SyncButton" type="Button" parent="." unique_id=1228313556]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 1615.0
|
||||
offset_top = 66.0
|
||||
offset_right = 1726.0
|
||||
offset_bottom = 97.0
|
||||
offset_left = 1616.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1759.0
|
||||
offset_bottom = 95.0
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Sync games"
|
||||
text = "Sync soundtracks"
|
||||
|
||||
[node name="SoundTestButton" type="Button" parent="." unique_id=1332971879]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 1743.0
|
||||
offset_top = 66.0
|
||||
offset_right = 1854.0
|
||||
offset_bottom = 97.0
|
||||
offset_left = 1776.0
|
||||
offset_top = 64.0
|
||||
offset_right = 1887.0
|
||||
offset_bottom = 95.0
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Sound test"
|
||||
@@ -464,7 +469,7 @@ offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = 446.0
|
||||
offset_bottom = 96.0
|
||||
text = "Total amount of games in the playlist: 9000"
|
||||
text = "Total amount of soundtracks in the playlist: 9000"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -477,44 +482,14 @@ offset_top = 153.0
|
||||
offset_right = 720.0
|
||||
offset_bottom = 153.0
|
||||
|
||||
[node name="WinnerPopupPanel" type="PopupPanel" parent="." unique_id=938181211]
|
||||
oversampling_override = 1.0
|
||||
initial_position = 2
|
||||
size = Vector2i(700, 350)
|
||||
|
||||
[node name="Panel" type="Panel" parent="WinnerPopupPanel" unique_id=89212869]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = 696.0
|
||||
offset_bottom = 346.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="WinnerPopupPanel/Panel" unique_id=471159349]
|
||||
layout_mode = 0
|
||||
offset_right = 692.0
|
||||
offset_bottom = 342.0
|
||||
alignment = 1
|
||||
|
||||
[node name="WinnerPicture" type="TextureRect" parent="WinnerPopupPanel/Panel/VBoxContainer" unique_id=1543774067]
|
||||
[node name="WinnerWindow" parent="." unique_id=999999999 instance=ExtResource("17_winner_window")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(692, 300)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("11_1qef0")
|
||||
expand_mode = 3
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="WinnerLabel" type="Label" parent="WinnerPopupPanel/Panel/VBoxContainer" unique_id=1437597286]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
text = "Sansan won!!"
|
||||
label_settings = SubResource("LabelSettings_hr75l")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 2
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 720.0
|
||||
offset_top = 153.0
|
||||
offset_right = 720.0
|
||||
offset_bottom = 153.0
|
||||
|
||||
[node name="RepeatSongCheckButton" type="CheckButton" parent="." unique_id=776835053]
|
||||
layout_mode = 0
|
||||
|
||||
+7
-7
@@ -55,12 +55,12 @@ func _ready() -> void:
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if audio_player.has_stream_playback() && !is_changing && !audio_player.stream_paused:
|
||||
if (!Settings.hide_beginning || audio_player.get_playback_position() >= 5.0):
|
||||
if (!Settings.hide_beginning || audio_player.get_playback_position() > Settings.hide_for_seconds):
|
||||
progress_slider.value = audio_player.get_playback_position()
|
||||
if stream != null:
|
||||
music_time_label.text = format_text(progress_slider.value, stream.get_length())
|
||||
else:
|
||||
music_time_label.text = format_text(progress_slider.value, 0.0)
|
||||
if stream != null:
|
||||
music_time_label.text = format_text(progress_slider.value, stream.get_length())
|
||||
else:
|
||||
music_time_label.text = format_text(progress_slider.value, 0.0)
|
||||
|
||||
func format_time(time: float) -> String:
|
||||
var mins: String = "%02d" % floor(time / 60)
|
||||
@@ -68,11 +68,11 @@ func format_time(time: float) -> String:
|
||||
return mins + ":" + sec
|
||||
|
||||
func format_text(part: float, total: float) -> String:
|
||||
if (Settings.hide_beginning && part <= 5.0) && Settings.hide_length:
|
||||
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 <= 5.0:
|
||||
elif Settings.hide_beginning && part < Settings.hide_for_seconds:
|
||||
return "??:?? / " + format_time(total)
|
||||
else:
|
||||
return format_time(part) + " / " + format_time(total)
|
||||
|
||||
@@ -18,15 +18,6 @@ layout_mode = 0
|
||||
offset_right = 450.0
|
||||
offset_bottom = 520.0
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="QRPanel" unique_id=1647138599]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
offset_right = 430.0
|
||||
offset_bottom = 20.0
|
||||
text = "Varsågod Peter!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QRCodeRect" type="TextureRect" parent="QRPanel" unique_id=1054378438]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
|
||||
+127
-122
@@ -9,24 +9,26 @@ var search_panel: Panel = %SearchPanel
|
||||
@onready
|
||||
var clear_button: Button = $ClearButton
|
||||
|
||||
@onready
|
||||
var close_button: Button = $CloseButton
|
||||
|
||||
@onready
|
||||
var search_bar: TextEdit = $Searchbar
|
||||
|
||||
var games: Array = []
|
||||
var regex: RegEx
|
||||
var soundtracks: Array = []
|
||||
|
||||
# Precomputed soundtrack data: array of dicts with original, lowercase, and cleaned fields
|
||||
var precomputed_soundtracks: Array = []
|
||||
|
||||
# Regex cache: maps cleaned search terms to compiled RegEx objects
|
||||
var regex_cache: Dictionary = {}
|
||||
|
||||
var label_pool: Array[Label] = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
clear_button.pressed.connect(clear)
|
||||
close_button.pressed.connect(close)
|
||||
search_bar.grab_focus()
|
||||
search_bar.text_changed.connect(search)
|
||||
visibility_changed.connect(focus)
|
||||
regex = RegEx.new()
|
||||
|
||||
|
||||
func focus() -> void:
|
||||
if self.visible == true:
|
||||
search_bar.grab_focus()
|
||||
@@ -38,88 +40,135 @@ func close() -> void:
|
||||
|
||||
func search() -> void:
|
||||
print(search_bar.text)
|
||||
Settings.delete_children(search_list)
|
||||
var search_text: String = search_bar.text.to_lower()
|
||||
for game: String in games:
|
||||
if is_match_exact(search_text, game):
|
||||
add_game(game)
|
||||
var clean_search_text: String = clean_search_term(search_text)
|
||||
for game: String in games:
|
||||
if is_match_contains(clean_search_text, clean_game(game)):
|
||||
add_game(game)
|
||||
for game: String in games:
|
||||
if is_match_regex(clean_search_text, clean_game(game)):
|
||||
add_game(game)
|
||||
var search_text: String = search_bar.text
|
||||
|
||||
if search_text == "":
|
||||
show_all_soundtracks()
|
||||
return
|
||||
|
||||
perform_search(search_text)
|
||||
|
||||
func clean_search_term(term: String) -> String:
|
||||
return term.replace(" ", "").replace("é", "e").replace("+", "plus").replace("&", "and").replace("'n", "and")
|
||||
func show_all_soundtracks() -> void:
|
||||
# Hide all visible labels and add to pool
|
||||
for child: Label in search_list.get_children():
|
||||
if child.visible:
|
||||
child.visible = false
|
||||
label_pool.append(child)
|
||||
|
||||
# Show all soundtracks in order
|
||||
for soundtrack: String in soundtracks:
|
||||
add_soundtrack_reuse(soundtrack)
|
||||
|
||||
func clean_game(term: String) -> String:
|
||||
func perform_search(search_text: String) -> void:
|
||||
# Hide all visible labels and add to pool
|
||||
for child: Label in search_list.get_children():
|
||||
if child.visible:
|
||||
child.visible = false
|
||||
label_pool.append(child)
|
||||
|
||||
var seen: Dictionary = {}
|
||||
var search_text_lower: String = search_text.to_lower()
|
||||
var clean_search_text: String = clean_term(search_text)
|
||||
|
||||
# Collect all matches first, then display in order
|
||||
var matches: Array = []
|
||||
|
||||
# Pass 1: Exact case-insensitive contains match on lowercase versions
|
||||
for i in range(precomputed_soundtracks.size()):
|
||||
var st_data = precomputed_soundtracks[i]
|
||||
if st_data["lowercase"].contains(search_text_lower):
|
||||
if not st_data["original"] in seen:
|
||||
seen[st_data["original"]] = true
|
||||
matches.append(st_data["original"])
|
||||
|
||||
# Pass 2: Contains match on cleaned terms
|
||||
for i in range(precomputed_soundtracks.size()):
|
||||
var st_data = precomputed_soundtracks[i]
|
||||
if st_data["cleaned"].contains(clean_search_text):
|
||||
if not st_data["original"] in seen:
|
||||
seen[st_data["original"]] = true
|
||||
matches.append(st_data["original"])
|
||||
|
||||
# Pass 3: Regex match on cleaned terms
|
||||
var regex = compile_regex_cached(clean_search_text)
|
||||
for i in range(precomputed_soundtracks.size()):
|
||||
var st_data = precomputed_soundtracks[i]
|
||||
if regex.search(st_data["cleaned"]):
|
||||
if not st_data["original"] in seen:
|
||||
seen[st_data["original"]] = true
|
||||
matches.append(st_data["original"])
|
||||
|
||||
# Display all matches in the order they appear in soundtracks
|
||||
for soundtrack: String in matches:
|
||||
add_soundtrack_reuse(soundtrack)
|
||||
|
||||
# Cleans a term by removing spaces and replacing special characters.
|
||||
# Matches MusicServer's clean_term() function.
|
||||
func clean_term(term: String) -> String:
|
||||
return term.replace(" ", "").replace("é", "e").replace("+", "plus").replace("&", "and").replace("'n", "and").to_lower()
|
||||
|
||||
func is_match_exact(search_term: String, game_name: String) -> bool:
|
||||
game_name = game_name.to_lower()
|
||||
|
||||
if search_term == "":
|
||||
return true
|
||||
elif game_name.contains(search_term):
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
# Compiles a regex pattern with caching to avoid recompiling the same pattern multiple times.
|
||||
func compile_regex_cached(search_term: String) -> RegEx:
|
||||
if not search_term in regex_cache:
|
||||
var regex = RegEx.new()
|
||||
var regText: String = ".*"
|
||||
for letter: String in search_term:
|
||||
regText += letter + ".*"
|
||||
regex.compile(regText)
|
||||
regex_cache[search_term] = regex
|
||||
return regex_cache[search_term]
|
||||
|
||||
func is_match_contains(search_term: String, game_name: String) -> bool:
|
||||
if search_term == "":
|
||||
return true
|
||||
elif game_name.contains(search_term):
|
||||
return true
|
||||
func add_soundtrack(soundtrack: String) -> void:
|
||||
# Backward compatibility - delegates to reuse version
|
||||
add_soundtrack_reuse(soundtrack)
|
||||
|
||||
# Optimized version that reuses label nodes from pool instead of creating new ones
|
||||
func add_soundtrack_reuse(soundtrack: String) -> void:
|
||||
var label: Label
|
||||
if label_pool.size() > 0:
|
||||
label = label_pool.pop_front()
|
||||
label.text = soundtrack
|
||||
label.visible = true
|
||||
# Move to end to maintain display order
|
||||
search_list.move_child(label, search_list.get_child_count() - 1)
|
||||
else:
|
||||
return false
|
||||
|
||||
func 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 add_game(game: String) -> void:
|
||||
var label: Label = Label.new()
|
||||
label.text = game
|
||||
print("game: " + game)
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
if !check_if_game_exists(game):
|
||||
label = Label.new()
|
||||
label.text = soundtrack
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
search_list.add_child(label)
|
||||
label.visible = true
|
||||
|
||||
func check_if_game_exists(game: String) -> bool:
|
||||
var game_exists: bool = false
|
||||
func check_if_soundtrack_exists(soundtrack: String) -> bool:
|
||||
var soundtrack_exists: bool = false
|
||||
for child: Label in search_list.get_children():
|
||||
if child.text == game:
|
||||
game_exists = true
|
||||
return game_exists
|
||||
if child.text == soundtrack and child.visible:
|
||||
soundtrack_exists = true
|
||||
return soundtrack_exists
|
||||
|
||||
func compile_regex(search_term: String) -> RegEx:
|
||||
var regText: String = ".*"
|
||||
for letter: String in search_term:
|
||||
regText += letter + ".*"
|
||||
regex.compile(regText)
|
||||
return regex
|
||||
|
||||
func get_list_of_games() -> void:
|
||||
print("get_list_of_games")
|
||||
var handle_games: Callable = func handle_games(array: Array) -> void:
|
||||
func get_list_of_soundtracks() -> void:
|
||||
print("get_list_of_soundtracks")
|
||||
var handle_soundtracks: Callable = func handle_soundtracks(array) -> void:
|
||||
if typeof(array) == TYPE_ARRAY:
|
||||
games = []
|
||||
Settings.delete_children(search_list)
|
||||
games.append_array(array)
|
||||
for game: String in games:
|
||||
var label: Label = Label.new()
|
||||
label.text = game
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
search_list.add_child(label)
|
||||
soundtracks = []
|
||||
precomputed_soundtracks = []
|
||||
# Reuse existing labels: hide all and add to pool
|
||||
for child: Label in search_list.get_children():
|
||||
child.visible = false
|
||||
label_pool.append(child)
|
||||
|
||||
soundtracks.append_array(array)
|
||||
# Precompute cleaned versions for all soundtracks
|
||||
for soundtrack: String in soundtracks:
|
||||
var cleaned = clean_term(soundtrack)
|
||||
precomputed_soundtracks.append({
|
||||
"original": soundtrack,
|
||||
"lowercase": soundtrack.to_lower(),
|
||||
"cleaned": cleaned
|
||||
})
|
||||
add_soundtrack_reuse(soundtrack)
|
||||
else:
|
||||
print("Unexpected data")
|
||||
Settings.make_request2("/music/all/order", handle_games, true)
|
||||
Settings.make_request2("/music/all/order", handle_soundtracks, true)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if self.visible == true:
|
||||
@@ -130,49 +179,5 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
func clear() -> void:
|
||||
search_bar.text = ""
|
||||
search()
|
||||
show_all_soundtracks()
|
||||
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
|
||||
+15
-27
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bxydgil1yifps"]
|
||||
[gd_scene format=3 uid="uid://bxydgil1yifps"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bg5yo08638600" path="res://SearchWindow.gd" id="1_m7bij"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
[node name="Control" type="Control" unique_id=616238617]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -11,53 +11,41 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_m7bij")
|
||||
|
||||
[node name="SearchPanel" type="Panel" parent="."]
|
||||
[node name="SearchPanel" type="Panel" parent="." unique_id=1262945994]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 640.0
|
||||
|
||||
[node name="ClearButton" type="Button" parent="."]
|
||||
[node name="ClearButton" type="Button" parent="." unique_id=1549439398]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 880.0
|
||||
offset_top = 24.0
|
||||
offset_right = 944.0
|
||||
offset_bottom = 64.0
|
||||
offset_left = 936.0
|
||||
offset_top = 16.0
|
||||
offset_right = 1027.0
|
||||
offset_bottom = 56.0
|
||||
scale = Vector2(2, 2)
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Clear"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="."]
|
||||
[node name="Searchbar" type="TextEdit" parent="." unique_id=2112669372]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 1032.0
|
||||
offset_top = 24.0
|
||||
offset_right = 1082.0
|
||||
offset_bottom = 64.0
|
||||
scale = Vector2(2, 2)
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "Close"
|
||||
|
||||
[node name="Searchbar" type="TextEdit" parent="."]
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
offset_left = 64.0
|
||||
offset_top = 24.0
|
||||
offset_right = 448.0
|
||||
offset_bottom = 64.0
|
||||
offset_left = 32.0
|
||||
offset_top = 16.0
|
||||
offset_right = 468.0
|
||||
offset_bottom = 56.0
|
||||
scale = Vector2(2, 2)
|
||||
placeholder_text = "Search"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=213733486]
|
||||
layout_mode = 0
|
||||
offset_top = 128.0
|
||||
offset_right = 576.0
|
||||
offset_bottom = 384.0
|
||||
scale = Vector2(2, 2)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=1567403144]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
+8
-14
@@ -10,7 +10,7 @@ var is_local: bool = false
|
||||
var is_debug: bool = false
|
||||
|
||||
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 add_to_stats: bool = true
|
||||
var use_low_played_mode: bool = false
|
||||
@@ -18,6 +18,7 @@ var winning_score: int = 20
|
||||
var fullscreen: 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
|
||||
@@ -27,11 +28,11 @@ var edit_players: bool = false
|
||||
var currently_syncing: bool = false
|
||||
var character_select_open: bool = false
|
||||
|
||||
var version: String = "1.8.0"
|
||||
var version: String = "1.9.0"
|
||||
|
||||
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:
|
||||
print("request done to address: ", default_path + address)
|
||||
print("request done to address: ", default_path + address + " response_code: ", response_code)
|
||||
if response_code == 200:
|
||||
print("func_name: ", func_name.get_method())
|
||||
if !expect_data:
|
||||
@@ -62,7 +63,7 @@ func make_request2(address: String, func_name: Callable, expect_data: bool) -> v
|
||||
|
||||
func make_request3(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)
|
||||
print("request done to address: ", default_path + address + " response_code: ", response_code)
|
||||
if response_code != 200:
|
||||
print("Error: " + str(response_code))
|
||||
|
||||
@@ -76,7 +77,7 @@ func make_request3(address: String) -> void:
|
||||
|
||||
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)
|
||||
print("request done to address: ", default_path + address + " response_code: ", response_code)
|
||||
if response_code != 200:
|
||||
print("Error: " + str(response_code))
|
||||
|
||||
@@ -96,12 +97,5 @@ func delete_children(node: Node) -> void:
|
||||
|
||||
func delete_player_children(node: Node) -> void:
|
||||
for n: Node in node.get_children():
|
||||
print(n)
|
||||
print(n.name)
|
||||
if n.name == "HBoxContainer":
|
||||
pass
|
||||
elif n.name == "AddPlayerContainer":
|
||||
pass
|
||||
else:
|
||||
node.remove_child(n)
|
||||
n.queue_free()
|
||||
node.remove_child(n)
|
||||
n.queue_free()
|
||||
@@ -51,6 +51,15 @@ 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
|
||||
|
||||
@@ -80,6 +89,8 @@ func _ready() -> void:
|
||||
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)
|
||||
local_button.pressed.connect(local_play)
|
||||
|
||||
@@ -93,7 +104,9 @@ func _ready() -> void:
|
||||
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
|
||||
update_hide_for_seconds_enabled()
|
||||
select_server_button.select(Settings.selected_server)
|
||||
select_server_button.item_selected.connect(select_server)
|
||||
|
||||
@@ -128,6 +141,11 @@ func low_played() -> void:
|
||||
|
||||
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
|
||||
@@ -167,6 +185,18 @@ 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:
|
||||
print("select_server")
|
||||
Settings.default_path = select_server_button.get_item_text(new_server)
|
||||
|
||||
+62
-32
@@ -1,11 +1,11 @@
|
||||
[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"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_3xrlm"]
|
||||
font_size = 25
|
||||
|
||||
[node name="SettingsControl" type="Control"]
|
||||
[node name="SettingsControl" type="Control" unique_id=1298840328]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -14,30 +14,30 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_bt55j")
|
||||
|
||||
[node name="SettingsPanel" type="Panel" 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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[node name="Label" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1111531402]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Settings"
|
||||
label_settings = SubResource("LabelSettings_3xrlm")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="StopAfterCurrentCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="StopAfterCurrentCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=508305575]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
@@ -45,7 +45,7 @@ button_pressed = true
|
||||
action_mode = 0
|
||||
text = "Stop after current"
|
||||
|
||||
[node name="HideNextTrackCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="HideNextTrackCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1568244599]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
@@ -53,54 +53,84 @@ button_pressed = true
|
||||
action_mode = 0
|
||||
text = "Hide next track"
|
||||
|
||||
[node name="AddToDatabaseCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="AddToDatabaseCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1673750542]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
action_mode = 0
|
||||
text = "Turn on played to database"
|
||||
|
||||
[node name="LowPlayedCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="LowPlayedCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1672657048]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
action_mode = 0
|
||||
text = "Use low played mode"
|
||||
|
||||
[node name="HideBeginningCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[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="HideLengthCheckButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="HideForSecondsHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=1368485120]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HideForSecondsTitle" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1822369383]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Hide Start Seconds: "
|
||||
|
||||
[node name="HideForSecondsLabel" type="Label" parent="SettingsPanel/ScrollContainer/VBoxContainer/HideForSecondsHBoxContainer" unique_id=1580108945]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "5.0"
|
||||
|
||||
[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)
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "-1"
|
||||
|
||||
[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)
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "+1"
|
||||
|
||||
[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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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
|
||||
@@ -108,7 +138,7 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "-1"
|
||||
|
||||
[node name="IncreaseButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/HBoxContainer"]
|
||||
[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
|
||||
@@ -116,19 +146,19 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "+1"
|
||||
|
||||
[node name="CacheHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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
|
||||
@@ -136,7 +166,7 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "-1"
|
||||
|
||||
[node name="IncreaseCacheButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/CacheHBoxContainer"]
|
||||
[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
|
||||
@@ -144,19 +174,19 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "+1"
|
||||
|
||||
[node name="InspirationHBoxContainer" type="HBoxContainer" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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"]
|
||||
[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
|
||||
@@ -164,7 +194,7 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "-1"
|
||||
|
||||
[node name="IncreaseInspirationSpeedButton" type="Button" parent="SettingsPanel/ScrollContainer/VBoxContainer/InspirationHBoxContainer"]
|
||||
[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
|
||||
@@ -172,7 +202,7 @@ focus_mode = 0
|
||||
action_mode = 0
|
||||
text = "+1"
|
||||
|
||||
[node name="SelectServerButton" type="OptionButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="SelectServerButton" type="OptionButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=434350694]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
selected = 0
|
||||
@@ -188,13 +218,13 @@ popup/item_3/id = 4
|
||||
popup/item_4/text = "http://localhost:8080"
|
||||
popup/item_4/id = 5
|
||||
|
||||
[node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="FullscreenButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=400304684]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
text = "Fullscreen"
|
||||
|
||||
[node name="QuickSyncButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="QuickSyncButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=49497448]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
@@ -202,7 +232,7 @@ button_pressed = true
|
||||
action_mode = 0
|
||||
text = "Quick sync"
|
||||
|
||||
[node name="LocalButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer"]
|
||||
[node name="LocalButton" type="CheckButton" parent="SettingsPanel/ScrollContainer/VBoxContainer" unique_id=905844805]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
+7
-7
@@ -6,7 +6,7 @@ var song_number: int
|
||||
|
||||
var song_title: String
|
||||
|
||||
var game_title: String
|
||||
var soundtrack_title: String
|
||||
|
||||
var players_given_point: Array[int] = []
|
||||
|
||||
@@ -18,9 +18,9 @@ var is_playing: bool = false
|
||||
|
||||
var song: AudioStream
|
||||
|
||||
func get_game_title() -> String:
|
||||
func get_soundtrack_title() -> String:
|
||||
if is_answered:
|
||||
return game_title
|
||||
return soundtrack_title
|
||||
else:
|
||||
return "????????"
|
||||
|
||||
@@ -33,10 +33,10 @@ func get_song_title() -> String:
|
||||
func get_song_info() -> String:
|
||||
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]
|
||||
return format_string % [(song_number + 1), soundtrack_title, song_title, has_played, is_answered]
|
||||
elif is_answered:
|
||||
var format_string: String = "%d. %s - %s"
|
||||
return format_string % [(song_number + 1), game_title, song_title]
|
||||
return format_string % [(song_number + 1), soundtrack_title, song_title]
|
||||
else:
|
||||
return "??? - ???"
|
||||
|
||||
@@ -52,5 +52,5 @@ func remove_point(id: int) -> void:
|
||||
players_given_point.sort()
|
||||
|
||||
func _to_string() -> String:
|
||||
var format_string: String = "song_number: %d | game_title: %s | song_title: %s | is_answered: %s | has_played: %s | is_playing: %s"
|
||||
return format_string % [(song_number), game_title, song_title, is_answered, has_played, is_playing]
|
||||
var format_string: String = "song_number: %d | soundtrack_title: %s | song_title: %s | is_answered: %s | has_played: %s | is_playing: %s"
|
||||
return format_string % [(song_number), soundtrack_title, song_title, is_answered, has_played, is_playing]
|
||||
+74
-60
@@ -1,11 +1,11 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dpdem7pdxweb5"]
|
||||
[gd_scene 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"]
|
||||
[node name="Control2" type="Control" unique_id=1302914356]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -14,22 +14,22 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_8ba47")
|
||||
|
||||
[node name="SyncPanel" type="Panel" parent="."]
|
||||
[node name="SyncPanel" type="Panel" parent="." unique_id=1714634204]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 640.0
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="SyncPanel"]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="SyncPanel" unique_id=1289116349]
|
||||
layout_mode = 0
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 640.0
|
||||
|
||||
[node name="SyncVBoxContainer" type="VBoxContainer" parent="SyncPanel/ScrollContainer"]
|
||||
[node name="SyncVBoxContainer" type="VBoxContainer" parent="SyncPanel/ScrollContainer" unique_id=1594735567]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="SyncTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
|
||||
[node name="SyncTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=2125198054]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
@@ -37,7 +37,13 @@ text = "Sync"
|
||||
label_settings = SubResource("LabelSettings_anbfi")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="NoChangesLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
|
||||
[node name="SyncTime" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=1344333200]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Sync time: "
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="NoChangesLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=1059308183]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
@@ -46,12 +52,12 @@ text = "No changes since last sync"
|
||||
label_settings = SubResource("LabelSettings_anbfi")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ProgressHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
|
||||
[node name="ProgressHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=196414805]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SyncProgressBar" type="ProgressBar" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/ProgressHBoxContainer"]
|
||||
[node name="SyncProgressBar" type="ProgressBar" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/ProgressHBoxContainer" unique_id=719135231]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1000, 0)
|
||||
layout_mode = 2
|
||||
@@ -59,92 +65,100 @@ size_flags_horizontal = 6
|
||||
step = 1.0
|
||||
rounded = true
|
||||
|
||||
[node name="SyncHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer"]
|
||||
[node name="SyncHBoxContainer" type="HBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=1156646398]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_horizontal = 6
|
||||
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"]
|
||||
[node name="VSeparator6" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1432793432]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GamesAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesAddedVBox"]
|
||||
[node name="SoundtracksAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=897546696]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "GamesAdded"
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="SoundtracksAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksAddedVBox" unique_id=535797768]
|
||||
layout_mode = 2
|
||||
text = "SoundtracksAdded"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="GamesAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
|
||||
[node name="SoundtracksAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=853642947]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GamesReAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
|
||||
[node name="SoundtracksReAddedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=995736806]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="SoundtracksReAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksReAddedVBox" unique_id=1142636525]
|
||||
layout_mode = 2
|
||||
text = "SoundtracksReAdded"
|
||||
|
||||
[node name="SoundtracksReAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1872445446]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GamesReAddedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesReAddedVBox"]
|
||||
[node name="SoundtracksChangedTitleVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=294212033]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "GamesReAdded"
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="GamesReAddedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
|
||||
[node name="SoundtracksChangedTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksChangedTitleVBox" unique_id=696960827]
|
||||
layout_mode = 2
|
||||
text = "SoundtracksChangedTitle"
|
||||
|
||||
[node name="SoundtracksChangedTitleSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1730403036]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GamesChangedTitleVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
|
||||
[node name="SoundtracksChangedContentVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1470922281]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="SoundtracksChangedContentLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksChangedContentVBox" unique_id=1209639099]
|
||||
layout_mode = 2
|
||||
text = "SoundtracksChangedContent"
|
||||
|
||||
[node name="SoundtracksChangedContentSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=626592535]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GamesChangedTitleLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/GamesChangedTitleVBox"]
|
||||
[node name="SoundtracksRemovedVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=1174594338]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "GamesChangedTitle"
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="GamesChangedTitleSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer"]
|
||||
[node name="SoundtracksRemovedLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer/SoundtracksRemovedVBox" unique_id=877713862]
|
||||
layout_mode = 2
|
||||
text = "SoundtracksRemoved"
|
||||
|
||||
[node name="SoundtracksRemovedSeparator" type="VSeparator" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/SyncHBoxContainer" unique_id=839653516]
|
||||
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"]
|
||||
[node name="CatchedErrorsVBox" type="VBoxContainer" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=63733711]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CatchedErrorsLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/CatchedErrorsVBox"]
|
||||
[node name="CatchedErrorsLabel" type="Label" parent="SyncPanel/ScrollContainer/SyncVBoxContainer/CatchedErrorsVBox" unique_id=1784389644]
|
||||
layout_mode = 2
|
||||
text = "CatchedErrors"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="SyncTimer" type="Timer" parent="."]
|
||||
[node name="RestartSyncButton" type="Button" parent="SyncPanel/ScrollContainer/SyncVBoxContainer" unique_id=372442237]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(200, 80)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "Restart Sync"
|
||||
|
||||
[node name="SyncTimer" type="Timer" parent="." unique_id=1955169547]
|
||||
unique_name_in_owner = true
|
||||
@@ -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
|
||||
+1
-1
@@ -39,7 +39,7 @@ func set_character_name(character_name: String) -> void:
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if self.visible == true && Settings.character_select_open == true:
|
||||
if event is InputEventMouseButton && event.is_pressed():
|
||||
if event is InputEventMouseButton && event.is_pressed() && event.get_button_index() == MOUSE_BUTTON_LEFT:
|
||||
var evLocal: InputEvent = make_input_local(event)
|
||||
if Rect2(Vector2(0, 0), panel.size).has_point(evLocal.position):
|
||||
print(character_name_label.text)
|
||||
|
||||
@@ -12,6 +12,8 @@ var character_grid: GridContainer = %CharacterGridContainer
|
||||
@onready
|
||||
var close_timer: Timer = %CloseTimer
|
||||
|
||||
var can_select_character: bool = false
|
||||
|
||||
signal character_selected(file_name: String)
|
||||
signal new_new_character_selected(file_name: String)
|
||||
|
||||
@@ -50,13 +52,16 @@ func show_grid(player_name: String) -> void:
|
||||
title_label.text = "Select character for " + player_name
|
||||
close_timer.stop()
|
||||
self.visible = true
|
||||
can_select_character = 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()
|
||||
if can_select_character:
|
||||
new_new_character_selected.emit(texture)
|
||||
close_timer.start()
|
||||
can_select_character = false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if self.visible == true:
|
||||
|
||||
+2
-2
@@ -70,8 +70,8 @@ func unset_is_playing() -> void:
|
||||
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_soundtrack_title() -> String:
|
||||
return song_object_array[currently_playing_song].get_soundtrack_title()
|
||||
|
||||
func get_current_song_title() -> String:
|
||||
return song_object_array[currently_playing_song].get_song_title()
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||
|
||||
config/name="MusicPlayer"
|
||||
run/main_scene="res://MainWindow.tscn"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/features=PackedStringArray("4.7", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
+5
-5
@@ -1,10 +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 soundtracks_added: Array
|
||||
var soundtracks_re_added: Array
|
||||
var soundtracks_changed_title: Array
|
||||
var soundtracks_changed_content: Array
|
||||
var soundtracks_removed: Array
|
||||
var catched_errors: Array
|
||||
var total_time: String
|
||||
+116
-55
@@ -19,34 +19,34 @@ var sync_hbox: HBoxContainer = %SyncHBoxContainer
|
||||
var sync_progress_bar: ProgressBar = %SyncProgressBar
|
||||
|
||||
@onready
|
||||
var games_added_vbox: VBoxContainer = %GamesAddedVBox
|
||||
var soundtracks_added_vbox: VBoxContainer = %SoundtracksAddedVBox
|
||||
|
||||
@onready
|
||||
var games_added_separator: VSeparator = %GamesAddedSeparator
|
||||
var soundtracks_added_separator: VSeparator = %SoundtracksAddedSeparator
|
||||
|
||||
@onready
|
||||
var games_readded_vbox: VBoxContainer = %GamesReAddedVBox
|
||||
var soundtracks_readded_vbox: VBoxContainer = %SoundtracksReAddedVBox
|
||||
|
||||
@onready
|
||||
var games_readded_separator: VSeparator = %GamesReAddedSeparator
|
||||
var soundtracks_readded_separator: VSeparator = %SoundtracksReAddedSeparator
|
||||
|
||||
@onready
|
||||
var games_changed_title_vbox: VBoxContainer = %GamesChangedTitleVBox
|
||||
var soundtracks_changed_title_vbox: VBoxContainer = %SoundtracksChangedTitleVBox
|
||||
|
||||
@onready
|
||||
var games_changed_title_separator: VSeparator = %GamesChangedTitleSeparator
|
||||
var soundtracks_changed_title_separator: VSeparator = %SoundtracksChangedTitleSeparator
|
||||
|
||||
@onready
|
||||
var games_changed_content_vbox: VBoxContainer = %GamesChangedContentVBox
|
||||
var soundtracks_changed_content_vbox: VBoxContainer = %SoundtracksChangedContentVBox
|
||||
|
||||
@onready
|
||||
var games_changed_content_separator: VSeparator = %GamesChangedContentSeparator
|
||||
var soundtracks_changed_content_separator: VSeparator = %SoundtracksChangedContentSeparator
|
||||
|
||||
@onready
|
||||
var games_removed_vbox: VBoxContainer = %GamesRemovedVBox
|
||||
var soundtracks_removed_vbox: VBoxContainer = %SoundtracksRemovedVBox
|
||||
|
||||
@onready
|
||||
var games_removed_separator: VSeparator = %GamesRemovedSeparator
|
||||
var soundtracks_removed_separator: VSeparator = %SoundtracksRemovedSeparator
|
||||
|
||||
@onready
|
||||
var catched_errors_vbox: VBoxContainer = %CatchedErrorsVBox
|
||||
@@ -57,6 +57,12 @@ var sync_time: Label = %SyncTime
|
||||
@onready
|
||||
var sync_timer: Timer = %SyncTimer
|
||||
|
||||
@onready
|
||||
var restart_sync_button: Button = %RestartSyncButton
|
||||
|
||||
@onready
|
||||
var first_separator: VSeparator = %VSeparator6
|
||||
|
||||
var changes: bool = false
|
||||
|
||||
var has_synced: bool = false
|
||||
@@ -66,6 +72,8 @@ signal sync_finished
|
||||
|
||||
func _ready() -> void:
|
||||
sync_timer.timeout.connect(_on_sync_timeout)
|
||||
restart_sync_button.pressed.connect(start_sync)
|
||||
restart_sync_button.visible = false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if self.visible == true:
|
||||
@@ -74,17 +82,30 @@ func _input(event: InputEvent) -> void:
|
||||
if !Rect2(Vector2(0, 0), sync_panel.size).has_point(evLocal.position):
|
||||
self.visible = false
|
||||
|
||||
func show_section_if_has_data(data: Variant, vbox: VBoxContainer, separator: VSeparator, header_text: String) -> bool:
|
||||
if data != null && data.size() > 0:
|
||||
vbox.visible = true
|
||||
make_list(data, vbox, header_text)
|
||||
return true
|
||||
else:
|
||||
vbox.visible = false
|
||||
separator.visible = false
|
||||
return 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)
|
||||
if has_synced:
|
||||
# Already synced, just show the results
|
||||
show_sync_result()
|
||||
return
|
||||
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!")
|
||||
@@ -94,7 +115,7 @@ func _on_sync_timeout() -> void:
|
||||
if data_received != null:
|
||||
if data_received.has("progress"):
|
||||
sync_progress_bar.value = int(data_received.progress)
|
||||
sync_time.text = data_received.time_spent
|
||||
sync_time.text = data_received.time_spent if data_received.has("time_spent") else ""
|
||||
else:
|
||||
on_sync_finished(data_received)
|
||||
Settings.make_request2("/sync/progress", get_progress, true)
|
||||
@@ -102,43 +123,77 @@ func _on_sync_timeout() -> void:
|
||||
func on_sync_finished(data_received: Dictionary) -> void:
|
||||
has_synced = true
|
||||
reset_sync_result()
|
||||
if data_received.games_added != null:
|
||||
|
||||
if show_section_if_has_data(data_received.soundtracks_added, soundtracks_added_vbox, soundtracks_added_separator, "Added"):
|
||||
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:
|
||||
|
||||
if show_section_if_has_data(data_received.soundtracks_re_added, soundtracks_readded_vbox, soundtracks_readded_separator, "ReAdded"):
|
||||
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:
|
||||
|
||||
if data_received.soundtracks_changed_title != null && data_received.soundtracks_changed_title.size() > 0:
|
||||
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")
|
||||
Settings.delete_children(soundtracks_changed_title_vbox)
|
||||
make_header_label(soundtracks_changed_title_vbox, "Changed Title")
|
||||
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])
|
||||
for old_soundtrack_title: String in data_received.soundtracks_changed_title:
|
||||
var label: Label = make_soundtrack_label(old_soundtrack_title + "\nchanged title to\n" + data_received.soundtracks_changed_title[old_soundtrack_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:
|
||||
soundtracks_changed_title_vbox.add_child(label)
|
||||
row += 1
|
||||
soundtracks_changed_title_vbox.visible = true
|
||||
|
||||
if show_section_if_has_data(data_received.soundtracks_changed_content, soundtracks_changed_content_vbox, soundtracks_changed_content_separator, "Changed Content"):
|
||||
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:
|
||||
|
||||
if show_section_if_has_data(data_received.soundtracks_removed, soundtracks_removed_vbox, soundtracks_removed_separator, "Removed"):
|
||||
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:
|
||||
|
||||
if data_received.catched_errors != null && data_received.catched_errors.size() > 0:
|
||||
catched_errors_vbox.visible = true
|
||||
make_list(data_received.catched_errors, catched_errors_vbox, "CatchedErrors")
|
||||
|
||||
# Hide separators that don't have a visible section after them
|
||||
# The structure is: RestartSyncButton -> VSeparator6 -> VBox -> Separator -> VBox -> Separator -> ...
|
||||
# Hide VSeparator6 if there are no visible sections
|
||||
var visible_sections: Array = []
|
||||
if soundtracks_added_vbox.visible:
|
||||
visible_sections.append("added")
|
||||
if soundtracks_readded_vbox.visible:
|
||||
visible_sections.append("readded")
|
||||
if soundtracks_changed_title_vbox.visible:
|
||||
visible_sections.append("changed_title")
|
||||
if soundtracks_changed_content_vbox.visible:
|
||||
visible_sections.append("changed_content")
|
||||
if soundtracks_removed_vbox.visible:
|
||||
visible_sections.append("removed")
|
||||
|
||||
first_separator.visible = visible_sections.size() > 1
|
||||
|
||||
# Show section separators only if there's a visible section after them
|
||||
for i in range(visible_sections.size()):
|
||||
var section = visible_sections[i]
|
||||
var separator_map = {
|
||||
"added": soundtracks_added_separator,
|
||||
"readded": soundtracks_readded_separator,
|
||||
"changed_title": soundtracks_changed_title_separator,
|
||||
"changed_content": soundtracks_changed_content_separator,
|
||||
"removed": soundtracks_removed_separator
|
||||
}
|
||||
# Show this section's separator only if there's a next section
|
||||
if i < visible_sections.size() - 1:
|
||||
separator_map[section].visible = true
|
||||
else:
|
||||
separator_map[section].visible = false
|
||||
|
||||
if !changes:
|
||||
no_changes_label.visible = true
|
||||
sync_time.text = data_received.total_time
|
||||
sync_time.text = "Total time: " + data_received.total_time if data_received.has("total_time") else ""
|
||||
Settings.currently_syncing = false
|
||||
sync_timer.stop()
|
||||
print("sync finished")
|
||||
show_sync_result()
|
||||
restart_sync_button.visible = true
|
||||
sync_finished.emit()
|
||||
|
||||
func list_visible(vbox: VBoxContainer, seperator: VSeparator) -> void:
|
||||
@@ -150,15 +205,16 @@ func make_header_label(vbox: VBoxContainer, text: String) -> void:
|
||||
label.set_texture_filter(TextureFilter.TEXTURE_FILTER_NEAREST)
|
||||
label.add_theme_font_size_override("font_size", 20)
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.add_theme_color_override("font_color", Color(1, 0.5, 0))
|
||||
label.text = text
|
||||
vbox.add_child(label)
|
||||
|
||||
func make_game_label(text: String) -> Label:
|
||||
func make_soundtrack_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.add_theme_font_size_override("font_size", 18)
|
||||
label.text = text
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_OFF
|
||||
return label
|
||||
|
||||
func reset_sync_result() -> void:
|
||||
@@ -166,32 +222,35 @@ func reset_sync_result() -> void:
|
||||
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
|
||||
soundtracks_added_vbox.visible = false
|
||||
soundtracks_added_separator.visible = false
|
||||
soundtracks_readded_vbox.visible = false
|
||||
soundtracks_readded_separator.visible = false
|
||||
soundtracks_changed_title_vbox.visible = false
|
||||
soundtracks_changed_title_separator.visible = false
|
||||
soundtracks_changed_content_vbox.visible = false
|
||||
soundtracks_changed_content_separator.visible = false
|
||||
soundtracks_removed_vbox.visible = false
|
||||
soundtracks_removed_separator.visible = false
|
||||
catched_errors_vbox.visible = false
|
||||
first_separator.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)
|
||||
for soundtrack: String in list:
|
||||
var label: Label = make_soundtrack_label(soundtrack)
|
||||
if row % 2 != 0:
|
||||
label.add_theme_color_override("font_color", Color(1, 0.5, 0))
|
||||
vbox.add_child(label)
|
||||
row += 1
|
||||
|
||||
func show_sync_result() -> void:
|
||||
sync_title_label.text = "Sync Result"
|
||||
progress_hbox.visible = false
|
||||
sync_hbox.visible = true
|
||||
restart_sync_button.visible = true
|
||||
|
||||
func show_sync_progress() -> void:
|
||||
sync_title_label.text = "Sync in Progress"
|
||||
@@ -199,3 +258,5 @@ func show_sync_progress() -> void:
|
||||
no_changes_label.visible = false
|
||||
sync_hbox.visible = false
|
||||
catched_errors_vbox.visible = false
|
||||
restart_sync_button.visible = false
|
||||
first_separator.visible = false
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://dxpb22xbwf3t1
|
||||
Reference in new issue
Block a user