Updated how players and song list works

Made many changes with caching, how players works, added sound effects
and animations any many more things
This commit is contained in:
2024-12-27 20:35:28 +01:00
parent c4a7d743d3
commit 23f2ed11eb
18 changed files with 612 additions and 359 deletions

View File

@@ -17,11 +17,16 @@ var fullscreen: bool = false
var quick_sync: bool = true
var play_local: bool = false
var number_of_players: int = 0
var player_array: Array[PlayerObject]
var song_object_array: Array[SongObject] = []
var latest_played_song: int = 0
var currently_playing_song: int = -1
var edit_players: bool = false
var version: String = "0.9.0-Beta"
var version: String = "1.5.0"
var whats_new: String = "Changelog:
1.5.0: Made big changes to players and the song list and how the local song list works
0.9.0-Beta: Fixed settings and updated the player view
0.8.0-Beta: Fixed reset buttons and some other small things
0.7.8-Beta: Added shortcuts. Added dialog for winner. Started cleaning code.
@@ -41,26 +46,20 @@ Alt + Z = Reset
Alt + X = Play/Pause
Alt + C = Next Song
Alt + V = Show Answer
Alt + Enter = Fullscreen"
#play = X
#nästa = c
#visa svar = v
#lägga till poäng? 1, 2, 3, 4, 5, 6
func get_next_player_id() -> int:
number_of_players += 1
return number_of_players
func player_removed() -> void:
number_of_players -= 1
Alt + Enter = Fullscreen
Alt + UP = Volume up
Alt + DOWN = Volume down
Alt + LEFT = Jump back in song
Alt + Ctrl = Restart song
Alt + RIGHT = Jump forward in song
Alt + 1, 2, 3, 4, 5, 6 = Give player point
Alt + Ctrl + 1, 2, 3, 4, 5, 6 = Take point from player"
func make_request2(address: String, func_name: Callable, expect_data: bool) -> void:
print("func_name: ", func_name.get_method())
print("get_object: ", func_name.get_object())
var error_handling: Callable = func(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
print("request done to address: ", default_path + address)
if response_code == 200:
print("func_name: ", func_name.get_method())
if !expect_data:
func_name.call()
else:
@@ -68,14 +67,14 @@ func make_request2(address: String, func_name: Callable, expect_data: bool) -> v
var error: int = json.parse(body.get_string_from_utf8())
if error == OK:
var data_received = json.get_data()
#print("data_received: ", data_received)
print("data_received type: ", typeof(data_received))
print("data_received type: ", type_string(typeof(data_received)))
if typeof(data_received) == TYPE_ARRAY:
func_name.call(data_received)
elif func_name != null:
func_name.call(data_received)
else:
print("song_received")
print("data_received type: ", type_string(typeof(body)))
func_name.call(body)
var http_request: HTTPRequest = HTTPRequest.new()
@@ -90,6 +89,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)
if response_code != 200:
print("Error: " + str(response_code))
@@ -105,3 +105,19 @@ func delete_children(node: Node) -> void:
for n: Node in node.get_children():
node.remove_child(n)
n.queue_free()
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()
func unset_is_playing() -> void:
for song_object: SongObject in song_object_array:
song_object.is_playing = false