summaryrefslogtreecommitdiff
path: root/UI/CharacterSelect.gd
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-02-08 15:05:09 +0100
committerDaniel Weipert <code@drogueronin.de>2021-02-08 15:05:09 +0100
commitcc278651a6aee0de5f928b4bc423e3b705a6b006 (patch)
tree89ea325d3c116de691c95bf202330985d437159b /UI/CharacterSelect.gd
parent8224cb660460f6af7b6cae8b7882bd036bab46ea (diff)
Highlights Characters on select
Diffstat (limited to 'UI/CharacterSelect.gd')
-rw-r--r--UI/CharacterSelect.gd14
1 files changed, 14 insertions, 0 deletions
diff --git a/UI/CharacterSelect.gd b/UI/CharacterSelect.gd
index fc84a35..bc6dab1 100644
--- a/UI/CharacterSelect.gd
+++ b/UI/CharacterSelect.gd
@@ -3,8 +3,14 @@ extends Panel
var players_selected = {}
+var bg_color_selected = '#fffba5'
+var style_selected = StyleBoxFlat.new()
+var style_deselected = StyleBoxFlat.new()
+
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()
@@ -12,10 +18,18 @@ func set_Wait_text():
$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("custom_styles/panel", self.style_deselected)
+
+ get_node(character + "Panel").set("custom_styles/panel", self.style_selected)
+
+
func _button_pressed(event, character):
if event is InputEventMouseButton or event is InputEventKey:
if event.pressed:
rpc("_character_selected", character)
+ self.set_bg_color_selected(character, Network.player.character)
Network.player.character = character