clients now auto-connect to server, omitting the connection step and hiding the server URL from the frontend

This commit is contained in:
2025-07-20 15:02:05 +02:00
parent f11cb19348
commit b97d454402
11 changed files with 385 additions and 635 deletions
+48 -146
View File
@@ -1,6 +1,6 @@
[gd_scene load_steps=13 format=3 uid="uid://gqrdpjslr4np"]
[gd_scene load_steps=14 format=3 uid="uid://gqrdpjslr4np"]
[ext_resource type="Script" uid="uid://p5gvnyhjqe6o" path="res://components/web_client_tcp.gd" id="1_feb5d"]
[ext_resource type="Script" uid="uid://p5gvnyhjqe6o" path="res://components/web_client.gd" id="1_feb5d"]
[ext_resource type="Script" uid="uid://c0cqkatyo4uj1" path="res://components/client_interface.gd" id="2_e2o6t"]
[ext_resource type="Theme" uid="uid://7bv5whocnq53" path="res://theme.tres" id="2_hve3p"]
[ext_resource type="Script" uid="uid://utt8atbh7b2a" path="res://game_client.gd" id="3_feb5d"]
@@ -8,6 +8,7 @@
[ext_resource type="PackedScene" uid="uid://jlovgr2iojrg" path="res://elements/player_hand.tscn" id="4_fc0e3"]
[ext_resource type="Script" uid="uid://bfhknl0awlj22" path="res://chat_panel.gd" id="4_iotsf"]
[ext_resource type="Script" uid="uid://bokp83oigikj2" path="res://number_input.gd" id="4_vef74"]
[ext_resource type="Script" uid="uid://b6m5e50j1syr7" path="res://connection_overlay.gd" id="5_iotsf"]
[ext_resource type="PackedScene" uid="uid://b55xpcxk7g5ph" path="res://cards/playing_card.tscn" id="6_eow3j"]
[ext_resource type="PackedScene" uid="uid://dj1wye7o27vil" path="res://assets/table.glb" id="7_eow3j"]
[ext_resource type="Script" uid="uid://c5bk4gjeyh7vy" path="res://card_stack.gd" id="8_j5wjh"]
@@ -19,8 +20,9 @@ ambient_light_energy = 0.15
[node name="Game" type="Node"]
[node name="WebClient" type="Node" parent="."]
[node name="WebClient" type="Node" parent="." node_paths=PackedStringArray("chat_panel")]
script = ExtResource("1_feb5d")
chat_panel = NodePath("../Interface/ChatPanel")
[node name="Interface" type="Control" parent="."]
layout_mode = 3
@@ -32,7 +34,7 @@ grow_vertical = 2
theme = ExtResource("2_hve3p")
metadata/_edit_use_anchors_ = true
[node name="ClientInterface" type="ColorRect" parent="Interface" node_paths=PackedStringArray("client", "connect_button", "create_lobby_button", "join_lobby_button", "leave_lobby_button", "chat_message_input", "send_chat_message_button", "connected_players_label", "name_input", "lobby_code_input")]
[node name="ClientInterface" type="ColorRect" parent="Interface" node_paths=PackedStringArray("client", "create_lobby_button", "join_lobby_button", "leave_lobby_button", "connected_players_label", "name_input", "lobby_code_input")]
custom_minimum_size = Vector2(316, 0)
layout_mode = 2
offset_right = 316.0
@@ -40,12 +42,9 @@ offset_bottom = 429.0
color = Color(0.26, 0.2236, 0.230273, 1)
script = ExtResource("2_e2o6t")
client = NodePath("../../WebClient")
connect_button = NodePath("MarginContainer/VBoxContainer/ServerInputs/ConnectButton")
create_lobby_button = NodePath("MarginContainer/VBoxContainer/ServerInputs/CreateLobbyButton")
join_lobby_button = NodePath("MarginContainer/VBoxContainer/ServerInputs/JoinLobbyButton")
leave_lobby_button = NodePath("MarginContainer/VBoxContainer/ServerInputs/LeaveLobbyButton")
chat_message_input = NodePath("../ChatPanel/InputContainer/MessageInput")
send_chat_message_button = NodePath("../ChatPanel/InputContainer/SendMessageButton")
connected_players_label = NodePath("MarginContainer/VBoxContainer/ConnectedPlayersLabel")
name_input = NodePath("MarginContainer/VBoxContainer/ServerInputs/NameInput")
lobby_code_input = NodePath("MarginContainer/VBoxContainer/ServerInputs/LobbyCodeInput")
@@ -69,15 +68,6 @@ layout_mode = 2
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
[node name="URLInput" type="LineEdit" parent="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
text = "127.0.0.1:9974"
placeholder_text = "URL"
[node name="ConnectButton" type="Button" parent="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
text = "Connect to Server"
[node name="NameInput" type="LineEdit" parent="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
placeholder_text = "Your Name"
@@ -112,6 +102,8 @@ anchors_preset = -1
anchor_top = 0.478704
anchor_right = 0.234375
anchor_bottom = 1.0
offset_right = -130.0
offset_bottom = 0.000244141
grow_vertical = 0
script = ExtResource("4_iotsf")
auto_scroll_duration = 0.4
@@ -130,136 +122,9 @@ vertical_scroll_mode = 4
[node name="MessageContainer" type="VBoxContainer" parent="Interface/ChatPanel/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 2
[node name="Label" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label2" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label3" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label4" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label5" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label6" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label7" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label8" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label9" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label10" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label11" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label12" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label13" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label14" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label15" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label16" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label17" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label18" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label19" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label20" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label21" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label22" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label23" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label24" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label25" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label26" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label27" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label28" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label29" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label30" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label31" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="Label32" type="Label" parent="Interface/ChatPanel/ScrollContainer/MessageContainer"]
layout_mode = 2
text = "asdf"
[node name="InputContainer" type="HBoxContainer" parent="Interface/ChatPanel"]
layout_mode = 2
@@ -272,6 +137,43 @@ placeholder_text = "Type chat message here"
layout_mode = 2
text = "Send"
[node name="LobbyPanel" type="Control" parent="Interface"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="ConnectionOverlay" type="Control" parent="Interface" node_paths=PackedStringArray("status_label")]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("5_iotsf")
status_label = NodePath("StatusLabel")
[node name="ColorRect" type="ColorRect" parent="Interface/ConnectionOverlay"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.47451, 0.180392, 0.603922, 1)
[node name="StatusLabel" type="Label" parent="Interface/ConnectionOverlay"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 28
text = "Connecting to server"
horizontal_alignment = 1
vertical_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
@@ -476,6 +378,8 @@ playing_card_scene = ExtResource("6_eow3j")
[connection signal="connected_to_server" from="WebClient" to="Interface/ClientInterface" method="_on_web_client_tcp_connected_to_server"]
[connection signal="connection_error_occurred" from="WebClient" to="Interface/ClientInterface" method="_on_web_client_tcp_connection_error_occurred"]
[connection signal="connection_status_changed" from="WebClient" to="Interface/ClientInterface" method="_on_web_client_tcp_connection_status_changed"]
[connection signal="connection_status_changed" from="WebClient" to="Interface/ChatPanel" method="_on_web_client_connection_status_changed"]
[connection signal="connection_status_changed" from="WebClient" to="Interface/ConnectionOverlay" method="_on_web_client_connection_status_changed"]
[connection signal="disconnected_from_lobby" from="WebClient" to="Interface/ClientInterface" method="_on_web_client_tcp_disconnected_from_lobby"]
[connection signal="disconnected_from_server" from="WebClient" to="Interface/ClientInterface" method="_on_web_client_tcp_disconnected_from_server"]
[connection signal="new_round_started" from="WebClient" to="EnvironmentManager" method="_on_web_client_tcp_new_round_started"]
@@ -497,8 +401,6 @@ playing_card_scene = ExtResource("6_eow3j")
[connection signal="reset_first_card" from="WebClient" to="EnvironmentManager/PlayerHand0" method="_on_web_client_tcp_reset_first_card"]
[connection signal="trump_received" from="WebClient" to="EnvironmentManager" method="_on_web_client_tcp_trump_received"]
[connection signal="trump_received" from="WebClient" to="EnvironmentManager/PlayerHand0" method="_on_web_client_tcp_trump_received"]
[connection signal="user_message_received" from="WebClient" to="Interface/ChatPanel" method="_on_web_client_user_message_received"]
[connection signal="pressed" from="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/ConnectButton" to="Interface/ClientInterface" method="_on_connect_button_pressed"]
[connection signal="pressed" from="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/CreateLobbyButton" to="Interface/ClientInterface" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/CreateLobbyButton" to="HBoxContainer/GameUI" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="Interface/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/JoinLobbyButton" to="Interface/ClientInterface" method="_on_join_lobby_button_pressed"]