73 lines
2.5 KiB
Text
73 lines
2.5 KiB
Text
[gd_scene load_steps=4 format=3 uid="uid://cj8weoqksmfm6"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://b5m5h30gog3pu" path="res://scenes/game_scene.tscn" id="1_78s5d"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_78s5d"]
|
|
script/source = "extends Node
|
|
|
|
@export var game_scene : PackedScene
|
|
|
|
func _on_client_node_connection_changed(connected: int) -> void:
|
|
print(\"CONNECTION CHANGED: \", connected)
|
|
if connected == NetworkData.CONNECTION_AUTHENTICATED:
|
|
var instance = game_scene.instantiate()
|
|
if instance:
|
|
$PanelContainer.queue_free()
|
|
add_child(instance)
|
|
"
|
|
|
|
[sub_resource type="GDScript" id="GDScript_xkpyy"]
|
|
script/source = "extends VBoxContainer
|
|
|
|
func _on_line_edit_text_submitted(new_text: String) -> void:
|
|
%ClientNode.connect_to_server(new_text)
|
|
|
|
func _on_button_pressed() -> void:
|
|
%ClientNode.connect_to_server($LineEdit.text)
|
|
"
|
|
|
|
[node name="GameRoot" type="Node"]
|
|
script = SubResource("GDScript_78s5d")
|
|
game_scene = ExtResource("1_78s5d")
|
|
|
|
[node name="ClientNode" type="ClientNode" parent="."]
|
|
_import_path = NodePath("")
|
|
unique_name_in_owner = true
|
|
process_mode = 0
|
|
process_priority = 0
|
|
process_physics_priority = 0
|
|
process_thread_group = 0
|
|
physics_interpolation_mode = 0
|
|
auto_translate_mode = 0
|
|
editor_description = ""
|
|
script = null
|
|
|
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
|
|
[node name="CenterContainer" type="CenterContainer" parent="PanelContainer"]
|
|
layout_mode = 2
|
|
|
|
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="PanelContainer/CenterContainer"]
|
|
layout_mode = 2
|
|
ratio = 4.127
|
|
stretch_mode = 1
|
|
|
|
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/CenterContainer/AspectRatioContainer"]
|
|
layout_mode = 2
|
|
script = SubResource("GDScript_xkpyy")
|
|
|
|
[node name="LineEdit" type="LineEdit" parent="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
placeholder_text = "IP Address"
|
|
|
|
[node name="Button" type="Button" parent="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer"]
|
|
layout_mode = 2
|
|
text = "Connect"
|
|
|
|
[connection signal="text_submitted" from="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer/LineEdit" to="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer" method="_on_line_edit_text_submitted"]
|
|
[connection signal="pressed" from="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer/Button" to="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer" method="_on_button_pressed"]
|