Compare commits
No commits in common. "45a3cbb16353f77c8f0dcb86b905e1c285e3c606" and "55077ab52d3189d0f05d459bcc3a15fe8cb58544" have entirely different histories.
45a3cbb163
...
55077ab52d
@ -2,6 +2,5 @@
|
|||||||
- [LaserFast and LaserWithRecovery](godot/raw_assets/sfx/)
|
- [LaserFast and LaserWithRecovery](godot/raw_assets/sfx/)
|
||||||
- [Hit](godot/raw_assets/sfx/Hit.mp3)
|
- [Hit](godot/raw_assets/sfx/Hit.mp3)
|
||||||
- [Footstep sounds on Tree Trunk](godot/raw_assets/sfx/footsteps/) via [zapsplat](https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk)
|
- [Footstep sounds on Tree Trunk](godot/raw_assets/sfx/footsteps/) via [zapsplat](https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk)
|
||||||
- [Announcer sounds](godot/raw_assets/sfx/announcer/) by [TripleSnail](https://opengameart.org/content/announcer-kill-sounds)
|
|
||||||
- [Soldier model and rig](godot/raw_assets/Soldier/) by [Casti_131](https://opengameart.org/content/low-poly-soldier-with-weapons)
|
- [Soldier model and rig](godot/raw_assets/Soldier/) by [Casti_131](https://opengameart.org/content/low-poly-soldier-with-weapons)
|
||||||
- [Torment Textures](godot/maps/textures) (`str_*` files) by [Bradley D. (strideh.itch.io)](https://strideh.itch.io)
|
- [Torment Textures](godot/maps/textures) (`str_*` files) by [Bradley D. (strideh.itch.io)](https://strideh.itch.io)
|
||||||
|
|||||||
@ -26,6 +26,15 @@ local_player = ExtResource("1_yjvui")
|
|||||||
remote_player = ExtResource("2_kcncr")
|
remote_player = ExtResource("2_kcncr")
|
||||||
ball = ExtResource("3_e0nj3")
|
ball = ExtResource("3_e0nj3")
|
||||||
|
|
||||||
|
[node name="net_stats_label" type="NetStatsLabel" parent="." unique_id=1821474986]
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -152.0
|
||||||
|
offset_right = 369.0
|
||||||
|
grow_vertical = 0
|
||||||
|
vertical_alignment = 2
|
||||||
|
|
||||||
[node name="terrain" type="MeshInstance3D" parent="." unique_id=1474127252]
|
[node name="terrain" type="MeshInstance3D" parent="." unique_id=1474127252]
|
||||||
material_override = SubResource("StandardMaterial3D_u8vuu")
|
material_override = SubResource("StandardMaterial3D_u8vuu")
|
||||||
mesh = SubResource("PlaneMesh_1cgct")
|
mesh = SubResource("PlaneMesh_1cgct")
|
||||||
|
|||||||
@ -22,7 +22,6 @@ CommandLinePanelGlobal="*uid://bsb6asp5o35w3"
|
|||||||
GameManagerGlobal="*uid://bii6018k3ip3t"
|
GameManagerGlobal="*uid://bii6018k3ip3t"
|
||||||
CliParserGlobal="*uid://c52o7xa0fnr53"
|
CliParserGlobal="*uid://c52o7xa0fnr53"
|
||||||
GameSettingsGlobal="*uid://bjr15hjiojecw"
|
GameSettingsGlobal="*uid://bjr15hjiojecw"
|
||||||
AnnouncerGlobal="*uid://5gey4i80mmsa"
|
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
@ -99,11 +98,6 @@ scoreboard={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
open_chat={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://cmx868xfm5tr"
|
|
||||||
path="res://.godot/imported/Carnage.wav-0aa25ce2dbaf67c412d878ecccaa2a43.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Carnage.wav"
|
|
||||||
dest_files=["res://.godot/imported/Carnage.wav-0aa25ce2dbaf67c412d878ecccaa2a43.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://bwv7hydyynxo3"
|
|
||||||
path="res://.godot/imported/Dominating.wav-9094379de14f4d99f4362076b03e9be9.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Dominating.wav"
|
|
||||||
dest_files=["res://.godot/imported/Dominating.wav-9094379de14f4d99f4362076b03e9be9.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://b5816xcsj2ueh"
|
|
||||||
path="res://.godot/imported/DoubleKill.wav-1dae3420408145da22058102a5b9489c.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/DoubleKill.wav"
|
|
||||||
dest_files=["res://.godot/imported/DoubleKill.wav-1dae3420408145da22058102a5b9489c.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://bg8wugv6ij0pj"
|
|
||||||
path="res://.godot/imported/FirstBlood.wav-3a1ab2cafcafce472d28811db364622d.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/FirstBlood.wav"
|
|
||||||
dest_files=["res://.godot/imported/FirstBlood.wav-3a1ab2cafcafce472d28811db364622d.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://celsg1h2xc85k"
|
|
||||||
path="res://.godot/imported/Godlike.wav-5ec4df26a22987b555e4f010565e2276.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Godlike.wav"
|
|
||||||
dest_files=["res://.godot/imported/Godlike.wav-5ec4df26a22987b555e4f010565e2276.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://cc5t6p6w468hi"
|
|
||||||
path="res://.godot/imported/KillingSpree.wav-448dff3e279f17fef54b67c2bf084908.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/KillingSpree.wav"
|
|
||||||
dest_files=["res://.godot/imported/KillingSpree.wav-448dff3e279f17fef54b67c2bf084908.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://baml6py7t1ycd"
|
|
||||||
path="res://.godot/imported/Massacre.wav-26fd0dde29cf79df78d170f36281a8b1.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Massacre.wav"
|
|
||||||
dest_files=["res://.godot/imported/Massacre.wav-26fd0dde29cf79df78d170f36281a8b1.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://bjewmgxjuwsqo"
|
|
||||||
path="res://.godot/imported/Mayhem.wav-ea221444f4057bff04fd5e46ce2da957.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Mayhem.wav"
|
|
||||||
dest_files=["res://.godot/imported/Mayhem.wav-ea221444f4057bff04fd5e46ce2da957.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://dfxrsl808f6o0"
|
|
||||||
path="res://.godot/imported/MegaKill.wav-809778ac21e83a3da5eb84b1403e21a2.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/MegaKill.wav"
|
|
||||||
dest_files=["res://.godot/imported/MegaKill.wav-809778ac21e83a3da5eb84b1403e21a2.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://4i6t6yh2j45t"
|
|
||||||
path="res://.godot/imported/Ownage.wav-7853435740c868c6707b6c2ef354df86.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Ownage.wav"
|
|
||||||
dest_files=["res://.godot/imported/Ownage.wav-7853435740c868c6707b6c2ef354df86.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://ccg5hd454nqpe"
|
|
||||||
path="res://.godot/imported/Rampage.wav-328d28840941970a1c0afd53cf5a6790.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/Rampage.wav"
|
|
||||||
dest_files=["res://.godot/imported/Rampage.wav-328d28840941970a1c0afd53cf5a6790.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
Binary file not shown.
@ -1,24 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="wav"
|
|
||||||
type="AudioStreamWAV"
|
|
||||||
uid="uid://co82glo13i8at"
|
|
||||||
path="res://.godot/imported/TripleKill.wav-5cd8a2f25db2a8430eba6089c5c04d0e.sample"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://raw_assets/sfx/announcer/TripleKill.wav"
|
|
||||||
dest_files=["res://.godot/imported/TripleKill.wav-5cd8a2f25db2a8430eba6089c5c04d0e.sample"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
force/8_bit=false
|
|
||||||
force/mono=false
|
|
||||||
force/max_rate=false
|
|
||||||
force/max_rate_hz=44100
|
|
||||||
edit/trim=false
|
|
||||||
edit/normalize=false
|
|
||||||
edit/loop_mode=0
|
|
||||||
edit/loop_begin=0
|
|
||||||
edit/loop_end=-1
|
|
||||||
compress/mode=2
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://bwd6bj21x310s"]
|
[gd_scene format=3 uid="uid://bwd6bj21x310s"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://ccd0wj2usx5os" path="res://scenes/ui/lobby_player_listing.tscn" id="1_o1atq"]
|
[ext_resource type="PackedScene" uid="uid://ccd0wj2usx5os" path="res://scenes/ui/lobby_player_listing.tscn" id="1_o1atq"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ffh5txda3j1" path="res://scenes/ui/chat_box.tscn" id="2_5gu6x"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_1cgct"]
|
[sub_resource type="LabelSettings" id="LabelSettings_1cgct"]
|
||||||
font_size = 32
|
font_size = 32
|
||||||
@ -11,9 +10,9 @@ bg_color = Color(0.30692267, 0.3069227, 0.30692264, 1)
|
|||||||
|
|
||||||
[node name="lobby" type="LobbyPanel" unique_id=915192272 node_paths=PackedStringArray("players_list", "name_field", "ready_button", "map_selection", "options_panel", "options_grid")]
|
[node name="lobby" type="LobbyPanel" unique_id=915192272 node_paths=PackedStringArray("players_list", "name_field", "ready_button", "map_selection", "options_panel", "options_grid")]
|
||||||
players_list = NodePath("v_box_container/players_list")
|
players_list = NodePath("v_box_container/players_list")
|
||||||
name_field = NodePath("")
|
name_field = NodePath("v_box_container/h_box_container/text_edit")
|
||||||
player_listing_prefab = ExtResource("1_o1atq")
|
player_listing_prefab = ExtResource("1_o1atq")
|
||||||
ready_button = NodePath("v_box_container3/ready_button")
|
ready_button = NodePath("ready_button")
|
||||||
map_selection = NodePath("v_box_container2/option_button")
|
map_selection = NodePath("v_box_container2/option_button")
|
||||||
options_panel = NodePath("options_panel")
|
options_panel = NodePath("options_panel")
|
||||||
options_grid = NodePath("options_panel/h_box_container/options_grid")
|
options_grid = NodePath("options_panel/h_box_container/options_grid")
|
||||||
@ -27,8 +26,8 @@ grow_vertical = 2
|
|||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_top = 8.0
|
offset_top = 69.0
|
||||||
offset_bottom = 53.0
|
offset_bottom = 92.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
text = "Lobby"
|
text = "Lobby"
|
||||||
label_settings = SubResource("LabelSettings_1cgct")
|
label_settings = SubResource("LabelSettings_1cgct")
|
||||||
@ -36,13 +35,14 @@ horizontal_alignment = 1
|
|||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="." unique_id=336946640]
|
[node name="v_box_container" type="VBoxContainer" parent="." unique_id=336946640]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 85.0
|
offset_left = 129.0
|
||||||
offset_top = 111.0
|
offset_top = 146.0
|
||||||
offset_right = 290.0
|
offset_right = 334.0
|
||||||
offset_bottom = 165.0
|
offset_bottom = 200.0
|
||||||
|
|
||||||
[node name="h_box_container" type="HBoxContainer" parent="v_box_container" unique_id=1789302658]
|
[node name="h_box_container" type="HBoxContainer" parent="v_box_container" unique_id=1789302658]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
offset_transform_enabled = true
|
||||||
offset_transform_position = Vector2(100, 0)
|
offset_transform_position = Vector2(100, 0)
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
@ -50,10 +50,9 @@ metadata/_edit_lock_ = true
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Name:"
|
text = "Name:"
|
||||||
|
|
||||||
[node name="text_edit" type="LineEdit" parent="v_box_container/h_box_container" unique_id=284528736]
|
[node name="text_edit" type="TextEdit" parent="v_box_container/h_box_container" unique_id=683714912]
|
||||||
custom_minimum_size = Vector2(150, 0)
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
max_length = 20
|
|
||||||
|
|
||||||
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
|
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -64,15 +63,38 @@ metadata/_edit_lock_ = true
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="netstats" type="NetStatsLabel" parent="." unique_id=1335814511]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 12
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -144.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
vertical_alignment = 2
|
||||||
|
|
||||||
|
[node name="ready_button" type="Button" parent="." unique_id=311553419]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 129.0
|
||||||
|
offset_top = -177.0
|
||||||
|
offset_right = 278.0
|
||||||
|
offset_bottom = -126.0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Not Ready"
|
||||||
|
|
||||||
[node name="v_box_container2" type="VBoxContainer" parent="." unique_id=653902328]
|
[node name="v_box_container2" type="VBoxContainer" parent="." unique_id=653902328]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 1
|
anchors_preset = 1
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_left = -835.0
|
offset_left = -329.0
|
||||||
offset_top = 111.0
|
offset_top = 146.0
|
||||||
offset_right = -727.0
|
offset_right = -221.0
|
||||||
offset_bottom = 169.0
|
offset_bottom = 204.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
|
|
||||||
[node name="option_button" type="OptionButton" parent="v_box_container2" unique_id=426342653]
|
[node name="option_button" type="OptionButton" parent="v_box_container2" unique_id=426342653]
|
||||||
@ -123,50 +145,30 @@ layout_mode = 2
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
columns = 2
|
columns = 2
|
||||||
|
|
||||||
[node name="chat_box" parent="." unique_id=1125601400 instance=ExtResource("2_5gu6x")]
|
[node name="options_button" type="Button" parent="." unique_id=2109111628]
|
||||||
custom_minimum_size = Vector2(400, 300)
|
|
||||||
custom_maximum_size = Vector2(400, 300)
|
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_left = -535.0
|
offset_left = -309.0
|
||||||
offset_top = -352.0
|
offset_top = -166.0
|
||||||
offset_right = -35.0
|
offset_right = -239.0
|
||||||
offset_bottom = -52.0
|
offset_bottom = -135.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="v_box_container3" type="VBoxContainer" parent="." unique_id=1320505732]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 87.0
|
|
||||||
offset_top = 538.0
|
|
||||||
offset_right = 198.0
|
|
||||||
offset_bottom = 604.0
|
|
||||||
|
|
||||||
[node name="ready_button" type="Button" parent="v_box_container3" unique_id=311553419]
|
|
||||||
custom_minimum_size = Vector2(100, 0)
|
|
||||||
custom_maximum_size = Vector2(100, -1)
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Not Ready"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="h_box_container" type="HBoxContainer" parent="v_box_container3" unique_id=1165099293]
|
|
||||||
layout_mode = 2
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="exit_button" type="Button" parent="v_box_container3/h_box_container" unique_id=267703633]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Exit"
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="options_button" type="Button" parent="v_box_container3/h_box_container" unique_id=2109111628]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Options"
|
text = "Options"
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
[node name="exit_button" type="Button" parent="." unique_id=267703633]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 43.0
|
||||||
|
offset_top = 33.0
|
||||||
|
offset_right = 108.0
|
||||||
|
offset_bottom = 86.0
|
||||||
|
theme_override_font_sizes/font_size = 32
|
||||||
|
text = "Exit"
|
||||||
|
|
||||||
[connection signal="pressed" from="options_panel/options_close" to="." method="close_options"]
|
[connection signal="pressed" from="options_panel/options_close" to="." method="close_options"]
|
||||||
[connection signal="pressed" from="v_box_container3/h_box_container/exit_button" to="." method="exit"]
|
[connection signal="pressed" from="options_button" to="." method="open_options"]
|
||||||
[connection signal="pressed" from="v_box_container3/h_box_container/options_button" to="." method="open_options"]
|
[connection signal="pressed" from="exit_button" to="." method="exit"]
|
||||||
|
|||||||
@ -163,7 +163,7 @@ layout_mode = 2
|
|||||||
text = "Address"
|
text = "Address"
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="address_text" type="LineEdit" parent="join_panel/v_box_container" unique_id=672176728]
|
[node name="address_text" type="TextEdit" parent="join_panel/v_box_container" unique_id=584304528]
|
||||||
custom_minimum_size = Vector2(150, 30)
|
custom_minimum_size = Vector2(150, 30)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "127.0.0.1:8080"
|
text = "127.0.0.1:8080"
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://5gey4i80mmsa"]
|
|
||||||
|
|
||||||
[ext_resource type="AudioStream" uid="uid://bg8wugv6ij0pj" path="res://raw_assets/sfx/announcer/FirstBlood.wav" id="1_h17tq"]
|
|
||||||
[ext_resource type="AudioStream" uid="uid://b5816xcsj2ueh" path="res://raw_assets/sfx/announcer/DoubleKill.wav" id="2_6jrtu"]
|
|
||||||
[ext_resource type="AudioStream" uid="uid://co82glo13i8at" path="res://raw_assets/sfx/announcer/TripleKill.wav" id="3_6ob50"]
|
|
||||||
[ext_resource type="AudioStream" uid="uid://dfxrsl808f6o0" path="res://raw_assets/sfx/announcer/MegaKill.wav" id="4_0lbme"]
|
|
||||||
|
|
||||||
[node name="announcer" type="Announcer" unique_id=1062756235 node_paths=PackedStringArray("player")]
|
|
||||||
player = NodePath("audio_stream_player")
|
|
||||||
first_blood = ExtResource("1_h17tq")
|
|
||||||
double_kill = ExtResource("2_6jrtu")
|
|
||||||
triple_kill = ExtResource("3_6ob50")
|
|
||||||
mega_kill = ExtResource("4_0lbme")
|
|
||||||
|
|
||||||
[node name="audio_stream_player" type="AudioStreamPlayer" parent="." unique_id=1168314007]
|
|
||||||
@ -4,14 +4,13 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_ywmwa"]
|
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_ywmwa"]
|
||||||
[ext_resource type="PackedScene" uid="uid://n3u0jr4wiib1" path="res://scenes/ui/settings.tscn" id="3_beej8"]
|
[ext_resource type="PackedScene" uid="uid://n3u0jr4wiib1" path="res://scenes/ui/settings.tscn" id="3_beej8"]
|
||||||
[ext_resource type="PackedScene" uid="uid://2sfy0vq0fqt3" path="res://scenes/ui/player_listing.tscn" id="4_okac2"]
|
[ext_resource type="PackedScene" uid="uid://2sfy0vq0fqt3" path="res://scenes/ui/player_listing.tscn" id="4_okac2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ffh5txda3j1" path="res://scenes/ui/chat_box.tscn" id="5_cv68x"]
|
|
||||||
|
|
||||||
[sub_resource type="Environment" id="Environment_3nx84"]
|
[sub_resource type="Environment" id="Environment_3nx84"]
|
||||||
glow_enabled = true
|
glow_enabled = true
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
|
||||||
|
|
||||||
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "ball_origin", "weapon_node", "pause_panel", "exit_to_lobby", "settings_panel", "scoreboard", "chatbox")]
|
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "ball_origin", "weapon_node", "pause_panel", "exit_to_lobby", "settings_panel", "scoreboard")]
|
||||||
look_sensitivity = 1.5
|
look_sensitivity = 1.5
|
||||||
camera = NodePath("camera_3d")
|
camera = NodePath("camera_3d")
|
||||||
move_speed = 5.0
|
move_speed = 5.0
|
||||||
@ -26,7 +25,6 @@ pause_panel = NodePath("pause_menu")
|
|||||||
exit_to_lobby = NodePath("pause_menu/v_box_container/exit_to_lobby")
|
exit_to_lobby = NodePath("pause_menu/v_box_container/exit_to_lobby")
|
||||||
settings_panel = NodePath("settings")
|
settings_panel = NodePath("settings")
|
||||||
scoreboard = NodePath("scoreboard")
|
scoreboard = NodePath("scoreboard")
|
||||||
chatbox = NodePath("chat_box")
|
|
||||||
health = 100
|
health = 100
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
|
|
||||||
@ -139,15 +137,6 @@ layout_mode = 2
|
|||||||
alignment = 1
|
alignment = 1
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="chat_box" parent="." unique_id=1125601400 instance=ExtResource("5_cv68x")]
|
|
||||||
in_game = true
|
|
||||||
anchors_preset = 2
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_top = -300.0
|
|
||||||
offset_bottom = 0.0
|
|
||||||
grow_vertical = 0
|
|
||||||
|
|
||||||
[connection signal="pressed" from="pause_menu/v_box_container/settings" to="settings" method="open"]
|
[connection signal="pressed" from="pause_menu/v_box_container/settings" to="settings" method="open"]
|
||||||
[connection signal="pressed" from="pause_menu/v_box_container/exit_to_lobby" to="." method="exit_to_lobby"]
|
[connection signal="pressed" from="pause_menu/v_box_container/exit_to_lobby" to="." method="exit_to_lobby"]
|
||||||
[connection signal="pressed" from="pause_menu/v_box_container/exit" to="." method="exit"]
|
[connection signal="pressed" from="pause_menu/v_box_container/exit" to="." method="exit"]
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://ffh5txda3j1"]
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_61vwu"]
|
|
||||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
|
||||||
|
|
||||||
[node name="chat_box" type="ChatBox" unique_id=1125601400 node_paths=PackedStringArray("scroll", "messages", "line_edit")]
|
|
||||||
scroll = NodePath("panel/scroll_container")
|
|
||||||
messages = NodePath("panel/scroll_container/v_box_container")
|
|
||||||
line_edit = NodePath("line_edit")
|
|
||||||
custom_minimum_size = Vector2(500, 300)
|
|
||||||
custom_maximum_size = Vector2(500, 300)
|
|
||||||
offset_right = 500.0
|
|
||||||
offset_bottom = 300.0
|
|
||||||
|
|
||||||
[node name="panel" type="Panel" parent="." unique_id=674673935]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 3
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_61vwu")
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="scroll_container" type="ScrollContainer" parent="panel" unique_id=810829343]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_right = 500.0
|
|
||||||
offset_bottom = 270.0
|
|
||||||
horizontal_scroll_mode = 3
|
|
||||||
vertical_scroll_mode = 3
|
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="panel/scroll_container" unique_id=406354045]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 3
|
|
||||||
alignment = 2
|
|
||||||
|
|
||||||
[node name="line_edit" type="LineEdit" parent="." unique_id=785348302]
|
|
||||||
layout_mode = 2
|
|
||||||
@ -10,12 +10,12 @@ scroll_container = NodePath("scroll_container")
|
|||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_left = 1.0
|
offset_left = 1.0
|
||||||
offset_top = -540.0
|
offset_top = -344.0
|
||||||
offset_right = 1.0
|
offset_right = 1.0
|
||||||
offset_bottom = -233.0
|
offset_bottom = -37.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
|
||||||
[node name="input_field" type="LineEdit" parent="command_line_panel" unique_id=33075135]
|
[node name="input_field" type="TextEdit" parent="command_line_panel" unique_id=2095748573]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 10
|
anchors_preset = 10
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -45,10 +45,3 @@ scroll_active = false
|
|||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
shortcut_keys_enabled = false
|
shortcut_keys_enabled = false
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="net_stats_label" type="NetStatsLabel" parent="command_line_panel" unique_id=860927733]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = -1.0
|
|
||||||
offset_top = 344.0
|
|
||||||
offset_right = 341.0
|
|
||||||
offset_bottom = 499.0
|
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
use godot::{
|
|
||||||
classes::{AudioStream, AudioStreamPlayer},
|
|
||||||
prelude::*,
|
|
||||||
tools::get_autoload_by_name,
|
|
||||||
};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
pub const ANNOUCER_GLOBAL: &str = "AnnouncerGlobal";
|
|
||||||
|
|
||||||
#[derive(GodotClass)]
|
|
||||||
#[class(base=Node3D, init)]
|
|
||||||
pub struct Announcer {
|
|
||||||
#[export]
|
|
||||||
player: Option<Gd<AudioStreamPlayer>>,
|
|
||||||
|
|
||||||
#[export]
|
|
||||||
#[export_group(name = "Sounds")]
|
|
||||||
first_blood: Option<Gd<AudioStream>>,
|
|
||||||
|
|
||||||
#[export]
|
|
||||||
#[export_group(name = "Sounds")]
|
|
||||||
double_kill: Option<Gd<AudioStream>>,
|
|
||||||
|
|
||||||
#[export]
|
|
||||||
#[export_group(name = "Sounds")]
|
|
||||||
triple_kill: Option<Gd<AudioStream>>,
|
|
||||||
|
|
||||||
#[export]
|
|
||||||
#[export_group(name = "Sounds")]
|
|
||||||
mega_kill: Option<Gd<AudioStream>>,
|
|
||||||
|
|
||||||
base: Base<Node3D>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
|
||||||
pub enum Announcement {
|
|
||||||
FirstBlood,
|
|
||||||
DoubleKill,
|
|
||||||
TripleKill,
|
|
||||||
MegaKill,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Announcer {
|
|
||||||
pub fn singleton() -> Gd<Announcer> {
|
|
||||||
get_autoload_by_name::<Announcer>(ANNOUCER_GLOBAL)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn announce(&mut self, announcement: Announcement) {
|
|
||||||
let sound = match announcement {
|
|
||||||
Announcement::FirstBlood => &self.first_blood,
|
|
||||||
Announcement::DoubleKill => &self.double_kill,
|
|
||||||
Announcement::TripleKill => &self.triple_kill,
|
|
||||||
Announcement::MegaKill => &self.mega_kill,
|
|
||||||
};
|
|
||||||
if let Some(sound) = sound
|
|
||||||
&& let Some(player) = &mut self.player
|
|
||||||
{
|
|
||||||
player.set_stream(sound);
|
|
||||||
player.play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
101
rust/src/chat.rs
101
rust/src/chat.rs
@ -1,101 +0,0 @@
|
|||||||
use godot::{classes::RichTextLabel, prelude::*};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
announcer::Announcement,
|
|
||||||
game_manager::{Game, Player},
|
|
||||||
player::DamageSource,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(GodotClass)]
|
|
||||||
#[class(base=Node, init)]
|
|
||||||
pub struct Chat {
|
|
||||||
messages: Vec<ChatMessage>,
|
|
||||||
base: Base<Node>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[godot_api]
|
|
||||||
impl Chat {
|
|
||||||
#[signal]
|
|
||||||
pub fn on_new_message(idx: Gd<RichTextLabel>);
|
|
||||||
|
|
||||||
pub fn singleton() -> Option<Gd<Chat>> {
|
|
||||||
Game::singleton().and_then(|g| g.get_child(0).map(|c| c.cast()))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_messages(&self) -> Vec<Gd<RichTextLabel>> {
|
|
||||||
self.messages.iter().map(|m| m.as_label()).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn new_message(&mut self, message: ChatMessage) {
|
|
||||||
self.messages.len() as i64;
|
|
||||||
self.messages.push(message.clone());
|
|
||||||
self.run_deferred(move |s| s.signals().on_new_message().emit(&message.as_label()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub enum ChatMessage {
|
|
||||||
Death(DamageSource, u16),
|
|
||||||
Announcement(u16, Announcement),
|
|
||||||
ChatMessage(String, Color, String),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ChatMessage {
|
|
||||||
pub fn as_label(&self) -> Gd<RichTextLabel> {
|
|
||||||
let mut label = RichTextLabel::new_alloc();
|
|
||||||
label.set_fit_content(true);
|
|
||||||
match self {
|
|
||||||
ChatMessage::Death(source, player_id) => {
|
|
||||||
if let Some(game) = Game::singleton()
|
|
||||||
&& let Some(player) = game.bind().find_player(*player_id)
|
|
||||||
{
|
|
||||||
match source {
|
|
||||||
DamageSource::Player(source_id) => {
|
|
||||||
if let Some(source) = game.bind().find_player(*source_id) {
|
|
||||||
add_player(&mut label, source);
|
|
||||||
label.append_text(" fragged ");
|
|
||||||
add_player(&mut label, &player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DamageSource::Killbox => {
|
|
||||||
add_player(&mut label, &player);
|
|
||||||
label.append_text(" fell into the void");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChatMessage::Announcement(player_id, announcement) => {
|
|
||||||
if let Some(game) = Game::singleton()
|
|
||||||
&& let Some(player) = game.bind().find_player(*player_id)
|
|
||||||
{
|
|
||||||
add_player(&mut label, &player);
|
|
||||||
label.append_text(" got ");
|
|
||||||
let what = match announcement {
|
|
||||||
Announcement::FirstBlood => "First Blood",
|
|
||||||
Announcement::DoubleKill => "a Double Kill",
|
|
||||||
Announcement::TripleKill => "a Triple Kill",
|
|
||||||
Announcement::MegaKill => "a Mega Kill",
|
|
||||||
};
|
|
||||||
label.append_text(&format!("[color=red]{}[/color]", what));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChatMessage::ChatMessage(name, color, message) => {
|
|
||||||
label.push_color(*color);
|
|
||||||
label.add_text(&format!("{}: ", name));
|
|
||||||
label.pop();
|
|
||||||
label.add_text(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_player(label: &mut Gd<RichTextLabel>, player: &Player) {
|
|
||||||
if let Some(game) = Game::singleton()
|
|
||||||
&& let Some(team) = game.bind().get_team(player.data.team)
|
|
||||||
{
|
|
||||||
label.push_color(team.bind().color);
|
|
||||||
label.add_text(&player.data.name);
|
|
||||||
label.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,12 +4,7 @@ use godot::{classes::CharacterBody3D, prelude::*, tools::get_autoload_by_name};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
announcer::{
|
|
||||||
Announcement::{self, FirstBlood},
|
|
||||||
Announcer,
|
|
||||||
},
|
|
||||||
ball::Ball,
|
ball::Ball,
|
||||||
chat::{Chat, ChatMessage},
|
|
||||||
map::Map,
|
map::Map,
|
||||||
map_resource::MapResource,
|
map_resource::MapResource,
|
||||||
net::{
|
net::{
|
||||||
@ -217,11 +212,6 @@ pub struct Game {
|
|||||||
|
|
||||||
#[godot_api]
|
#[godot_api]
|
||||||
impl INode for Game {
|
impl INode for Game {
|
||||||
fn ready(&mut self) {
|
|
||||||
let chat = Chat::new_alloc();
|
|
||||||
self.base_mut().add_child(&chat);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn physics_process(&mut self, delta: f64) {
|
fn physics_process(&mut self, delta: f64) {
|
||||||
self.since_last_sync += delta;
|
self.since_last_sync += delta;
|
||||||
if self.since_last_sync > (1. / 60.) {
|
if self.since_last_sync > (1. / 60.) {
|
||||||
@ -292,13 +282,6 @@ impl INode for Game {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for player in &mut self.players {
|
|
||||||
player.killing_spree_cd -= delta;
|
|
||||||
if player.killing_spree_cd <= 0. {
|
|
||||||
player.killing_spree = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,8 +483,6 @@ impl Game {
|
|||||||
kills: 0,
|
kills: 0,
|
||||||
deaths: 0,
|
deaths: 0,
|
||||||
},
|
},
|
||||||
killing_spree: 0,
|
|
||||||
killing_spree_cd: 0.,
|
|
||||||
character: None,
|
character: None,
|
||||||
});
|
});
|
||||||
self.run_deferred(move |s| s.signals().on_new_player().emit(id));
|
self.run_deferred(move |s| s.signals().on_new_player().emit(id));
|
||||||
@ -858,82 +839,15 @@ impl Game {
|
|||||||
|
|
||||||
// Handle for when a player is killed, run both on client and server
|
// Handle for when a player is killed, run both on client and server
|
||||||
pub fn on_kill(&mut self, source: DamageSource, player_id: u16) {
|
pub fn on_kill(&mut self, source: DamageSource, player_id: u16) {
|
||||||
let total_prev_kills: u16 = self.players.iter().map(|p| p.data.kills).sum();
|
if let DamageSource::Player(source_id) = source
|
||||||
|
|
||||||
if let Some(chat) = &mut Chat::singleton() {
|
|
||||||
chat.bind_mut()
|
|
||||||
.new_message(ChatMessage::Death(source, player_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
let killing_spree = if let DamageSource::Player(source_id) = source
|
|
||||||
&& let Some(source_player) = self.find_player_mut(source_id)
|
&& let Some(source_player) = self.find_player_mut(source_id)
|
||||||
{
|
{
|
||||||
source_player.data.kills += 1;
|
source_player.data.kills += 1;
|
||||||
source_player.killing_spree += 1;
|
}
|
||||||
source_player.killing_spree_cd = 10.;
|
|
||||||
source_player.killing_spree
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(player) = self.find_player_mut(player_id) {
|
if let Some(player) = self.find_player_mut(player_id) {
|
||||||
player.data.deaths += 1;
|
player.data.deaths += 1;
|
||||||
}
|
}
|
||||||
self.run_deferred(move |s| {
|
self.run_deferred(move |s| s.signals().on_player_killed().emit(player_id));
|
||||||
s.signals().on_player_killed().emit(player_id);
|
|
||||||
|
|
||||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer
|
|
||||||
&& let PeerKind::Server(peer, _) = peer
|
|
||||||
{
|
|
||||||
if total_prev_kills == 0 {
|
|
||||||
if let DamageSource::Player(source_id) = source {
|
|
||||||
s.on_announcement(source_id, Announcement::FirstBlood);
|
|
||||||
peer.broadcast_reliable(Package::Announcement(source_id, FirstBlood));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let announcement = match killing_spree {
|
|
||||||
2 => Some(Announcement::DoubleKill),
|
|
||||||
3 => Some(Announcement::TripleKill),
|
|
||||||
4 => Some(Announcement::MegaKill),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
if let Some(announcement) = announcement {
|
|
||||||
if let DamageSource::Player(source_id) = source {
|
|
||||||
s.on_announcement(source_id, announcement);
|
|
||||||
peer.broadcast_reliable(Package::Announcement(source_id, announcement));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn on_chat_message(&mut self, player_id: u16, message: String) {
|
|
||||||
if let Some(chat) = &mut Chat::singleton() {
|
|
||||||
if let Some(player) = self.find_player(player_id)
|
|
||||||
&& let Some(team) = self.get_team(player.data.team)
|
|
||||||
{
|
|
||||||
chat.bind_mut().new_message(ChatMessage::ChatMessage(
|
|
||||||
player.data.name.clone(),
|
|
||||||
team.bind().color,
|
|
||||||
message.clone(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.run_deferred(move |_| {
|
|
||||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer
|
|
||||||
&& let PeerKind::Server(peer, _) = peer
|
|
||||||
{
|
|
||||||
peer.broadcast_reliable(Package::ChatMessage(player_id, message.clone()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn on_announcement(&mut self, player_id: u16, announcement: Announcement) {
|
|
||||||
if let Some(chat) = &mut Chat::singleton() {
|
|
||||||
chat.bind_mut()
|
|
||||||
.new_message(ChatMessage::Announcement(player_id, announcement));
|
|
||||||
}
|
|
||||||
Announcer::singleton().bind_mut().announce(announcement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle taking damage, from server to client
|
// Handle taking damage, from server to client
|
||||||
@ -980,8 +894,6 @@ pub struct Player {
|
|||||||
pub connection_addr: SocketAddr,
|
pub connection_addr: SocketAddr,
|
||||||
pub data: NetPlayer,
|
pub data: NetPlayer,
|
||||||
pub character: Option<DynGd<CharacterBody3D, dyn IPlayer + 'static>>,
|
pub character: Option<DynGd<CharacterBody3D, dyn IPlayer + 'static>>,
|
||||||
pub killing_spree: u16,
|
|
||||||
pub killing_spree_cd: f64,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
@ -1097,8 +1009,6 @@ impl From<NetPlayer> for Player {
|
|||||||
connection_addr: SocketAddr::from(([0, 0, 0, 0], 0)),
|
connection_addr: SocketAddr::from(([0, 0, 0, 0], 0)),
|
||||||
data: value,
|
data: value,
|
||||||
character: None,
|
character: None,
|
||||||
killing_spree: 0,
|
|
||||||
killing_spree_cd: 0.,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
use godot::prelude::*;
|
use godot::prelude::*;
|
||||||
|
|
||||||
pub mod announcer;
|
|
||||||
pub mod ball;
|
pub mod ball;
|
||||||
pub mod chat;
|
|
||||||
pub mod cli_parser;
|
pub mod cli_parser;
|
||||||
pub mod game_manager;
|
pub mod game_manager;
|
||||||
pub mod game_settings;
|
pub mod game_settings;
|
||||||
|
|||||||
@ -9,7 +9,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use teanet::{Peer, PeerConfig, PeerMessage};
|
use teanet::{Peer, PeerConfig, PeerMessage};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
announcer::Announcement,
|
|
||||||
game_manager::{Game, GameManager, GameOption, GameOptionValue, NetPlayer},
|
game_manager::{Game, GameManager, GameOption, GameOptionValue, NetPlayer},
|
||||||
game_settings::GameSettingsManager,
|
game_settings::GameSettingsManager,
|
||||||
net::{net_stats::Stats, util::NetVector3},
|
net::{net_stats::Stats, util::NetVector3},
|
||||||
@ -292,7 +291,6 @@ pub enum Package {
|
|||||||
PlayerLeft(NetPlayer),
|
PlayerLeft(NetPlayer),
|
||||||
SetTeam(u16, u8),
|
SetTeam(u16, u8),
|
||||||
GameOptionChanged(GameOption, GameOptionValue),
|
GameOptionChanged(GameOption, GameOptionValue),
|
||||||
ChatMessage(u16, String),
|
|
||||||
|
|
||||||
// Lobby packages
|
// Lobby packages
|
||||||
SetReady(u16, bool),
|
SetReady(u16, bool),
|
||||||
@ -312,7 +310,6 @@ pub enum Package {
|
|||||||
DespawnBall,
|
DespawnBall,
|
||||||
SwapWeapon(u16, WeaponType),
|
SwapWeapon(u16, WeaponType),
|
||||||
Goal(Vec<u8>),
|
Goal(Vec<u8>),
|
||||||
Announcement(u16, Announcement),
|
|
||||||
|
|
||||||
// End-of-Game packages
|
// End-of-Game packages
|
||||||
FinishGame,
|
FinishGame,
|
||||||
|
|||||||
@ -200,16 +200,6 @@ impl NetworkManager {
|
|||||||
game.bind_mut().finish_game();
|
game.bind_mut().finish_game();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Package::Announcement(source_id, announcement) => {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
game.bind_mut().on_announcement(source_id, announcement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Package::ChatMessage(source_id, message) => {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
game.bind_mut().on_chat_message(source_id, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -377,15 +367,6 @@ impl NetworkManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Package::ChatMessage(_, message) => {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
let player =
|
|
||||||
game.bind().find_player_by_addr(&conn.address).cloned();
|
|
||||||
if let Some(player) = player {
|
|
||||||
game.bind_mut().on_chat_message(player.id(), message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -26,7 +26,7 @@ use crate::{
|
|||||||
soldier_mesh::SoldierMesh,
|
soldier_mesh::SoldierMesh,
|
||||||
weapon::{BallWeapon, Raygun, Weapon, WeaponType},
|
weapon::{BallWeapon, Raygun, Weapon, WeaponType},
|
||||||
},
|
},
|
||||||
ui::{chatbox::ChatBox, cli::CommandLinePanel, settings::SettingsPanel},
|
ui::{cli::CommandLinePanel, settings::SettingsPanel},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod effects;
|
pub mod effects;
|
||||||
@ -208,8 +208,6 @@ pub struct LocalPlayer {
|
|||||||
#[export]
|
#[export]
|
||||||
scoreboard: Option<Gd<PanelContainer>>,
|
scoreboard: Option<Gd<PanelContainer>>,
|
||||||
#[export]
|
#[export]
|
||||||
chatbox: Option<Gd<ChatBox>>,
|
|
||||||
#[export]
|
|
||||||
health: i32,
|
health: i32,
|
||||||
|
|
||||||
pub player_id: Option<u16>,
|
pub player_id: Option<u16>,
|
||||||
@ -410,17 +408,6 @@ impl ICharacterBody3D for LocalPlayer {
|
|||||||
s.update_lock();
|
s.update_lock();
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(chatbox) = self.chatbox.clone() {
|
|
||||||
chatbox
|
|
||||||
.signals()
|
|
||||||
.on_opened()
|
|
||||||
.connect_other(self, |s| s.update_lock());
|
|
||||||
chatbox
|
|
||||||
.signals()
|
|
||||||
.on_closed()
|
|
||||||
.connect_other(self, |s| s.update_lock());
|
|
||||||
}
|
|
||||||
|
|
||||||
self.swap_weapon(WeaponType::Raygun);
|
self.swap_weapon(WeaponType::Raygun);
|
||||||
|
|
||||||
if let Some(camera) = &mut self.camera {
|
if let Some(camera) = &mut self.camera {
|
||||||
@ -641,12 +628,7 @@ impl LocalPlayer {
|
|||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
let chat_visible = if let Some(chat) = &s.chatbox {
|
s.set_lock(!CommandLinePanel::singleton().bind().opened && !paused);
|
||||||
chat.bind().is_editing()
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
};
|
|
||||||
s.set_lock(!CommandLinePanel::singleton().bind().opened && !paused && !chat_visible);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,7 +897,7 @@ impl RemotePlayer {
|
|||||||
pub fn on_take_damage(source: DamageSourceSignal, source_player: u16, damage: i32);
|
pub fn on_take_damage(source: DamageSourceSignal, source_player: u16, damage: i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub enum DamageSource {
|
pub enum DamageSource {
|
||||||
Player(u16),
|
Player(u16),
|
||||||
Killbox,
|
Killbox,
|
||||||
|
|||||||
@ -1,140 +0,0 @@
|
|||||||
use std::i32;
|
|
||||||
|
|
||||||
use godot::{
|
|
||||||
classes::{
|
|
||||||
Engine, IVBoxContainer, InputEvent, LineEdit, Panel, RichTextLabel, ScrollContainer,
|
|
||||||
VBoxContainer,
|
|
||||||
},
|
|
||||||
prelude::*,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
chat::Chat,
|
|
||||||
game_manager::Game,
|
|
||||||
net::network_manager::{NetworkManager, Package, PeerKind},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(GodotClass)]
|
|
||||||
#[class(base=VBoxContainer, init, tool)]
|
|
||||||
pub struct ChatBox {
|
|
||||||
#[export]
|
|
||||||
scroll: Option<Gd<ScrollContainer>>,
|
|
||||||
#[export]
|
|
||||||
messages: Option<Gd<VBoxContainer>>,
|
|
||||||
#[export]
|
|
||||||
line_edit: Option<Gd<LineEdit>>,
|
|
||||||
#[export]
|
|
||||||
pub in_game: bool,
|
|
||||||
|
|
||||||
scroll_on_next_update: bool,
|
|
||||||
|
|
||||||
base: Base<VBoxContainer>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[godot_api]
|
|
||||||
impl IVBoxContainer for ChatBox {
|
|
||||||
fn ready(&mut self) {
|
|
||||||
if !Engine::singleton().is_editor_hint() {
|
|
||||||
self.run_deferred(|s| {
|
|
||||||
if let Some(chat) = Chat::singleton() {
|
|
||||||
for message in chat.bind().get_messages() {
|
|
||||||
s.on_new_message(message);
|
|
||||||
}
|
|
||||||
chat.signals()
|
|
||||||
.on_new_message()
|
|
||||||
.connect_other(s, |s, m| s.run_deferred(|s| s.on_new_message(m)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Some(line_edit) = self.line_edit.clone() {
|
|
||||||
line_edit
|
|
||||||
.signals()
|
|
||||||
.text_submitted()
|
|
||||||
.connect_other(self, Self::on_submit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.in_game
|
|
||||||
&& let Some(line_edit) = &mut self.line_edit
|
|
||||||
{
|
|
||||||
line_edit.set_visible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process(&mut self, _: f64) {
|
|
||||||
if self.scroll_on_next_update
|
|
||||||
&& let Some(scroll) = &mut self.scroll
|
|
||||||
{
|
|
||||||
scroll.set_v_scroll(i32::MAX);
|
|
||||||
self.scroll_on_next_update = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn input(&mut self, event: Gd<InputEvent>) {
|
|
||||||
if self.in_game && event.is_action_pressed("open_chat") {
|
|
||||||
if let Some(line_edit) = &mut self.line_edit {
|
|
||||||
let is_visible = line_edit.is_visible();
|
|
||||||
if !is_visible {
|
|
||||||
line_edit.set_visible(true);
|
|
||||||
|
|
||||||
let mut line_edit = line_edit.clone();
|
|
||||||
self.run_deferred(move |_| {
|
|
||||||
if line_edit.is_visible() {
|
|
||||||
line_edit.grab_focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
self.signals().on_opened().emit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[godot_api]
|
|
||||||
impl ChatBox {
|
|
||||||
#[signal]
|
|
||||||
pub fn on_opened();
|
|
||||||
#[signal]
|
|
||||||
pub fn on_closed();
|
|
||||||
|
|
||||||
fn on_new_message(&mut self, message: Gd<RichTextLabel>) {
|
|
||||||
if let Some(messages) = &mut self.messages {
|
|
||||||
messages.add_child(&message);
|
|
||||||
}
|
|
||||||
self.scroll_on_next_update = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn on_submit(&mut self, message: GString) {
|
|
||||||
if let Some(line_edit) = &mut self.line_edit {
|
|
||||||
line_edit.clear();
|
|
||||||
if self.in_game {
|
|
||||||
line_edit.set_visible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.signals().on_closed().emit();
|
|
||||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
|
||||||
match peer {
|
|
||||||
PeerKind::Client(peer, socket_addr) => {
|
|
||||||
peer.send_reliable(socket_addr, Package::ChatMessage(0, message.to_string()));
|
|
||||||
}
|
|
||||||
PeerKind::Server(..) => {
|
|
||||||
self.run_deferred(move |_| {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
let self_id = game.bind().self_id;
|
|
||||||
game.bind_mut()
|
|
||||||
.on_chat_message(self_id.unwrap_or(0), message.to_string());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_editing(&self) -> bool {
|
|
||||||
if let Some(line_edit) = &self.line_edit {
|
|
||||||
line_edit.is_visible()
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,7 +3,7 @@ use std::net::SocketAddr;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use godot::classes::{
|
use godot::classes::{
|
||||||
CanvasLayer, IPanel, InputEvent, LineEdit, Panel, RichTextLabel, ScrollContainer,
|
CanvasLayer, IPanel, InputEvent, Panel, RichTextLabel, ScrollContainer, TextEdit,
|
||||||
};
|
};
|
||||||
use godot::prelude::*;
|
use godot::prelude::*;
|
||||||
use godot::tools::get_autoload_by_name;
|
use godot::tools::get_autoload_by_name;
|
||||||
@ -32,7 +32,7 @@ pub const CLI_GLOBAL_NAME: &str = "CommandLinePanelGlobal";
|
|||||||
#[class(base=Panel)]
|
#[class(base=Panel)]
|
||||||
pub struct CommandLinePanel {
|
pub struct CommandLinePanel {
|
||||||
#[export]
|
#[export]
|
||||||
pub input_field: Option<Gd<LineEdit>>,
|
pub input_field: Option<Gd<TextEdit>>,
|
||||||
#[export]
|
#[export]
|
||||||
pub text_field: Option<Gd<RichTextLabel>>,
|
pub text_field: Option<Gd<RichTextLabel>>,
|
||||||
#[export]
|
#[export]
|
||||||
@ -74,13 +74,6 @@ impl IPanel for CommandLinePanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ready(&mut self) {
|
fn ready(&mut self) {
|
||||||
if let Some(input_field) = self.input_field.clone() {
|
|
||||||
input_field
|
|
||||||
.signals()
|
|
||||||
.text_submitted()
|
|
||||||
.connect_other(self, |s, value| s.input_command(value.to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
self.idle_y = self.base().get_position().y;
|
self.idle_y = self.base().get_position().y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +85,15 @@ impl IPanel for CommandLinePanel {
|
|||||||
self.scroll_next_update = false;
|
self.scroll_next_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(input) = self.input_field.clone() {
|
||||||
|
let text = input.get_text();
|
||||||
|
if text.contains("\n") {
|
||||||
|
let parts = text.split("\n");
|
||||||
|
let first = parts.get(0).unwrap();
|
||||||
|
self.input_command(first.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let old_pos = self.base().get_position();
|
let old_pos = self.base().get_position();
|
||||||
let mut target_pos = self.base().get_position();
|
let mut target_pos = self.base().get_position();
|
||||||
if self.opened {
|
if self.opened {
|
||||||
|
|||||||
@ -2,8 +2,8 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{
|
classes::{
|
||||||
Button, CheckBox, Control, GridContainer, IPanel, Label, LineEdit, OptionButton, Panel,
|
Button, CheckBox, Control, GridContainer, IPanel, Label, OptionButton, Panel, SpinBox,
|
||||||
SpinBox, VBoxContainer,
|
TextEdit, VBoxContainer,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
@ -20,7 +20,7 @@ pub struct LobbyPanel {
|
|||||||
#[export]
|
#[export]
|
||||||
players_list: Option<Gd<VBoxContainer>>,
|
players_list: Option<Gd<VBoxContainer>>,
|
||||||
#[export]
|
#[export]
|
||||||
name_field: Option<Gd<LineEdit>>,
|
name_field: Option<Gd<TextEdit>>,
|
||||||
#[export]
|
#[export]
|
||||||
player_listing_prefab: Option<Gd<PackedScene>>,
|
player_listing_prefab: Option<Gd<PackedScene>>,
|
||||||
#[export]
|
#[export]
|
||||||
@ -108,18 +108,22 @@ impl IPanel for LobbyPanel {
|
|||||||
name_field
|
name_field
|
||||||
.signals()
|
.signals()
|
||||||
.text_changed()
|
.text_changed()
|
||||||
.connect_other(self, |_, value| {
|
.connect_other(self, |s| {
|
||||||
if let Some(game) = &mut Game::singleton() {
|
if let Some(name_field) = &s.name_field {
|
||||||
let player_id = game.bind().self_id;
|
if let Some(game) = &mut Game::singleton() {
|
||||||
if let Some(player_id) = player_id {
|
let player_id = game.bind().self_id;
|
||||||
game.bind_mut()
|
if let Some(player_id) = player_id {
|
||||||
.update_player_nick(player_id, value.to_string());
|
game.bind_mut().update_player_nick(
|
||||||
|
player_id,
|
||||||
|
name_field.get_text().to_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NetworkManager::singleton()
|
NetworkManager::singleton()
|
||||||
.bind_mut()
|
.bind_mut()
|
||||||
.update_nick(value.to_string());
|
.update_nick(name_field.get_text().to_string());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use godot::{
|
use godot::{
|
||||||
classes::{Button, Camera3D, Label, LineEdit, Panel, SpinBox},
|
classes::{Button, Camera3D, Label, Panel, SpinBox, TextEdit},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
register::property::SimpleVar,
|
register::property::SimpleVar,
|
||||||
};
|
};
|
||||||
@ -41,7 +41,7 @@ pub struct MainMenu {
|
|||||||
#[export]
|
#[export]
|
||||||
host_port: Option<Gd<SpinBox>>,
|
host_port: Option<Gd<SpinBox>>,
|
||||||
#[export]
|
#[export]
|
||||||
join_addr: Option<Gd<LineEdit>>,
|
join_addr: Option<Gd<TextEdit>>,
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
popup_panel: Option<Gd<Panel>>,
|
popup_panel: Option<Gd<Panel>>,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
pub mod chatbox;
|
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod game_finished_screen;
|
pub mod game_finished_screen;
|
||||||
pub mod lobby;
|
pub mod lobby;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{Control, GridContainer, IPanel, Label, LineEdit, Panel, control::SizeFlags},
|
classes::{Control, GridContainer, IPanel, Label, Panel, TextEdit, control::SizeFlags},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -103,20 +103,25 @@ impl IPanel for SettingsPanel {
|
|||||||
slider.upcast::<Control>()
|
slider.upcast::<Control>()
|
||||||
}
|
}
|
||||||
SettingValue::String(value) => {
|
SettingValue::String(value) => {
|
||||||
let mut line_edit = LineEdit::new_alloc();
|
let mut text_edit = TextEdit::new_alloc();
|
||||||
line_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
text_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
||||||
line_edit.set_text(value);
|
text_edit.set_text(value);
|
||||||
line_edit.set_max_length(20);
|
|
||||||
|
|
||||||
let setting_clone = setting.clone();
|
let setting_clone = setting.clone();
|
||||||
line_edit
|
let text_edit_clone = text_edit.clone();
|
||||||
|
text_edit
|
||||||
.signals()
|
.signals()
|
||||||
.text_changed()
|
.text_changed()
|
||||||
.connect_other(self, move |s, v| {
|
.connect_other(self, move |s| {
|
||||||
s.on_change(setting_clone, SettingValue::String(v.to_string()));
|
s.on_change(
|
||||||
|
setting_clone,
|
||||||
|
SettingValue::String(
|
||||||
|
text_edit_clone.get_text().to_string(),
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
line_edit.upcast()
|
text_edit.upcast()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user