feat: surface open opportunity need on villager field note
This commit is contained in:
@@ -14,6 +14,7 @@ const EXIT_OFFSET := 4.0
|
||||
@onready var target_label: Label = $Copy/Target
|
||||
@onready var carrying_label: Label = $Copy/Carrying
|
||||
@onready var reason_label: Label = $Copy/Reason
|
||||
@onready var need_label: Label = $Copy/Need
|
||||
|
||||
var copy_resting_position: Vector2
|
||||
var current_context_key := ""
|
||||
@@ -64,6 +65,7 @@ func _present(context: VillagerInspectionResult, animate: bool) -> void:
|
||||
target_label.text = "Target · %s" % context.target_name
|
||||
carrying_label.text = "Carrying · %s" % context.carrying_text()
|
||||
reason_label.text = "Why · %s" % context.decision_reason
|
||||
_present_opportunity_note(context.opportunity_note)
|
||||
visible = true
|
||||
accent.pivot_offset = accent.size * 0.5
|
||||
if not animate:
|
||||
@@ -81,6 +83,15 @@ func _present(context: VillagerInspectionResult, animate: bool) -> void:
|
||||
motion_tween.tween_property(accent, "scale:y", 1.0, 0.26)
|
||||
|
||||
|
||||
func _present_opportunity_note(note: VillagerOpportunityNote) -> void:
|
||||
if note == null or not note.has_need:
|
||||
need_label.visible = false
|
||||
need_label.text = "Need · "
|
||||
return
|
||||
need_label.visible = true
|
||||
need_label.text = "Need · %s\n%s" % [note.need_text, note.help_text]
|
||||
|
||||
|
||||
func _hide_note() -> void:
|
||||
if not visible or is_hiding:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user