summaryrefslogtreecommitdiff
path: root/UI
diff options
context:
space:
mode:
Diffstat (limited to 'UI')
-rw-r--r--UI/GameMenu.tscn12
-rw-r--r--UI/HUD.gd39
-rw-r--r--UI/HUD.tscn127
-rw-r--r--UI/Lobby.gd23
-rw-r--r--UI/Lobby.tscn48
-rw-r--r--UI/PlayersList.tscn34
-rw-r--r--UI/PlayersListItem.tscn48
-rw-r--r--UI/SpawnButton.tscn2
-rw-r--r--UI/TowerConfiguration.tscn28
-rw-r--r--UI/game_menu.gd4
-rw-r--r--UI/players_list.gd33
-rw-r--r--UI/tower_configuration.gd35
12 files changed, 392 insertions, 41 deletions
diff --git a/UI/GameMenu.tscn b/UI/GameMenu.tscn
new file mode 100644
index 0000000..cf6646e
--- /dev/null
+++ b/UI/GameMenu.tscn
@@ -0,0 +1,12 @@
+[gd_scene load_steps=2 format=3 uid="uid://c13v4wmjm4sev"]
+
+[ext_resource type="Script" path="res://UI/game_menu.gd" id="1_frq7d"]
+
+[node name="GameMenu" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+script = ExtResource("1_frq7d")
diff --git a/UI/HUD.gd b/UI/HUD.gd
index 7674ce3..023f157 100644
--- a/UI/HUD.gd
+++ b/UI/HUD.gd
@@ -5,3 +5,42 @@ extends CanvasLayer
@onready var score: Label = %Score
@onready var tower: Label = %Tower
@onready var spawn_box: Control = %SpawnBox
+@onready var players_list: PanelContainer = %PlayersList
+
+
+func _ready():
+ Client.player.score_changed.connect(func():
+ score.text = str(Client.player.score)
+ )
+
+ Client.stage_state_changed.connect(func(state: State):
+ if state is StateBuild:
+ $TowerConfigurationsContainer.visible = true
+ else:
+ $TowerConfigurationsContainer.visible = false
+ )
+
+
+func _input(event: InputEvent):
+ if event.is_action_pressed("spawn_box_toggle"):
+ spawn_box.visible = not spawn_box.visible
+ if event.is_action_pressed("players_list_toggle"):
+ players_list.visible = not players_list.visible
+
+
+func _on_build_mode_button_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ if Client.state is StateDefault:
+ get_tree().current_scene.get_node("StateManager").set_state("StateBuild")
+ elif Client.state is StateBuild:
+ get_tree().current_scene.get_node("StateManager").set_state("StateDefault")
+
+
+func _on_spawner_box_button_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ spawn_box.visible = not spawn_box.visible
+
+
+func _on_player_list_button_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ players_list.visible = not players_list.visible
diff --git a/UI/HUD.tscn b/UI/HUD.tscn
index b73fc34..b4756cd 100644
--- a/UI/HUD.tscn
+++ b/UI/HUD.tscn
@@ -1,10 +1,10 @@
-[gd_scene load_steps=17 format=3 uid="uid://bylx30cweulmk"]
+[gd_scene load_steps=24 format=3 uid="uid://bylx30cweulmk"]
[ext_resource type="Script" path="res://UI/HUD.gd" id="1_2bu0v"]
-[ext_resource type="Texture2D" uid="uid://c7ntdvxvv16io" path="res://Assets/UI/key_e.png" id="1_d2guw"]
-[ext_resource type="Texture2D" uid="uid://hljlcokgys6y" path="res://Assets/UI/key_r.png" id="2_b00ni"]
+[ext_resource type="Texture2D" uid="uid://dlg78heamuf5g" path="res://Assets/UI/tilemap_white.png" id="2_dyehp"]
[ext_resource type="PackedScene" uid="uid://x6kohecnw7f5" path="res://UI/SpawnButton.tscn" id="3_7eaea"]
[ext_resource type="Texture2D" uid="uid://up1rtweit3ut" path="res://Assets/Mobs/angesnow-menu01.png" id="4_w7sef"]
+[ext_resource type="Theme" uid="uid://c7f1ftrx53ag1" path="res://theme.tres" id="5_121ry"]
[ext_resource type="Texture2D" uid="uid://dq2i36oe1wj0m" path="res://Assets/Mobs/mob-pressed.png" id="5_xcxr8"]
[ext_resource type="Texture2D" uid="uid://dnkr5y0cfxu68" path="res://Assets/Mobs/mob-hovered.png" id="6_4go2d"]
[ext_resource type="Texture2D" uid="uid://dsy7k2v5fhh6v" path="res://Assets/Mobs/angesnow-front.png" id="7_ba5tw"]
@@ -15,10 +15,30 @@
[ext_resource type="Texture2D" uid="uid://byrx3c087exvb" path="res://Assets/Mobs/windeye-menu01.png" id="12_20egp"]
[ext_resource type="Texture2D" uid="uid://coiiq1yaonxeg" path="res://Assets/Mobs/windeye-front.png" id="13_iq5a7"]
[ext_resource type="Texture2D" uid="uid://dr02nqmrnciy0" path="res://Assets/Mobs/mob.png" id="14_t3qlu"]
+[ext_resource type="PackedScene" uid="uid://cxd6c4kbnk04c" path="res://UI/PlayersList.tscn" id="16_mq4um"]
+[ext_resource type="PackedScene" uid="uid://c05aq7xd4kx1p" path="res://UI/TowerConfiguration.tscn" id="17_1c5dq"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3rjde"]
bg_color = Color(0, 0, 0, 0.54902)
+[sub_resource type="AtlasTexture" id="AtlasTexture_byi0r"]
+atlas = ExtResource("2_dyehp")
+region = Rect2(392, 69, 13, 13)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_dixt2"]
+atlas = ExtResource("2_dyehp")
+region = Rect2(341, 35, 13, 13)
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_tuk1j"]
+atlas = ExtResource("2_dyehp")
+region = Rect2(443, 35, 13, 13)
+
+[sub_resource type="InputEventAction" id="InputEventAction_t6x4q"]
+action = &"spawn_unit"
+
+[sub_resource type="Shortcut" id="Shortcut_i6rmj"]
+events = [SubResource("InputEventAction_t6x4q")]
+
[node name="HUD" type="CanvasLayer"]
script = ExtResource("1_2bu0v")
@@ -37,7 +57,7 @@ layout_mode = 2
[node name="GridContainer" type="GridContainer" parent="Panel/VBoxContainer/Container"]
layout_mode = 2
-columns = 2
+columns = 3
[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer/Container/GridContainer"]
layout_mode = 2
@@ -50,9 +70,10 @@ theme_override_constants/margin_bottom = 4
layout_mode = 2
[node name="BuildModeButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
+texture_filter = 1
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
-texture = ExtResource("1_d2guw")
+texture = SubResource("AtlasTexture_byi0r")
expand_mode = 1
[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
@@ -70,15 +91,37 @@ theme_override_constants/margin_bottom = 4
layout_mode = 2
[node name="SpawnerBoxButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
+texture_filter = 1
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
-texture = ExtResource("2_b00ni")
+texture = SubResource("AtlasTexture_dixt2")
expand_mode = 1
[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
layout_mode = 2
text = "Spawn Box"
+[node name="MarginContainer3" type="MarginContainer" parent="Panel/VBoxContainer/Container/GridContainer"]
+layout_mode = 2
+theme_override_constants/margin_left = 4
+theme_override_constants/margin_top = 4
+theme_override_constants/margin_right = 4
+theme_override_constants/margin_bottom = 4
+
+[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3"]
+layout_mode = 2
+
+[node name="PlayerListButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
+texture_filter = 1
+custom_minimum_size = Vector2(24, 24)
+layout_mode = 2
+texture = SubResource("AtlasTexture_tuk1j")
+expand_mode = 1
+
+[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
+layout_mode = 2
+text = "Players List"
+
[node name="Control" type="Control" parent="Panel/VBoxContainer/Container"]
layout_mode = 2
size_flags_horizontal = 3
@@ -115,8 +158,10 @@ anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
-offset_left = -40.0
-offset_top = -40.0
+offset_left = -148.0
+offset_top = -116.0
+offset_right = -4.0
+offset_bottom = -4.0
grow_horizontal = 0
grow_vertical = 0
@@ -129,12 +174,13 @@ theme_override_constants/margin_bottom = 8
[node name="GridContainer" type="GridContainer" parent="SpawnBox/MarginContainer"]
layout_mode = 2
-theme_override_constants/h_separation = 12
-theme_override_constants/v_separation = 12
+theme_override_constants/h_separation = 0
+theme_override_constants/v_separation = 0
columns = 4
[node name="SpawnButton" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
+theme = ExtResource("5_121ry")
texture_normal = ExtResource("4_w7sef")
texture_pressed = ExtResource("5_xcxr8")
texture_hover = ExtResource("6_4go2d")
@@ -142,6 +188,7 @@ texture = ExtResource("7_ba5tw")
[node name="SpawnButton2" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
+shortcut = SubResource("Shortcut_i6rmj")
texture_normal = ExtResource("8_wmbg8")
texture_hover = ExtResource("6_4go2d")
texture = ExtResource("9_nmd8t")
@@ -208,26 +255,54 @@ texture_normal = ExtResource("14_t3qlu")
texture_pressed = ExtResource("5_xcxr8")
texture_hover = ExtResource("6_4go2d")
-[node name="SpawnButton13" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+[node name="PlayersList" parent="." instance=ExtResource("16_mq4um")]
+unique_name_in_owner = true
+anchors_preset = 1
+anchor_left = 1.0
+anchor_right = 1.0
+offset_left = -144.0
+offset_top = 42.0
+offset_right = -5.0
+offset_bottom = 85.0
+grow_horizontal = 0
+
+[node name="TowerConfigurationsContainer" type="MarginContainer" parent="."]
+visible = false
+anchors_preset = 12
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_top = -120.0
+offset_right = -152.0
+grow_horizontal = 2
+grow_vertical = 0
+theme_override_constants/margin_left = 4
+theme_override_constants/margin_top = 4
+theme_override_constants/margin_right = 4
+theme_override_constants/margin_bottom = 4
+
+[node name="PanelContainer" type="PanelContainer" parent="TowerConfigurationsContainer"]
layout_mode = 2
-texture_normal = ExtResource("14_t3qlu")
-texture_pressed = ExtResource("5_xcxr8")
-texture_hover = ExtResource("6_4go2d")
-[node name="SpawnButton14" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+[node name="MarginContainer" type="MarginContainer" parent="TowerConfigurationsContainer/PanelContainer"]
layout_mode = 2
-texture_normal = ExtResource("14_t3qlu")
-texture_pressed = ExtResource("5_xcxr8")
-texture_hover = ExtResource("6_4go2d")
+theme_override_constants/margin_left = 8
+theme_override_constants/margin_top = 8
+theme_override_constants/margin_right = 8
+theme_override_constants/margin_bottom = 8
-[node name="SpawnButton15" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+[node name="ScrollContainer" type="ScrollContainer" parent="TowerConfigurationsContainer/PanelContainer/MarginContainer"]
layout_mode = 2
-texture_normal = ExtResource("14_t3qlu")
-texture_pressed = ExtResource("5_xcxr8")
-texture_hover = ExtResource("6_4go2d")
+vertical_scroll_mode = 0
-[node name="SpawnButton16" parent="SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+[node name="TowerConfigurations" type="HBoxContainer" parent="TowerConfigurationsContainer/PanelContainer/MarginContainer/ScrollContainer"]
layout_mode = 2
-texture_normal = ExtResource("14_t3qlu")
-texture_pressed = ExtResource("5_xcxr8")
-texture_hover = ExtResource("6_4go2d")
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="TextureRect" parent="TowerConfigurationsContainer/PanelContainer/MarginContainer/ScrollContainer/TowerConfigurations" instance=ExtResource("17_1c5dq")]
+layout_mode = 2
+
+[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer/BuildModeButton" to="." method="_on_build_mode_button_gui_input"]
+[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2/SpawnerBoxButton" to="." method="_on_spawner_box_button_gui_input"]
+[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2/PlayerListButton" to="." method="_on_player_list_button_gui_input"]
diff --git a/UI/Lobby.gd b/UI/Lobby.gd
index d4eb7c2..4fea0bc 100644
--- a/UI/Lobby.gd
+++ b/UI/Lobby.gd
@@ -1,11 +1,26 @@
extends Control
-func _on_button_pressed() -> void:
- Network.host_game()
+func get_ip():
+ var ip := "127.0.0.1"
+ if %IP.text:
+ ip = %IP.text
+
+ return ip
+
+
+func get_port():
+ var port := 1234
+ if %Port.text:
+ port = %Port.text
+
+ return port
+
+func _on_host_pressed() -> void:
+ Network.host_game(get_port())
get_tree().change_scene_to_file("res://Stages/world.tscn")
-func _on_button_2_pressed() -> void:
- Network.join_game()
+func _on_join_pressed() -> void:
+ Network.join_game(get_ip(), get_port())
get_tree().change_scene_to_file("res://Stages/world.tscn")
diff --git a/UI/Lobby.tscn b/UI/Lobby.tscn
index 64bfc97..f3775d8 100644
--- a/UI/Lobby.tscn
+++ b/UI/Lobby.tscn
@@ -11,18 +11,44 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_f10dr")
-[node name="Button" type="Button" parent="."]
-layout_mode = 0
-offset_right = 8.0
-offset_bottom = 8.0
+[node name="CenterContainer" type="CenterContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
+layout_mode = 2
+
+[node name="Host" type="Button" parent="CenterContainer/VBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+theme_override_font_sizes/font_size = 24
text = "Host"
-[node name="Button2" type="Button" parent="."]
-layout_mode = 0
-offset_top = 32.0
-offset_right = 38.0
-offset_bottom = 63.0
+[node name="IP" type="TextEdit" parent="CenterContainer/VBoxContainer"]
+unique_name_in_owner = true
+custom_minimum_size = Vector2(150, 50)
+layout_mode = 2
+size_flags_vertical = 3
+theme_override_font_sizes/font_size = 18
+placeholder_text = "Join IP"
+
+[node name="Port" type="TextEdit" parent="CenterContainer/VBoxContainer"]
+unique_name_in_owner = true
+custom_minimum_size = Vector2(150, 50)
+layout_mode = 2
+size_flags_vertical = 3
+theme_override_font_sizes/font_size = 18
+placeholder_text = "Host&Join Port"
+
+[node name="Join" type="Button" parent="CenterContainer/VBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+theme_override_font_sizes/font_size = 24
text = "Join"
-[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
-[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"]
+[connection signal="pressed" from="CenterContainer/VBoxContainer/Host" to="." method="_on_host_pressed"]
+[connection signal="pressed" from="CenterContainer/VBoxContainer/Join" to="." method="_on_join_pressed"]
diff --git a/UI/PlayersList.tscn b/UI/PlayersList.tscn
new file mode 100644
index 0000000..b1106b5
--- /dev/null
+++ b/UI/PlayersList.tscn
@@ -0,0 +1,34 @@
+[gd_scene load_steps=3 format=3 uid="uid://cxd6c4kbnk04c"]
+
+[ext_resource type="Script" path="res://UI/players_list.gd" id="1_67rpy"]
+[ext_resource type="PackedScene" uid="uid://wxe1hpn013y8" path="res://UI/PlayersListItem.tscn" id="2_ug8m7"]
+
+[node name="PlayersList" type="PanelContainer"]
+offset_right = 40.0
+offset_bottom = 40.0
+script = ExtResource("1_67rpy")
+
+[node name="MarginContainer" type="MarginContainer" parent="."]
+layout_mode = 2
+theme_override_constants/margin_left = 8
+theme_override_constants/margin_top = 8
+theme_override_constants/margin_right = 8
+theme_override_constants/margin_bottom = 8
+
+[node name="List" type="VBoxContainer" parent="MarginContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+
+[node name="PlayersListItem" parent="MarginContainer/List" instance=ExtResource("2_ug8m7")]
+layout_mode = 2
+
+[node name="ID" parent="MarginContainer/List/PlayersListItem/HBoxContainer" index="0"]
+text = "ID"
+
+[node name="Score" parent="MarginContainer/List/PlayersListItem/HBoxContainer" index="2"]
+text = "Score"
+
+[node name="Indicator" parent="MarginContainer/List/PlayersListItem" index="1"]
+visible = false
+
+[editable path="MarginContainer/List/PlayersListItem"]
diff --git a/UI/PlayersListItem.tscn b/UI/PlayersListItem.tscn
new file mode 100644
index 0000000..8349b05
--- /dev/null
+++ b/UI/PlayersListItem.tscn
@@ -0,0 +1,48 @@
+[gd_scene format=3 uid="uid://wxe1hpn013y8"]
+
+[node name="PlayersListItem" type="MarginContainer"]
+offset_right = 6.0
+offset_bottom = 23.0
+theme_override_constants/margin_left = 8
+theme_override_constants/margin_top = 2
+theme_override_constants/margin_right = 8
+theme_override_constants/margin_bottom = 2
+
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="ID" type="Label" parent="HBoxContainer"]
+unique_name_in_owner = true
+custom_minimum_size = Vector2(10, 0)
+layout_mode = 2
+size_flags_horizontal = 3
+text = "1"
+horizontal_alignment = 1
+clip_text = true
+text_overrun_behavior = 1
+
+[node name="VSeparator" type="VSeparator" parent="HBoxContainer"]
+visible = false
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Score" type="Label" parent="HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+size_flags_horizontal = 3
+text = "0"
+horizontal_alignment = 1
+
+[node name="Indicator" type="Control" parent="."]
+unique_name_in_owner = true
+layout_mode = 2
+
+[node name="Label" type="Label" parent="Indicator"]
+layout_mode = 2
+offset_left = -8.0
+offset_top = 5.0
+offset_right = -2.0
+offset_bottom = 19.0
+size_flags_horizontal = 0
+theme_override_font_sizes/font_size = 10
+text = ">"
diff --git a/UI/SpawnButton.tscn b/UI/SpawnButton.tscn
index ec2423b..7b3450b 100644
--- a/UI/SpawnButton.tscn
+++ b/UI/SpawnButton.tscn
@@ -3,10 +3,12 @@
[ext_resource type="Script" path="res://UI/spawn_button.gd" id="1_ayei4"]
[node name="SpawnButton" type="TextureButton"]
+custom_minimum_size = Vector2(32, 32)
offset_left = 2.0
offset_top = 2.0
offset_right = 38.0
offset_bottom = 38.0
+stretch_mode = 3
script = ExtResource("1_ayei4")
[connection signal="pressed" from="." to="." method="_on_pressed"]
diff --git a/UI/TowerConfiguration.tscn b/UI/TowerConfiguration.tscn
new file mode 100644
index 0000000..0f97073
--- /dev/null
+++ b/UI/TowerConfiguration.tscn
@@ -0,0 +1,28 @@
+[gd_scene load_steps=5 format=3 uid="uid://c05aq7xd4kx1p"]
+
+[ext_resource type="Texture2D" uid="uid://b1b18rd0tqbar" path="res://core_outdoor.png" id="1_3ypmu"]
+[ext_resource type="Script" path="res://UI/tower_configuration.gd" id="2_vvfd0"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_k0400"]
+
+[sub_resource type="AtlasTexture" id="AtlasTexture_7gm7m"]
+atlas = ExtResource("1_3ypmu")
+region = Rect2(400, 439, 32, 41)
+
+[node name="PanelContainer" type="PanelContainer"]
+custom_minimum_size = Vector2(74, 88)
+offset_right = 80.0
+offset_bottom = 104.0
+theme_override_styles/panel = SubResource("StyleBoxEmpty_k0400")
+script = ExtResource("2_vvfd0")
+
+[node name="TextureRect" type="TextureRect" parent="."]
+texture_filter = 1
+layout_mode = 2
+mouse_default_cursor_shape = 2
+texture = SubResource("AtlasTexture_7gm7m")
+stretch_mode = 4
+
+[connection signal="gui_input" from="TextureRect" to="." method="_on_texture_rect_gui_input"]
+[connection signal="mouse_entered" from="TextureRect" to="TextureRect" method="_on_mouse_entered"]
+[connection signal="mouse_exited" from="TextureRect" to="TextureRect" method="_on_mouse_exited"]
diff --git a/UI/game_menu.gd b/UI/game_menu.gd
new file mode 100644
index 0000000..357f369
--- /dev/null
+++ b/UI/game_menu.gd
@@ -0,0 +1,4 @@
+extends Control
+
+
+# TODO: show controls
diff --git a/UI/players_list.gd b/UI/players_list.gd
new file mode 100644
index 0000000..c1ca00f
--- /dev/null
+++ b/UI/players_list.gd
@@ -0,0 +1,33 @@
+extends PanelContainer
+
+
+@onready var list: Control = %List
+
+
+func _ready() -> void:
+ #players_list_container.visible = false
+ Network.players_changed.connect(update_players)
+ update_players()
+
+ multiplayer.peer_disconnected.connect(remove_player)
+
+
+func update_players():
+ for id in Network.players.keys():
+ var player: Player = Network.players[id]
+
+ var control: Control = list.get_node_or_null(str(id))
+ if not control:
+ control = preload("res://UI/PlayersListItem.tscn").instantiate()
+ control.name = str(id)
+ control.modulate = player.get_color()
+ control.get_node("%Indicator").visible = id == multiplayer.get_unique_id()
+ list.add_child(control)
+
+ control.get_node("%ID").text = str(id)
+ control.get_node("%Score").text = str(player.score)
+ list.move_child(control, Network.get_ordered_player_ids().find(id) + 1)
+
+
+func remove_player(id):
+ list.remove_child(list.get_node(str(id)))
diff --git a/UI/tower_configuration.gd b/UI/tower_configuration.gd
new file mode 100644
index 0000000..9eb12cd
--- /dev/null
+++ b/UI/tower_configuration.gd
@@ -0,0 +1,35 @@
+extends PanelContainer
+
+
+var is_hovered = false
+
+
+func _on_mouse_entered() -> void:
+ is_hovered = true
+
+ var stylebox := StyleBoxFlat.new()
+ stylebox.bg_color = Color(1.0, 1.0, 1.0, 0.25)
+ add_theme_stylebox_override("panel", stylebox)
+
+func _on_mouse_exited() -> void:
+ is_hovered = false
+
+ remove_theme_stylebox_override("panel")
+
+
+func _on_texture_rect_gui_input(event: InputEvent) -> void:
+ var state: StateBuild = get_tree().current_scene.get_node("StateManager/StateBuild")
+ if event.is_action_pressed("select") and not state.current_builder_element:
+ var builder_element_scene = preload("res://Game/States/Build/BuilderElement.tscn")
+ var builder_element = builder_element_scene.instantiate()
+
+ var tower = preload("res://Towers/Tower.tscn").instantiate() as Tower
+ tower.attack_range = [
+ Client.stage.map.tile_set.tile_size.x * 2,
+ Client.stage.map.tile_set.tile_size.x * 3,
+ Client.stage.map.tile_set.tile_size.x * 4,
+ ].pick_random()
+
+ builder_element.element = tower
+ get_tree().current_scene.add_child(builder_element)
+ state.current_builder_element = builder_element