summaryrefslogtreecommitdiff
path: root/Stages/Wintermaul/HUD.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-20 12:09:48 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-10-20 12:09:48 +0200
commit6db6465d1b938ec494cd66c9984bff5cc14bde11 (patch)
tree9533b364e3e40ff813ef263ab05bd69ac31f8777 /Stages/Wintermaul/HUD.gd
parente82990eeafdf0be5d42d8aaa9b7fb6091e0d8435 (diff)
next commit
Diffstat (limited to 'Stages/Wintermaul/HUD.gd')
-rw-r--r--Stages/Wintermaul/HUD.gd50
1 files changed, 47 insertions, 3 deletions
diff --git a/Stages/Wintermaul/HUD.gd b/Stages/Wintermaul/HUD.gd
index b6722ae..6eeb7da 100644
--- a/Stages/Wintermaul/HUD.gd
+++ b/Stages/Wintermaul/HUD.gd
@@ -2,9 +2,9 @@ class_name HUD
extends CanvasLayer
+@onready var time: Label = %Time
@onready var money: Label = %Money
@onready var income: Label = %Income
-@onready var tower: Label = %Tower
@onready var spawn_box: Control = %SpawnBox
@onready var team_top: PanelContainer = %TeamTop
@onready var team_bottom: PanelContainer = %TeamBottom
@@ -27,9 +27,53 @@ func _ready():
Client.stage_state_changed.connect(func(state: State):
if state is StateBuild:
- $TowerConfigurationsContainer.visible = true
+ %TowerConfigurationsContainer.visible = true
else:
- $TowerConfigurationsContainer.visible = false
+ %TowerConfigurationsContainer.visible = false
+ )
+
+ # TODO: fix multi select
+ %SelectionContainer.visible = false
+ %SelectionData.get_child(0).queue_free()
+ %MultiSelectionContainer.visible = false
+ Client.placed_tower.connect(func(tower: Tower):
+ tower.selected.connect(func():
+ var hud_data = tower.get_hud()
+ hud_data.name = tower.name
+
+ var groups = {"md5:1": [], "md5_2": []}
+ var selected_group = "md5"
+ # TODO: build groups from current component configurations matches. md5 of property values?
+ # TODO: do in tower.gd at select?
+
+ if Tower.selected_towers.size() == 1:
+ %SelectionContainer.visible = true
+ %MultiSelectionContainer.visible = false
+
+ %SelectionData.add_child(hud_data)
+ %MultiSelectionList.add_child(hud_data.duplicate())
+ elif Tower.selected_towers.size() > 1:
+ %SelectionContainer.visible = false
+ %MultiSelectionContainer.visible = true
+
+ %MultiSelectionList.add_child(hud_data)
+ )
+ tower.deselected.connect(func():
+ if Tower.selected_towers.size() == 0:
+ %SelectionContainer.visible = false
+ %MultiSelectionContainer.visible = false
+
+ for child in %SelectionData.get_children():
+ child.queue_free()
+ for child in %MultiSelectionList.get_children():
+ child.queue_free()
+ elif Tower.selected_towers.size() == 1:
+ %MultiSelectionContainer.visible = false
+ %SelectionContainer.visible = true
+ elif Tower.selected_towers.size() > 1:
+ # only remove deselected tower from list
+ %MultiSelectionList.get_node(NodePath(tower.name)).queue_free()
+ )
)