YouDunIt/flatscreen-project/network_test.tscn

72 lines
2 KiB
Text

[gd_scene load_steps=2 format=3 uid="uid://bbvpj46frv0ho"]
[sub_resource type="GDScript" id="GDScript_78ugl"]
script/source = "extends ClientNode
@onready
var client_status := %ClientStatus
func _ready():
connect_to_server(\"localhost\")
func _on_connection_changed(connected: int) -> void:
if (connected == NetworkData.CONNECTION_DISCONNECTED):
client_status.text = \"DISCONNECTED\"
elif (connected == NetworkData.CONNECTION_CONNECTED):
client_status.text = \"CONNECTED\"
elif (connected == NetworkData.CONNECTION_AUTHENTICATED):
client_status.text = \"AUTHENTICATED\"
"
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ServerNode" type="ServerNode" parent="."]
[node name="ClientNode" type="ClientNode" parent="."]
script = SubResource("GDScript_78ugl")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ServerInfo" type="PanelContainer" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Header" type="Label" parent="HBoxContainer/ServerInfo"]
layout_mode = 2
text = "Server: OFF"
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ServerInfo/Header"]
layout_mode = 0
offset_top = -312.0
offset_right = 574.0
offset_bottom = 336.0
[node name="ClientInfo" type="PanelContainer" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ClientInfo"]
layout_mode = 2
[node name="Header" type="Label" parent="HBoxContainer/ClientInfo/VBoxContainer"]
layout_mode = 2
text = "Client:"
[node name="ClientStatus" type="Label" parent="HBoxContainer/ClientInfo/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "DISCONNECTED"
[connection signal="connection_changed" from="ClientNode" to="ClientNode" method="_on_connection_changed"]