diff options
Diffstat (limited to 'UI')
-rw-r--r-- | UI/Camera.tscn | 2 | ||||
-rw-r--r-- | UI/HUD.tscn | 33 | ||||
-rw-r--r-- | UI/Lobby.gd | 9 | ||||
-rw-r--r-- | UI/Lobby.tscn | 6 | ||||
-rw-r--r-- | UI/PlayersList.tscn | 4 | ||||
-rw-r--r-- | UI/PlayersListItem.tscn | 3 | ||||
-rw-r--r-- | UI/players_list.gd | 2 | ||||
-rw-r--r-- | UI/tower_configuration.gd | 9 |
8 files changed, 38 insertions, 30 deletions
diff --git a/UI/Camera.tscn b/UI/Camera.tscn index 7080711..869cd53 100644 --- a/UI/Camera.tscn +++ b/UI/Camera.tscn @@ -2,6 +2,6 @@ [ext_resource type="Script" path="res://UI/Camera.gd" id="1_yiia3"] -[node name="Camera" type="Camera2D"] +[node name="Camera" type="Camera2D" groups=["camera"]] anchor_mode = 0 script = ExtResource("1_yiia3") diff --git a/UI/HUD.tscn b/UI/HUD.tscn index b4756cd..f968c16 100644 --- a/UI/HUD.tscn +++ b/UI/HUD.tscn @@ -139,18 +139,6 @@ text = "0" custom_minimum_size = Vector2(0, 1) layout_mode = 2 -[node name="CenterContainer" type="CenterContainer" parent="."] -anchors_preset = 12 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 0 - -[node name="Tower" type="Label" parent="CenterContainer"] -unique_name_in_owner = true -layout_mode = 2 - [node name="SpawnBox" type="PanelContainer" parent="."] unique_name_in_owner = true anchors_preset = 3 @@ -260,12 +248,25 @@ 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 +offset_left = -204.0 +offset_top = 41.0 +offset_right = -4.0 +offset_bottom = 84.0 grow_horizontal = 0 +[node name="CenterContainer" type="CenterContainer" parent="."] +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -23.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Tower" type="Label" parent="CenterContainer"] +unique_name_in_owner = true +layout_mode = 2 + [node name="TowerConfigurationsContainer" type="MarginContainer" parent="."] visible = false anchors_preset = 12 diff --git a/UI/Lobby.gd b/UI/Lobby.gd index 4fea0bc..68d843c 100644 --- a/UI/Lobby.gd +++ b/UI/Lobby.gd @@ -1,6 +1,13 @@ extends Control +func _ready(): + if OS.has_environment("USER"): + %Name.text = OS.get_environment("USER") + elif OS.has_environment("USERNAME"): + %Name.text = OS.get_environment("USERNAME") + + func get_ip(): var ip := "127.0.0.1" if %IP.text: @@ -17,10 +24,12 @@ func get_port(): return port func _on_host_pressed() -> void: + Client.player.name = %Name.text Network.host_game(get_port()) get_tree().change_scene_to_file("res://Stages/world.tscn") func _on_join_pressed() -> void: + Client.player.name = %Name.text 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 f3775d8..4060f88 100644 --- a/UI/Lobby.tscn +++ b/UI/Lobby.tscn @@ -22,6 +22,12 @@ grow_vertical = 2 [node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] layout_mode = 2 +[node name="Name" type="TextEdit" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(0, 50) +layout_mode = 2 +placeholder_text = "Name" + [node name="Host" type="Button" parent="CenterContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 diff --git a/UI/PlayersList.tscn b/UI/PlayersList.tscn index b1106b5..12bdf37 100644 --- a/UI/PlayersList.tscn +++ b/UI/PlayersList.tscn @@ -4,8 +4,8 @@ [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 +offset_right = 96.0 +offset_bottom = 43.0 script = ExtResource("1_67rpy") [node name="MarginContainer" type="MarginContainer" parent="."] diff --git a/UI/PlayersListItem.tscn b/UI/PlayersListItem.tscn index 8349b05..53b98f9 100644 --- a/UI/PlayersListItem.tscn +++ b/UI/PlayersListItem.tscn @@ -13,13 +13,12 @@ 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 +text_overrun_behavior = 3 [node name="VSeparator" type="VSeparator" parent="HBoxContainer"] visible = false diff --git a/UI/players_list.gd b/UI/players_list.gd index c1ca00f..04bfe6b 100644 --- a/UI/players_list.gd +++ b/UI/players_list.gd @@ -24,7 +24,7 @@ func update_players(): control.get_node("%Indicator").visible = id == multiplayer.get_unique_id() list.add_child(control) - control.get_node("%ID").text = str(id) + control.get_node("%ID").text = str(player.name) control.get_node("%Score").text = str(player.score) list.move_child(control, Network.get_ordered_player_ids().find(id) + 1) diff --git a/UI/tower_configuration.gd b/UI/tower_configuration.gd index 9eb12cd..7031de5 100644 --- a/UI/tower_configuration.gd +++ b/UI/tower_configuration.gd @@ -23,13 +23,6 @@ func _on_texture_rect_gui_input(event: InputEvent) -> void: 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 + builder_element.element = preload("res://Towers/Tower.tscn") get_tree().current_scene.add_child(builder_element) state.current_builder_element = builder_element |