Replace placeholder strings in labels (debug requests)

This commit is contained in:
2023-07-31 14:58:38 +02:00
parent 25215ea41a
commit 7acc8c5ee3
2 changed files with 8 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ extends HTTPRequest
var socket = WebSocketPeer.new()
var client_id
func InitWebsocket():
print("Connecting websocket ")
socket.max_queued_packets = 32768
@@ -35,6 +37,7 @@ func PollWebsocket():
print("Packet: ", packet.slice(0,5), "...")
if "welcome" in json:
print("Registered as client %s" % json["welcome"]["clientId"])
client_id = json["welcome"]["clientId"]
if "job" in json:
var job = json["job"]
print("Recevied Job ", job["jobId"])

View File

@@ -93,7 +93,11 @@ func RenderImage(def, zIndex):
func RenderLabel(def, zIndex):
var textNode = Label.new()
textNode.text = def["text"]
var labelText = def["text"]
labelText = labelText.replace('%nodeid%', $"/root/Main/JobServer".client_id)
labelText = labelText.replace('%servemode%', $"/root/Main".serve_mode)
textNode.text = labelText;
var pos = Vector2(float(def["x"]), float(def["y"]))
print("Rendering label '%s' at %s" % [def["text"], pos])