server: sending connected client names instead of count on every (dis)connect

This commit is contained in:
2025-07-07 09:58:34 +02:00
parent 63869dc530
commit a2bab58d3f
5 changed files with 58 additions and 47 deletions
+24 -23
View File
@@ -26,14 +26,14 @@ layout_mode = 2
color = Color(0.26, 0.2236, 0.230273, 1)
script = ExtResource("2_e2o6t")
client = NodePath("../../WebClientTCP")
connect_button = NodePath("MarginContainer/VBoxContainer/VBoxContainer/ConnectButton")
create_lobby_button = NodePath("MarginContainer/VBoxContainer/VBoxContainer/CreateLobbyButton")
join_lobby_button = NodePath("MarginContainer/VBoxContainer/VBoxContainer/JoinLobbyButton")
leave_lobby_button = NodePath("MarginContainer/VBoxContainer/VBoxContainer/LeaveLobbyButton")
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("MarginContainer/VBoxContainer/ChatContainer/MessageInput")
send_chat_message_button = NodePath("MarginContainer/VBoxContainer/ChatContainer/SendMessageButton")
name_input = NodePath("MarginContainer/VBoxContainer/VBoxContainer/NameInput")
lobby_code_input = NodePath("MarginContainer/VBoxContainer/VBoxContainer/LobbyCodeInput")
name_input = NodePath("MarginContainer/VBoxContainer/ServerInputs/NameInput")
lobby_code_input = NodePath("MarginContainer/VBoxContainer/ServerInputs/LobbyCodeInput")
output = NodePath("MarginContainer/VBoxContainer/ScrollContainer/Output")
[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/ClientInterface"]
@@ -59,39 +59,40 @@ bbcode_enabled = true
text = "[i]Magician Online![/i]"
fit_content = true
[node name="URLInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer"]
layout_mode = 2
placeholder_text = "URL"
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer"]
[node name="ServerInputs" type="VBoxContainer" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer"]
custom_minimum_size = Vector2(300, 0)
layout_mode = 2
[node name="ConnectButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="URLInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
text = "127.0.0.1:9974"
placeholder_text = "URL"
[node name="ConnectButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
text = "Connect to Server"
[node name="NameInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="NameInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
placeholder_text = "Your Name"
editable = false
[node name="CreateLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="CreateLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
disabled = true
text = "Create Lobby"
[node name="LobbyCodeInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="LobbyCodeInput" type="LineEdit" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
placeholder_text = "Lobby Code"
editable = false
[node name="JoinLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="JoinLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
disabled = true
text = "Join Lobby"
[node name="LeaveLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer"]
[node name="LeaveLobbyButton" type="Button" parent="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs"]
layout_mode = 2
disabled = true
text = "Disconnect"
@@ -152,11 +153,11 @@ text = "Start Game!"
[connection signal="disconnected_from_lobby" from="WebClientTCP" to="HBoxContainer/ClientInterface" method="_on_web_client_tcp_disconnected_from_lobby"]
[connection signal="disconnected_from_server" from="WebClientTCP" to="HBoxContainer/ClientInterface" method="_on_web_client_tcp_disconnected_from_server"]
[connection signal="received_chat_message" from="WebClientTCP" to="HBoxContainer/ClientInterface" method="_on_web_client_tcp_received_chat_message"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/ConnectButton" to="HBoxContainer/ClientInterface" method="_on_connect_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/CreateLobbyButton" to="HBoxContainer/ClientInterface" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/CreateLobbyButton" to="HBoxContainer/GameUI" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/JoinLobbyButton" to="HBoxContainer/ClientInterface" method="_on_join_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/JoinLobbyButton" to="HBoxContainer/GameUI" method="_on_join_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/VBoxContainer/LeaveLobbyButton" to="HBoxContainer/ClientInterface" method="_on_disconnect_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/ConnectButton" to="HBoxContainer/ClientInterface" method="_on_connect_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/CreateLobbyButton" to="HBoxContainer/ClientInterface" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/CreateLobbyButton" to="HBoxContainer/GameUI" method="_on_create_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/JoinLobbyButton" to="HBoxContainer/ClientInterface" method="_on_join_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/JoinLobbyButton" to="HBoxContainer/GameUI" method="_on_join_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ServerInputs/LeaveLobbyButton" to="HBoxContainer/ClientInterface" method="_on_disconnect_lobby_button_pressed"]
[connection signal="pressed" from="HBoxContainer/ClientInterface/MarginContainer/VBoxContainer/ChatContainer/SendMessageButton" to="HBoxContainer/ClientInterface" method="_on_send_message_button_pressed"]
[connection signal="pressed" from="HBoxContainer/GameUI/StartGameButton" to="HBoxContainer/GameUI" method="_on_start_game_button_pressed"]