summaryrefslogtreecommitdiff
path: root/UI
diff options
context:
space:
mode:
Diffstat (limited to 'UI')
-rw-r--r--UI/Camera.gd12
-rw-r--r--UI/Camera.gd.uid1
-rw-r--r--UI/Camera.tscn2
-rw-r--r--UI/CollisionVisibilityArea.tscn2
-rw-r--r--UI/ContainContainer.tscn2
-rw-r--r--UI/GameMenu.tscn2
-rw-r--r--UI/GamesLobby/games_lobby.gd (renamed from UI/GameLobby/game_lobby.gd)31
-rw-r--r--UI/GamesLobby/games_lobby.gd.uid1
-rw-r--r--UI/GamesLobby/games_lobby.tscn (renamed from UI/GameLobby/game_lobby.tscn)41
-rw-r--r--UI/GamesLobby/lobby_game.gd (renamed from UI/GameLobby/lobby_game.gd)1
-rw-r--r--UI/GamesLobby/lobby_game.gd.uid1
-rw-r--r--UI/GamesLobby/lobby_game.tscn (renamed from UI/GameLobby/lobby_game.tscn)2
-rw-r--r--UI/HPBar.tscn2
-rw-r--r--UI/PlayerLobby/Lobby.tscn43
-rw-r--r--UI/PlayerLobby/lobby.gd83
-rw-r--r--UI/PlayerLobby/lobby.gd.uid1
-rw-r--r--UI/PlayerLobby/lobby_setting.gd.uid1
-rw-r--r--UI/PlayerLobby/lobby_setting.tscn2
-rw-r--r--UI/PlayerLobby/map_button.gd6
-rw-r--r--UI/PlayerLobby/map_button.gd.uid1
-rw-r--r--UI/PlayerLobby/map_button.tscn9
-rw-r--r--UI/PlayersList.tscn2
-rw-r--r--UI/SpawnButton.tscn2
-rw-r--r--UI/Start.gd3
-rw-r--r--UI/Start.gd.uid1
-rw-r--r--UI/Start.tscn2
-rw-r--r--UI/TowerConfiguration.tscn2
-rw-r--r--UI/collision_visibility_area.gd.uid1
-rw-r--r--UI/contain_container.gd.uid1
-rw-r--r--UI/game_menu.gd.uid1
-rw-r--r--UI/hp_bar.gd.uid1
-rw-r--r--UI/players_list.gd.uid1
-rw-r--r--UI/players_list_container.gd.uid1
-rw-r--r--UI/players_list_container.tscn2
-rw-r--r--UI/sliding_background.gdshader.uid1
-rw-r--r--UI/spawn_button.gd2
-rw-r--r--UI/spawn_button.gd.uid1
-rw-r--r--UI/tower_configuration.gd.uid1
38 files changed, 181 insertions, 90 deletions
diff --git a/UI/Camera.gd b/UI/Camera.gd
index 1fd9361..b736e3a 100644
--- a/UI/Camera.gd
+++ b/UI/Camera.gd
@@ -13,6 +13,10 @@ var edge := Vector2.ZERO
@export var speed := 25
+@export_group("Limit", "limit")
+@export var limit_map: TileMapLayer
+@export var limit_margin: int
+
@export_group("Zoom", "zoom")
@export var zoom_min: float = 0.5
@export var zoom_max: float = 3
@@ -33,6 +37,11 @@ func _ready():
zoomed.emit(zoom)
)
+ limit_left = limit_map.get_used_rect().position.x * limit_map.tile_set.tile_size.x - limit_margin * limit_map.tile_set.tile_size.x
+ limit_right = limit_map.get_used_rect().end.x * limit_map.tile_set.tile_size.x + limit_margin * limit_map.tile_set.tile_size.x
+ limit_top = limit_map.get_used_rect().position.y * limit_map.tile_set.tile_size.y - (limit_margin + 1) * limit_map.tile_set.tile_size.y
+ limit_bottom = limit_map.get_used_rect().end.y * limit_map.tile_set.tile_size.y + limit_margin * limit_map.tile_set.tile_size.y
+
#Input.mouse_mode = Input.MOUSE_MODE_CONFINED
@@ -63,7 +72,8 @@ func _input(event):
Input.set_default_cursor_shape(Input.CURSOR_MOVE)
elif event.is_action_released("camera_drag"):
is_in_drag_mode = false
- Input.set_default_cursor_shape(Input.CURSOR_ARROW)
+ if Input.get_current_cursor_shape() == Input.CURSOR_MOVE:
+ Input.set_default_cursor_shape(Input.CURSOR_ARROW)
if event is InputEventMouseMotion:
diff --git a/UI/Camera.gd.uid b/UI/Camera.gd.uid
new file mode 100644
index 0000000..9482336
--- /dev/null
+++ b/UI/Camera.gd.uid
@@ -0,0 +1 @@
+uid://cdtjyj7ivtru1
diff --git a/UI/Camera.tscn b/UI/Camera.tscn
index 869cd53..061332b 100644
--- a/UI/Camera.tscn
+++ b/UI/Camera.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://t8feyd2giabm"]
-[ext_resource type="Script" path="res://UI/Camera.gd" id="1_yiia3"]
+[ext_resource type="Script" uid="uid://cdtjyj7ivtru1" path="res://UI/Camera.gd" id="1_yiia3"]
[node name="Camera" type="Camera2D" groups=["camera"]]
anchor_mode = 0
diff --git a/UI/CollisionVisibilityArea.tscn b/UI/CollisionVisibilityArea.tscn
index 8ddcb01..aa02f7c 100644
--- a/UI/CollisionVisibilityArea.tscn
+++ b/UI/CollisionVisibilityArea.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cddsncmdb8g2j"]
-[ext_resource type="Script" path="res://UI/collision_visibility_area.gd" id="1_8fa5c"]
+[ext_resource type="Script" uid="uid://d1hu2usw8lyu2" path="res://UI/collision_visibility_area.gd" id="1_8fa5c"]
[node name="CollisionVisibilityArea" type="Area2D"]
script = ExtResource("1_8fa5c")
diff --git a/UI/ContainContainer.tscn b/UI/ContainContainer.tscn
index d9120ed..2bac30a 100644
--- a/UI/ContainContainer.tscn
+++ b/UI/ContainContainer.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://pchnqnutfth7"]
-[ext_resource type="Script" path="res://UI/contain_container.gd" id="1_oswre"]
+[ext_resource type="Script" uid="uid://bcx8c2kwehj4m" path="res://UI/contain_container.gd" id="1_oswre"]
[node name="ContainContainer" type="Container"]
script = ExtResource("1_oswre")
diff --git a/UI/GameMenu.tscn b/UI/GameMenu.tscn
index cf6646e..381b024 100644
--- a/UI/GameMenu.tscn
+++ b/UI/GameMenu.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://c13v4wmjm4sev"]
-[ext_resource type="Script" path="res://UI/game_menu.gd" id="1_frq7d"]
+[ext_resource type="Script" uid="uid://doa661nvsiwtb" path="res://UI/game_menu.gd" id="1_frq7d"]
[node name="GameMenu" type="Control"]
layout_mode = 3
diff --git a/UI/GameLobby/game_lobby.gd b/UI/GamesLobby/games_lobby.gd
index 85a8a91..b829337 100644
--- a/UI/GameLobby/game_lobby.gd
+++ b/UI/GamesLobby/games_lobby.gd
@@ -5,12 +5,14 @@ var games := []
var refresh_interval := 15.0
-@onready var lobby_game_scene := preload("res://UI/GameLobby/lobby_game.tscn")
+@onready var lobby_game_scene := preload("res://UI/GamesLobby/lobby_game.tscn")
func _ready() -> void:
%GamesList.get_child(0).queue_free()
+ %ServerUrl.text = GameLobby.server_base_url
+
if await check_game_lobby_available():
get_server_list()
$RefreshTimer.wait_time = refresh_interval
@@ -36,11 +38,16 @@ func get_server_list():
for node in %GamesList.get_children():
node.queue_free()
- for game in result["data"]:
- var lobby_game = lobby_game_scene.instantiate()
- lobby_game.game_id = game["id"]
- lobby_game.game_name = game["name"]
- %GamesList.add_child(lobby_game)
+ if result["data"].size() > 0:
+ %NoGamesFound.visible = false
+
+ for game in result["data"]:
+ var lobby_game = lobby_game_scene.instantiate()
+ lobby_game.game_id = game["id"]
+ lobby_game.game_name = game["name"]
+ %GamesList.add_child(lobby_game)
+ else:
+ %NoGamesFound.visible = true
func _on_back_button_pressed() -> void:
@@ -55,3 +62,15 @@ func _on_refresh_pressed() -> void:
func _on_refresh_timer_timeout() -> void:
get_server_list()
+
+
+func _on_set_server_pressed() -> void:
+ var config = Client.get_config()
+ config.set_value(
+ "general",
+ "game_lobby_server_base_url",
+ %ServerUrl.text
+ )
+ config.save("user://config")
+
+ GameLobby.server_base_url = %ServerUrl.text
diff --git a/UI/GamesLobby/games_lobby.gd.uid b/UI/GamesLobby/games_lobby.gd.uid
new file mode 100644
index 0000000..f884ee2
--- /dev/null
+++ b/UI/GamesLobby/games_lobby.gd.uid
@@ -0,0 +1 @@
+uid://ch3yprxw8y15i
diff --git a/UI/GameLobby/game_lobby.tscn b/UI/GamesLobby/games_lobby.tscn
index 241dbe5..bbcde3b 100644
--- a/UI/GameLobby/game_lobby.tscn
+++ b/UI/GamesLobby/games_lobby.tscn
@@ -1,18 +1,18 @@
[gd_scene load_steps=5 format=3 uid="uid://b0uqf5h2j7fvk"]
-[ext_resource type="Script" path="res://UI/GameLobby/game_lobby.gd" id="1_1vvm7"]
-[ext_resource type="Texture2D" uid="uid://kwgx33awj4y2" path="res://UI/Assets/Enjl-Starry Space Background/background_1.png" id="2_tyk1u"]
-[ext_resource type="Theme" uid="uid://bt84t61hrvoyn" path="res://UI/PlayerLobby/lobby_theme.tres" id="3_3iumi"]
-[ext_resource type="PackedScene" uid="uid://cs2a7wfrj4wn0" path="res://UI/GameLobby/lobby_game.tscn" id="3_83gpr"]
+[ext_resource type="Script" uid="uid://ch3yprxw8y15i" path="res://UI/GamesLobby/games_lobby.gd" id="1_4dbpy"]
+[ext_resource type="Texture2D" uid="uid://kwgx33awj4y2" path="res://UI/Assets/Enjl-Starry Space Background/background_1.png" id="2_up3jk"]
+[ext_resource type="PackedScene" uid="uid://cs2a7wfrj4wn0" path="res://UI/GamesLobby/lobby_game.tscn" id="3_wofvj"]
+[ext_resource type="Theme" uid="uid://bt84t61hrvoyn" path="res://UI/PlayerLobby/lobby_theme.tres" id="4_k7oqv"]
-[node name="GameLobby" type="Control"]
+[node name="GamesLobby" 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_1vvm7")
+script = ExtResource("1_4dbpy")
[node name="Background" type="Control" parent="."]
layout_mode = 1
@@ -38,7 +38,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
-texture = ExtResource("2_tyk1u")
+texture = ExtResource("2_up3jk")
stretch_mode = 1
[node name="MarginContainer" type="MarginContainer" parent="."]
@@ -60,7 +60,8 @@ layout_mode = 2
unique_name_in_owner = true
layout_mode = 2
-[node name="LobbyGame" parent="MarginContainer/CenterContainer/GamesList" instance=ExtResource("3_83gpr")]
+[node name="LobbyGame" parent="MarginContainer/CenterContainer/GamesList" instance=ExtResource("3_wofvj")]
+visible = false
layout_mode = 2
[node name="ServerNotReachable" type="Label" parent="MarginContainer/CenterContainer"]
@@ -69,11 +70,17 @@ visible = false
layout_mode = 2
text = "Game Lobby Server at %SERVER% not reachable"
+[node name="NoGamesFound" type="Label" parent="MarginContainer/CenterContainer"]
+unique_name_in_owner = true
+visible = false
+layout_mode = 2
+text = "No Games Found"
+
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
-theme = ExtResource("3_3iumi")
+theme = ExtResource("4_k7oqv")
[node name="Refresh" type="Button" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
@@ -87,8 +94,24 @@ layout_mode = 2
mouse_default_cursor_shape = 2
text = "Back"
+[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
+layout_mode = 2
+size_flags_horizontal = 8
+size_flags_vertical = 0
+
+[node name="ServerUrl" type="LineEdit" parent="MarginContainer/HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+expand_to_text_length = true
+
+[node name="SetServer" type="Button" parent="MarginContainer/HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+text = "Set Server"
+
[node name="RefreshTimer" type="Timer" parent="."]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Refresh" to="." method="_on_refresh_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/BackButton" to="." method="_on_back_button_pressed"]
+[connection signal="pressed" from="MarginContainer/HBoxContainer/SetServer" to="." method="_on_set_server_pressed"]
[connection signal="timeout" from="RefreshTimer" to="." method="_on_refresh_timer_timeout"]
diff --git a/UI/GameLobby/lobby_game.gd b/UI/GamesLobby/lobby_game.gd
index 2433dfd..39f9076 100644
--- a/UI/GameLobby/lobby_game.gd
+++ b/UI/GamesLobby/lobby_game.gd
@@ -16,6 +16,7 @@ func _on_join_pressed() -> void:
var result = response.parse_json()
var game_data = result["data"]
+ print(game_data)
Network.join_game(game_data["ip"], game_data["port"])
get_tree().change_scene_to_file("res://UI/PlayerLobby/Lobby.tscn")
else:
diff --git a/UI/GamesLobby/lobby_game.gd.uid b/UI/GamesLobby/lobby_game.gd.uid
new file mode 100644
index 0000000..5ea3c00
--- /dev/null
+++ b/UI/GamesLobby/lobby_game.gd.uid
@@ -0,0 +1 @@
+uid://ipkke6duqoi6
diff --git a/UI/GameLobby/lobby_game.tscn b/UI/GamesLobby/lobby_game.tscn
index a6809ac..22f5525 100644
--- a/UI/GameLobby/lobby_game.tscn
+++ b/UI/GamesLobby/lobby_game.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cs2a7wfrj4wn0"]
-[ext_resource type="Script" path="res://UI/GameLobby/lobby_game.gd" id="1_cvsql"]
+[ext_resource type="Script" uid="uid://ipkke6duqoi6" path="res://UI/GamesLobby/lobby_game.gd" id="1_cvsql"]
[node name="LobbyGame" type="HBoxContainer"]
script = ExtResource("1_cvsql")
diff --git a/UI/HPBar.tscn b/UI/HPBar.tscn
index fdd0542..7d03e1f 100644
--- a/UI/HPBar.tscn
+++ b/UI/HPBar.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://bjcrf4o4a80iv"]
-[ext_resource type="Script" path="res://UI/hp_bar.gd" id="1_63fia"]
+[ext_resource type="Script" uid="uid://cndetkp0v8w8y" path="res://UI/hp_bar.gd" id="1_63fia"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_c6ayl"]
diff --git a/UI/PlayerLobby/Lobby.tscn b/UI/PlayerLobby/Lobby.tscn
index 228d512..05eaea1 100644
--- a/UI/PlayerLobby/Lobby.tscn
+++ b/UI/PlayerLobby/Lobby.tscn
@@ -1,15 +1,16 @@
-[gd_scene load_steps=11 format=3 uid="uid://r45j806p4a74"]
+[gd_scene load_steps=12 format=3 uid="uid://r45j806p4a74"]
-[ext_resource type="Script" path="res://UI/PlayerLobby/lobby.gd" id="1_mm4gt"]
+[ext_resource type="Script" uid="uid://87etsgjm04nb" path="res://UI/PlayerLobby/lobby.gd" id="1_mm4gt"]
[ext_resource type="Texture2D" uid="uid://kwgx33awj4y2" path="res://UI/Assets/Enjl-Starry Space Background/background_1.png" id="2_0pdjl"]
[ext_resource type="Theme" uid="uid://bt84t61hrvoyn" path="res://UI/PlayerLobby/lobby_theme.tres" id="2_syjfh"]
[ext_resource type="PackedScene" uid="uid://cq6p055yuac0o" path="res://UI/players_list_container.tscn" id="3_2r7nj"]
-[ext_resource type="PackedScene" uid="uid://bl65jllb3e2py" path="res://Stages/Wintermaul/Wintermaul.tscn" id="3_3hc3h"]
[ext_resource type="Texture2D" uid="uid://ci7qydmwbanbp" path="res://Stages/Wintermaul/Assets/thumbnail.png" id="3_8r1n2"]
[ext_resource type="PackedScene" uid="uid://dwscklgkbhq28" path="res://Stages/Wintermaul2/Wintermaul2.tscn" id="4_v1caa"]
+[ext_resource type="PackedScene" uid="uid://uwfmfa3c0gqk" path="res://UI/PlayerLobby/map_button.tscn" id="5_3omml"]
[ext_resource type="Texture2D" uid="uid://cfiu7ah67vdpg" path="res://Stages/Square/Assets/thumbnail.png" id="5_5ewsi"]
-[ext_resource type="PackedScene" uid="uid://jxy7fj7yymfl" path="res://Stages/TinySwords/WintermaulTinySwords.tscn" id="5_hnsfx"]
[ext_resource type="Texture2D" uid="uid://cujvoqsqfrl4a" path="res://Stages/Wintermaul2/Assets/thumbnail.png" id="5_j23oc"]
+[ext_resource type="PackedScene" uid="uid://bl65jllb3e2py" path="res://Stages/Wintermaul/Wintermaul.tscn" id="6_qk8ma"]
+[ext_resource type="PackedScene" uid="uid://cw0hxxa1m1qm7" path="res://Stages/Square/square.tscn" id="8_qk8ma"]
[node name="Lobby" type="Control"]
layout_mode = 3
@@ -85,37 +86,23 @@ layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("2_syjfh")
-[node name="MapButton" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
+[node name="MapButton" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps" instance=ExtResource("5_3omml")]
layout_mode = 2
-mouse_default_cursor_shape = 2
-toggle_mode = true
-text = "Wintermaul"
-metadata/map_scene = ExtResource("3_3hc3h")
-metadata/thumbnail = ExtResource("3_8r1n2")
-metadata/settings = ["starting_lives", "starting_money", "starting_income", "use_premade_teams"]
+map_scene = ExtResource("6_qk8ma")
+thumbnail = ExtResource("3_8r1n2")
+settings = Array[String](["starting_lives", "starting_money", "starting_income", "use_premade_teams"])
-[node name="MapButton2" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
+[node name="MapButton2" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps" instance=ExtResource("5_3omml")]
layout_mode = 2
-mouse_default_cursor_shape = 2
-toggle_mode = true
text = "Squares"
-metadata/thumbnail = ExtResource("5_5ewsi")
+map_scene = ExtResource("8_qk8ma")
+thumbnail = ExtResource("5_5ewsi")
-[node name="MapButton3" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
+[node name="MapButton3" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps" instance=ExtResource("5_3omml")]
layout_mode = 2
-mouse_default_cursor_shape = 2
-toggle_mode = true
text = "Wintermaul 2"
-metadata/map_scene = ExtResource("4_v1caa")
-metadata/thumbnail = ExtResource("5_j23oc")
-
-[node name="MapButton4" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
-visible = false
-layout_mode = 2
-mouse_default_cursor_shape = 2
-toggle_mode = true
-text = "Wintermaul Tiny Swords"
-metadata/map_scene = ExtResource("5_hnsfx")
+map_scene = ExtResource("4_v1caa")
+thumbnail = ExtResource("5_j23oc")
[node name="Thumbnail" type="TextureRect" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer"]
unique_name_in_owner = true
diff --git a/UI/PlayerLobby/lobby.gd b/UI/PlayerLobby/lobby.gd
index 4169478..c391a11 100644
--- a/UI/PlayerLobby/lobby.gd
+++ b/UI/PlayerLobby/lobby.gd
@@ -19,7 +19,11 @@ func _ready() -> void:
if multiplayer.is_server():
joined.connect(func():
set_map.rpc(current_map_idx)
+ for setting in settings:
+ set_setting.rpc(setting, settings[setting])
+ # TODO: check that use_premade_teams behaves correctly on join
)
+
for idx in %Maps.get_child_count():
%Maps.get_child(idx).pressed.connect(func():
if current_map_idx != idx:
@@ -45,7 +49,7 @@ func _ready() -> void:
if multiplayer.is_server():
$KeepAliveTimer.start()
$KeepAliveTimer.timeout.connect(func():
- GameLobby.request_post("/keep-alive")
+ await GameLobby.request_post("/keep-alive")
)
@@ -72,7 +76,6 @@ func update_list(current_list: Control, player_ids: Array):
label.add_theme_constant_override("outline_size", 10)
control.add_child(label)
current_list.add_child(control)
- #joined.emit()
control.get_child(0).text = str(player.username)
control.get_child(0).tooltip_text = str(id)
@@ -81,12 +84,14 @@ func update_list(current_list: Control, player_ids: Array):
func _on_peer_connected(id):
Network._on_peer_connected(id)
+ joined.emit()
+
func _on_peer_disconnected(id):
Network._on_peer_disconnected(id)
func _on_start_button_pressed() -> void:
- start.rpc()
+ start.rpc(settings)
func _on_cancel_button_pressed() -> void:
@@ -97,19 +102,21 @@ func _on_cancel_button_pressed() -> void:
@rpc("authority", "call_local")
-func start():
- var packed_scene = %Maps.get_child(current_map_idx).get_meta("map_scene")
+func start(host_settings: Dictionary):
+ var packed_scene = %Maps.get_child(current_map_idx).map_scene
var scene = packed_scene.instantiate()
- for setting in settings:
- scene[setting] = settings[setting]
+ for setting in host_settings:
+ scene[setting] = host_settings[setting]
- if settings.get("use_premade_teams"):
+ if host_settings.get("use_premade_teams"):
var premade_teams = {}
for team_name in teams:
premade_teams[team_name] = teams[team_name]["players"]
scene.premade_teams = premade_teams
+ multiplayer.multiplayer_peer.refuse_new_connections = true
+
Client.change_scene_to_instance(scene)
@@ -125,16 +132,18 @@ func set_map(index: int):
node.add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 0.5))
var map_button = %Maps.get_child(index)
- var thumbnail = map_button.get_meta("thumbnail")
+ var thumbnail = map_button.thumbnail
# settings
for child in %Settings.get_children():
- child.queue_free()
- if map_button.has_meta("settings"):
- current_map_scene = map_button.get_meta("map_scene").instantiate()
- var map_settings = map_button.get_meta("settings", [])
- for setting in map_settings:
- settings[setting] = current_map_scene[setting]
+ child.free()
+
+ if map_button.settings.size() > 0:
+ current_map_scene = map_button.map_scene.instantiate()
+ for setting in map_button.settings:
+ if not settings.has(setting):
+ settings[setting] = current_map_scene[setting]
+
var control = preload("res://UI/PlayerLobby/lobby_setting.tscn").instantiate()
control.label = setting
control.value = settings[setting]
@@ -157,26 +166,36 @@ func set_setting(key: String, value: Variant):
%Settings.get_node(key).value = value
# generate PlayersLists per team with clickable labels to switch team
- if settings.get("use_premade_teams"):
- %PlayersListContainer.visible = false
- var team_names = current_map_scene.teams.names()
- var players_per_team = Network.get_ordered_player_ids().size() / team_names.size()
- for idx in team_names.size():
- var team_name = team_names[idx]
-
- var new_list_container = preload("res://UI/players_list_container.tscn").instantiate()
- new_list_container.label = team_name.to_upper()
- new_list_container.clicked.connect(func():
- switch_team.rpc(team_name)
+ if key == "use_premade_teams":
+ if value:
+ %PlayersListContainer.visible = false
+ var team_names = current_map_scene.teams.names()
+ var players_per_team = ceil(
+ float(Network.get_ordered_player_ids().size()) / float(team_names.size())
)
- %Teams.add_child(new_list_container)
- var offset = players_per_team * idx
- teams[team_name] = {}
- teams[team_name]["players"] = Network.get_ordered_player_ids().slice(offset, offset + players_per_team)
- teams[team_name]["list"] = new_list_container.list
+ for idx in team_names.size():
+ var team_name = team_names[idx]
+
+ var new_list_container = preload("res://UI/players_list_container.tscn").instantiate()
+ new_list_container.label = team_name.to_upper()
+ new_list_container.clicked.connect(func():
+ switch_team.rpc(team_name)
+ )
+ %Teams.add_child(new_list_container)
+
+ var offset = players_per_team * idx
+ teams[team_name] = {}
+ teams[team_name]["players"] = Network.get_ordered_player_ids().slice(offset, offset + players_per_team)
+ teams[team_name]["list"] = new_list_container.list
+
+ update_list(teams[team_name]["list"], teams[team_name]["players"])
+ else:
+ for node in %Teams.get_children().slice(1): # get all but the main list
+ node.queue_free()
- update_list(teams[team_name]["list"], teams[team_name]["players"])
+ update_list(list, Network.get_ordered_player_ids())
+ %PlayersListContainer.visible = true
@rpc("any_peer", "call_local")
diff --git a/UI/PlayerLobby/lobby.gd.uid b/UI/PlayerLobby/lobby.gd.uid
new file mode 100644
index 0000000..f3af632
--- /dev/null
+++ b/UI/PlayerLobby/lobby.gd.uid
@@ -0,0 +1 @@
+uid://87etsgjm04nb
diff --git a/UI/PlayerLobby/lobby_setting.gd.uid b/UI/PlayerLobby/lobby_setting.gd.uid
new file mode 100644
index 0000000..b2bfbef
--- /dev/null
+++ b/UI/PlayerLobby/lobby_setting.gd.uid
@@ -0,0 +1 @@
+uid://b47vm2uggdqxn
diff --git a/UI/PlayerLobby/lobby_setting.tscn b/UI/PlayerLobby/lobby_setting.tscn
index 62d1c66..d4baded 100644
--- a/UI/PlayerLobby/lobby_setting.tscn
+++ b/UI/PlayerLobby/lobby_setting.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://fgqkxat8pwjk"]
-[ext_resource type="Script" path="res://UI/PlayerLobby/lobby_setting.gd" id="1_ntovh"]
+[ext_resource type="Script" uid="uid://b47vm2uggdqxn" path="res://UI/PlayerLobby/lobby_setting.gd" id="1_ntovh"]
[node name="LobbySetting" type="HBoxContainer"]
size_flags_vertical = 2
diff --git a/UI/PlayerLobby/map_button.gd b/UI/PlayerLobby/map_button.gd
new file mode 100644
index 0000000..a52c2f7
--- /dev/null
+++ b/UI/PlayerLobby/map_button.gd
@@ -0,0 +1,6 @@
+extends Button
+
+
+@export var map_scene: PackedScene
+@export var thumbnail: Texture2D
+@export var settings: Array[String]
diff --git a/UI/PlayerLobby/map_button.gd.uid b/UI/PlayerLobby/map_button.gd.uid
new file mode 100644
index 0000000..6c7009f
--- /dev/null
+++ b/UI/PlayerLobby/map_button.gd.uid
@@ -0,0 +1 @@
+uid://c118jfgnuae7q
diff --git a/UI/PlayerLobby/map_button.tscn b/UI/PlayerLobby/map_button.tscn
new file mode 100644
index 0000000..c947db1
--- /dev/null
+++ b/UI/PlayerLobby/map_button.tscn
@@ -0,0 +1,9 @@
+[gd_scene load_steps=2 format=3 uid="uid://uwfmfa3c0gqk"]
+
+[ext_resource type="Script" uid="uid://c118jfgnuae7q" path="res://UI/PlayerLobby/map_button.gd" id="1_ks6re"]
+
+[node name="MapButton" type="Button"]
+mouse_default_cursor_shape = 2
+toggle_mode = true
+text = "Wintermaul"
+script = ExtResource("1_ks6re")
diff --git a/UI/PlayersList.tscn b/UI/PlayersList.tscn
index fabc008..a0ff21c 100644
--- a/UI/PlayersList.tscn
+++ b/UI/PlayersList.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://cxd6c4kbnk04c"]
-[ext_resource type="Script" path="res://UI/players_list.gd" id="1_67rpy"]
+[ext_resource type="Script" uid="uid://b8kj5jawk4ye6" path="res://UI/players_list.gd" id="1_67rpy"]
[ext_resource type="Theme" uid="uid://c7f1ftrx53ag1" path="res://theme.tres" id="1_igafg"]
[ext_resource type="PackedScene" uid="uid://dslebs7aarkoa" path="res://UI/panel_background_blue.tscn" id="2_3bkxi"]
[ext_resource type="PackedScene" uid="uid://wxe1hpn013y8" path="res://UI/PlayersListItem.tscn" id="2_ug8m7"]
diff --git a/UI/SpawnButton.tscn b/UI/SpawnButton.tscn
index a5954a0..78ab2d7 100644
--- a/UI/SpawnButton.tscn
+++ b/UI/SpawnButton.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://x6kohecnw7f5"]
-[ext_resource type="Script" path="res://UI/spawn_button.gd" id="1_ayei4"]
+[ext_resource type="Script" uid="uid://pm435vpllta1" path="res://UI/spawn_button.gd" id="1_ayei4"]
[node name="SpawnButton" type="TextureButton"]
texture_filter = 1
diff --git a/UI/Start.gd b/UI/Start.gd
index 85a7946..53b18fb 100644
--- a/UI/Start.gd
+++ b/UI/Start.gd
@@ -31,6 +31,7 @@ func get_port() -> int:
func _on_peer_connected(id):
Network._on_peer_connected(id)
+
func _on_peer_disconnected(id):
Network._on_peer_disconnected(id)
@@ -57,4 +58,4 @@ func _on_join_pressed() -> void:
func _on_search_pressed() -> void:
Client.player.username = %Username.text
- get_tree().change_scene_to_file("res://UI/GameLobby/game_lobby.tscn")
+ get_tree().change_scene_to_file("res://UI/GamesLobby/games_lobby.tscn")
diff --git a/UI/Start.gd.uid b/UI/Start.gd.uid
new file mode 100644
index 0000000..4353185
--- /dev/null
+++ b/UI/Start.gd.uid
@@ -0,0 +1 @@
+uid://d2s0wofufuo05
diff --git a/UI/Start.tscn b/UI/Start.tscn
index b0d4ac2..aa7d8b1 100644
--- a/UI/Start.tscn
+++ b/UI/Start.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://bcbxer883ygg7"]
-[ext_resource type="Script" path="res://UI/Start.gd" id="1_h1h6c"]
+[ext_resource type="Script" uid="uid://d2s0wofufuo05" path="res://UI/Start.gd" id="1_h1h6c"]
[ext_resource type="Theme" uid="uid://c7f1ftrx53ag1" path="res://theme.tres" id="1_uriow"]
[ext_resource type="Texture2D" uid="uid://kwgx33awj4y2" path="res://UI/Assets/Enjl-Starry Space Background/background_1.png" id="2_fxy5w"]
diff --git a/UI/TowerConfiguration.tscn b/UI/TowerConfiguration.tscn
index ba8c2a9..38587be 100644
--- a/UI/TowerConfiguration.tscn
+++ b/UI/TowerConfiguration.tscn
@@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://c05aq7xd4kx1p"]
[ext_resource type="Texture2D" uid="uid://dujcs2ls3u6tj" path="res://Towers/Assets/spritesheet.png" id="2_m6q2y"]
-[ext_resource type="Script" path="res://UI/tower_configuration.gd" id="2_vvfd0"]
+[ext_resource type="Script" uid="uid://be0wi1458bdae" path="res://UI/tower_configuration.gd" id="2_vvfd0"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_k0400"]
diff --git a/UI/collision_visibility_area.gd.uid b/UI/collision_visibility_area.gd.uid
new file mode 100644
index 0000000..17f6e49
--- /dev/null
+++ b/UI/collision_visibility_area.gd.uid
@@ -0,0 +1 @@
+uid://d1hu2usw8lyu2
diff --git a/UI/contain_container.gd.uid b/UI/contain_container.gd.uid
new file mode 100644
index 0000000..d701bfb
--- /dev/null
+++ b/UI/contain_container.gd.uid
@@ -0,0 +1 @@
+uid://bcx8c2kwehj4m
diff --git a/UI/game_menu.gd.uid b/UI/game_menu.gd.uid
new file mode 100644
index 0000000..beec871
--- /dev/null
+++ b/UI/game_menu.gd.uid
@@ -0,0 +1 @@
+uid://doa661nvsiwtb
diff --git a/UI/hp_bar.gd.uid b/UI/hp_bar.gd.uid
new file mode 100644
index 0000000..4971b3e
--- /dev/null
+++ b/UI/hp_bar.gd.uid
@@ -0,0 +1 @@
+uid://cndetkp0v8w8y
diff --git a/UI/players_list.gd.uid b/UI/players_list.gd.uid
new file mode 100644
index 0000000..98a819f
--- /dev/null
+++ b/UI/players_list.gd.uid
@@ -0,0 +1 @@
+uid://b8kj5jawk4ye6
diff --git a/UI/players_list_container.gd.uid b/UI/players_list_container.gd.uid
new file mode 100644
index 0000000..80e4ea0
--- /dev/null
+++ b/UI/players_list_container.gd.uid
@@ -0,0 +1 @@
+uid://daqhvycu4o8hx
diff --git a/UI/players_list_container.tscn b/UI/players_list_container.tscn
index 8920286..18dd9cc 100644
--- a/UI/players_list_container.tscn
+++ b/UI/players_list_container.tscn
@@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://cq6p055yuac0o"]
-[ext_resource type="Script" path="res://UI/players_list_container.gd" id="1_f2j1s"]
+[ext_resource type="Script" uid="uid://daqhvycu4o8hx" path="res://UI/players_list_container.gd" id="1_f2j1s"]
[ext_resource type="PackedScene" uid="uid://dslebs7aarkoa" path="res://UI/panel_background_blue.tscn" id="1_y7ccy"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fm6m2"]
diff --git a/UI/sliding_background.gdshader.uid b/UI/sliding_background.gdshader.uid
new file mode 100644
index 0000000..55932ba
--- /dev/null
+++ b/UI/sliding_background.gdshader.uid
@@ -0,0 +1 @@
+uid://bvni6cdwtojtr
diff --git a/UI/spawn_button.gd b/UI/spawn_button.gd
index bcf9da0..a5a1947 100644
--- a/UI/spawn_button.gd
+++ b/UI/spawn_button.gd
@@ -13,4 +13,4 @@ func _on_pressed() -> void:
unit.unit_resource = unit_resource
- Client.spawn_unit(unit, Client.current_stage.get_spawn(), Client.current_stage.get_overwrite_target())
+ Client.spawn_unit(unit, Client.current_stage.get_spawn(), Client.current_stage.get_spawn_target())
diff --git a/UI/spawn_button.gd.uid b/UI/spawn_button.gd.uid
new file mode 100644
index 0000000..d3cfa3d
--- /dev/null
+++ b/UI/spawn_button.gd.uid
@@ -0,0 +1 @@
+uid://pm435vpllta1
diff --git a/UI/tower_configuration.gd.uid b/UI/tower_configuration.gd.uid
new file mode 100644
index 0000000..6f18ad6
--- /dev/null
+++ b/UI/tower_configuration.gd.uid
@@ -0,0 +1 @@
+uid://be0wi1458bdae