diff --git a/client/network/PlayerMove.gd b/client/network/PlayerMove.gd index 39a4ddb..ab628c0 100644 --- a/client/network/PlayerMove.gd +++ b/client/network/PlayerMove.gd @@ -21,6 +21,10 @@ func handle_packet(data: PackedByteArray, _peer: PacketPeer): return var controller := player.controller as ProxyController + + if !controller: + return + controller.server_position.x = x controller.server_position.z = z diff --git a/client/project.godot b/client/project.godot index 077f209..036909a 100644 --- a/client/project.godot +++ b/client/project.godot @@ -31,7 +31,7 @@ window/vsync/vsync_mode=0 [gui] -theme/custom="res://ui/theme.tres" +theme/custom="res://ui/theme/theme.tres" [input] diff --git a/client/ui/UI.gd b/client/ui/UI.gd index db0bd8c..5cf1b12 100644 --- a/client/ui/UI.gd +++ b/client/ui/UI.gd @@ -3,13 +3,13 @@ extends Control signal chat_message_submitted(message: String) -var on_ping_changed: Signal -var on_download_changed: Signal -var on_upload_changed: Signal -var on_message_received: Signal +var ping_changed: Signal +var download_changed: Signal +var upload_changed: Signal +var message_received: Signal func _enter_tree(): - on_ping_changed = %Ping.changed - on_download_changed = %Client.download_changed - on_upload_changed = %Client.upload_changed - on_message_received = %Chat.message_received + ping_changed = %Ping.changed + download_changed = %Client.download_changed + upload_changed = %Client.upload_changed + message_received = %Chat.message_received diff --git a/client/ui/UI.tscn b/client/ui/UI.tscn index f2b4809..12b4068 100644 --- a/client/ui/UI.tscn +++ b/client/ui/UI.tscn @@ -6,8 +6,8 @@ [ext_resource type="Script" path="res://ui/debug/PingLabel.gd" id="3_xjdws"] [ext_resource type="Script" path="res://ui/debug/PositionLabel.gd" id="4_beqf6"] [ext_resource type="Script" path="res://ui/debug/VelocityLabel.gd" id="5_8lm6a"] -[ext_resource type="Script" path="res://ui/ChatBox.gd" id="5_vdqtm"] -[ext_resource type="Script" path="res://ui/ChatInput.gd" id="6_70anv"] +[ext_resource type="Script" path="res://ui/chat/ChatBox.gd" id="5_43juw"] +[ext_resource type="Script" path="res://ui/chat/ChatInput.gd" id="6_cg2h5"] [ext_resource type="Script" path="res://ui/debug/UploadLabel.gd" id="7_cfnpx"] [ext_resource type="Script" path="res://ui/debug/DownloadLabel.gd" id="8_ogt38"] @@ -41,20 +41,20 @@ offset_top = -134.0 offset_right = 263.0 grow_vertical = 0 -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/BottomLeft"] +[node name="Chat" type="VBoxContainer" parent="CanvasLayer/BottomLeft"] layout_mode = 2 alignment = 2 -[node name="ChatBox" type="RichTextLabel" parent="CanvasLayer/BottomLeft/VBoxContainer"] +[node name="ChatBox" type="RichTextLabel" parent="CanvasLayer/BottomLeft/Chat"] layout_mode = 2 size_flags_vertical = 3 bbcode_enabled = true scroll_following = true -script = ExtResource("5_vdqtm") +script = ExtResource("5_43juw") -[node name="ChatInput" type="LineEdit" parent="CanvasLayer/BottomLeft/VBoxContainer"] +[node name="ChatInput" type="LineEdit" parent="CanvasLayer/BottomLeft/Chat"] layout_mode = 2 -script = ExtResource("6_70anv") +script = ExtResource("6_cg2h5") [node name="BottomRight" type="MarginContainer" parent="CanvasLayer"] anchors_preset = 3 @@ -102,6 +102,6 @@ layout_mode = 2 alignment = 2 script = ExtResource("5_8lm6a") -[connection signal="focus_entered" from="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" to="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" method="_on_focus_entered"] -[connection signal="focus_exited" from="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" to="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" method="_on_focus_exited"] -[connection signal="text_submitted" from="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" to="CanvasLayer/BottomLeft/VBoxContainer/ChatInput" method="_on_text_submitted"] +[connection signal="focus_entered" from="CanvasLayer/BottomLeft/Chat/ChatInput" to="CanvasLayer/BottomLeft/Chat/ChatInput" method="_on_focus_entered"] +[connection signal="focus_exited" from="CanvasLayer/BottomLeft/Chat/ChatInput" to="CanvasLayer/BottomLeft/Chat/ChatInput" method="_on_focus_exited"] +[connection signal="text_submitted" from="CanvasLayer/BottomLeft/Chat/ChatInput" to="CanvasLayer/BottomLeft/Chat/ChatInput" method="_on_text_submitted"] diff --git a/client/ui/ChatBox.gd b/client/ui/chat/ChatBox.gd similarity index 65% rename from client/ui/ChatBox.gd rename to client/ui/chat/ChatBox.gd index 3c4f27c..d4ad2ef 100644 --- a/client/ui/ChatBox.gd +++ b/client/ui/chat/ChatBox.gd @@ -1,7 +1,7 @@ extends RichTextLabel func _ready(): - owner.on_message_received.connect(on_message_received) + owner.message_received.connect(on_message_received) func on_message_received(bbcode: String): append_text(bbcode + "\n") \ No newline at end of file diff --git a/client/ui/ChatInput.gd b/client/ui/chat/ChatInput.gd similarity index 100% rename from client/ui/ChatInput.gd rename to client/ui/chat/ChatInput.gd diff --git a/client/ui/debug/DebugLabel.gd b/client/ui/debug/DebugLabel.gd index 412c208..404c3d8 100644 --- a/client/ui/debug/DebugLabel.gd +++ b/client/ui/debug/DebugLabel.gd @@ -1,7 +1,7 @@ class_name DebugLabel extends Control -var text : String : +var text: String: get: return get_child(1).text set(value): diff --git a/client/ui/debug/DownloadLabel.gd b/client/ui/debug/DownloadLabel.gd index 2914023..cb56627 100644 --- a/client/ui/debug/DownloadLabel.gd +++ b/client/ui/debug/DownloadLabel.gd @@ -1,7 +1,7 @@ extends DebugLabel func _ready(): - owner.on_download_changed.connect(on_download_changed) + owner.download_changed.connect(on_download_changed) func on_download_changed(download): text = "%d bytes" % download diff --git a/client/ui/debug/PingLabel.gd b/client/ui/debug/PingLabel.gd index d0a2c71..3c1badc 100644 --- a/client/ui/debug/PingLabel.gd +++ b/client/ui/debug/PingLabel.gd @@ -1,7 +1,7 @@ extends DebugLabel func _ready(): - owner.on_ping_changed.connect(on_ping_changed) + owner.ping_changed.connect(on_ping_changed) func on_ping_changed(ping): text = str(snapped(ping * 1000, 1)) + " ms" diff --git a/client/ui/debug/UploadLabel.gd b/client/ui/debug/UploadLabel.gd index 87579fb..4bcc36a 100644 --- a/client/ui/debug/UploadLabel.gd +++ b/client/ui/debug/UploadLabel.gd @@ -1,7 +1,7 @@ extends DebugLabel func _ready(): - owner.on_upload_changed.connect(on_upload_changed) + owner.upload_changed.connect(on_upload_changed) func on_upload_changed(upload): text = "%d bytes" % upload diff --git a/client/ui/ubuntu_nf_regular.ttf.import b/client/ui/font/ubuntu_nf_regular.ttf.import similarity index 68% rename from client/ui/ubuntu_nf_regular.ttf.import rename to client/ui/font/ubuntu_nf_regular.ttf.import index 05ef6cf..2fadc36 100644 --- a/client/ui/ubuntu_nf_regular.ttf.import +++ b/client/ui/font/ubuntu_nf_regular.ttf.import @@ -3,12 +3,12 @@ importer="font_data_dynamic" type="FontFile" uid="uid://b7mov13kwi8u8" -path="res://.godot/imported/ubuntu_nf_regular.ttf-feed7a5a59b6d10a4a32843efe52a9da.fontdata" +path="res://.godot/imported/ubuntu_nf_regular.ttf-b453c07942f661257c0c0781f805a134.fontdata" [deps] -source_file="res://ui/ubuntu_nf_regular.ttf" -dest_files=["res://.godot/imported/ubuntu_nf_regular.ttf-feed7a5a59b6d10a4a32843efe52a9da.fontdata"] +source_file="res://ui/font/ubuntu_nf_regular.ttf" +dest_files=["res://.godot/imported/ubuntu_nf_regular.ttf-b453c07942f661257c0c0781f805a134.fontdata"] [params] diff --git a/client/ui/theme.tres b/client/ui/theme/theme.tres similarity index 88% rename from client/ui/theme.tres rename to client/ui/theme/theme.tres index cc08b44..cdac640 100644 --- a/client/ui/theme.tres +++ b/client/ui/theme/theme.tres @@ -1,6 +1,6 @@ [gd_resource type="Theme" load_steps=2 format=3 uid="uid://caqphxkvcu3tb"] -[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://ui/ubuntu_nf_regular.ttf" id="1_1unma"] +[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://ui/font/ubuntu_nf_regular.ttf" id="1_1unma"] [resource] default_font = ExtResource("1_1unma")