From 0bfda86c29d106df5fa3dd16d925c193b3f726c7 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 25 Dec 2023 00:21:50 +0100 Subject: UI + HUD alignment --- UI/CharacterSelect.gd | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'UI/CharacterSelect.gd') diff --git a/UI/CharacterSelect.gd b/UI/CharacterSelect.gd index 6ae7de0..348ef22 100644 --- a/UI/CharacterSelect.gd +++ b/UI/CharacterSelect.gd @@ -1,4 +1,4 @@ -extends Panel +extends Control var players_selected = {} @@ -12,17 +12,20 @@ func _ready(): self.style_selected.set_bg_color(self.bg_color_selected) self.style_deselected.set_bg_color(Color(0, 0, 0, 0)) self.set_Wait_text() + + if multiplayer.is_server(): + $Panel/VBoxContainer/StartButton.visible = true func set_Wait_text(): - $Wait.text = "Waiting for " + str(Network.get_player_count() - self.players_selected.size()) + " players to choose" + $Panel/VBoxContainer/MarginContainer/Wait.text = "Waiting for " + str(Network.get_player_count() - self.players_selected.size()) + " players to choose" func set_bg_color_selected(character, previous_character = null): if previous_character: - get_node(previous_character + "Panel").set("theme_override_styles/panel", self.style_deselected) + get_node("Panel/VBoxContainer/GridContainer/" + previous_character + "Panel").set("theme_override_styles/panel", self.style_deselected) - get_node(character + "Panel").set("theme_override_styles/panel", self.style_selected) + get_node("Panel/VBoxContainer/GridContainer/" + character + "Panel").set("theme_override_styles/panel", self.style_selected) func _button_pressed(event, character): @@ -41,4 +44,9 @@ func _button_pressed(event, character): self.set_Wait_text() if Network.get_player_count() == self.players_selected.size(): - get_tree().change_scene_to_file("res://UI/LevelSelect.tscn") + if multiplayer.is_server(): + $Panel/VBoxContainer/StartButton.disabled = false + + +func _on_start_button_pressed(): + get_tree().change_scene_to_file("res://UI/LevelSelect.tscn") -- cgit v1.2.3