Randoloot/scripts/ui/mission_objectives.gd
2026-10-18 18:47:18 +02:00

49 lines
1.8 KiB
GDScript

extends PanelContainer
var game: Node2D
var _objective: Label
func _ready() -> void:
mouse_filter = Control.MOUSE_FILTER_IGNORE
var style := StyleBoxFlat.new()
style.bg_color = Color(0.025, 0.041, 0.063, 0.72)
style.border_color = Color("376779")
style.set_border_width_all(1)
style.set_corner_radius_all(6)
style.set_content_margin_all(12)
add_theme_stylebox_override("panel", style)
var contents := VBoxContainer.new()
contents.mouse_filter = Control.MOUSE_FILTER_IGNORE
contents.add_theme_constant_override("separation", 6)
add_child(contents)
var title := Label.new()
title.text = "CELE"
title.mouse_filter = Control.MOUSE_FILTER_IGNORE
title.add_theme_font_size_override("font_size", 12)
title.add_theme_color_override("font_color", Color("91dbea"))
contents.add_child(title)
_objective = Label.new()
_objective.name = "CurrentObjective"
_objective.mouse_filter = Control.MOUSE_FILTER_IGNORE
_objective.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_objective.add_theme_font_size_override("font_size", 11)
_objective.add_theme_color_override("font_color", Color("efb568"))
contents.add_child(_objective)
func _process(_delta: float) -> void:
if not is_instance_valid(game):
return
if bool(game.get("system_cleared")):
_objective.text = "Znajdź zamieszkaną planetę"
elif bool(game.get("_boss_spawned")):
_objective.text = "Pokonaj bossa"
else:
_objective.text = "Pokonaj wszystkich wrogów"
var captain := get_parent().get_node_or_null("CaptainEquipment") as Control
if captain == null or not captain.is_visible_in_tree():
captain = get_parent().get_node_or_null("CaptainPanel") as Control
if is_instance_valid(captain):
size.x = captain.size.x
size.y = get_combined_minimum_size().y
position = captain.position + Vector2(0.0, captain.size.y + 8.0)