61 lines
1.7 KiB
GDScript
61 lines
1.7 KiB
GDScript
extends Node
|
|
|
|
#var default_path: String = "http://192.168.86.100:8085"
|
|
#var default_path: String = "https://music.sanplex.tech"
|
|
var default_path: String = "https://tmusic.sanplex.tech"
|
|
var selected_server = 0
|
|
|
|
var is_local: bool = false
|
|
|
|
var stop_after_current: bool = false
|
|
var hide_next_track: bool = false
|
|
var add_to_stats: bool = false
|
|
var use_low_played_mode: bool = false
|
|
var winning_score: int = 20
|
|
|
|
var version: String = "0.7.8-Beta"
|
|
var whats_new: String = "Changelog:
|
|
0.7.8-Beta: Added shortcuts. Added dialog for winner. Started cleaning code.
|
|
0.7.5-Beta: Added settings menu, most things don't do anythig yet
|
|
0.7-Beta: Can now hop between songs"
|
|
var whats_left: String = "Things left to do:
|
|
Fix reset buttons
|
|
Fix settings
|
|
Fix graphics in lists
|
|
Fix layout
|
|
Fix for local play
|
|
Change some buttons to icons"
|
|
|
|
var shortcuts: String = "Shortcuts:
|
|
Alt + S = Search
|
|
Alt + A = Add Players
|
|
Alt + X = Play/Pause
|
|
Alt + C = Next Song
|
|
Alt + V = Show Answer"
|
|
|
|
|
|
#play = X
|
|
#nästa = c
|
|
#visa svar = v
|
|
#lägga till poäng? 1, 2, 3, 4, 5, 6
|
|
|
|
|
|
func make_request2(address: String, func_name: Callable) -> void:
|
|
var error_handling = func(result, response_code, headers, body):
|
|
var json = JSON.new()
|
|
var error = json.parse(body.get_string_from_utf8())
|
|
if error == OK:
|
|
var data_received = json.get_data()
|
|
print("data_received: ", data_received)
|
|
func_name.call(data_received)
|
|
|
|
var http_request = HTTPRequest.new()
|
|
add_child(http_request)
|
|
http_request.request_completed.connect(error_handling)
|
|
|
|
# Perform a GET request. The URL below returns JSON as of writing.
|
|
var error = http_request.request(default_path + address)
|
|
if error != OK:
|
|
push_error("An error occurred in the HTTP request.")
|
|
|