Compact camp conversation rows
This commit is contained in:
@@ -10008,48 +10008,60 @@ func _rebuild_talk_menu() -> void:
|
||||
|
||||
|
||||
func _add_camp_conversation_row(conversation: Dictionary) -> void:
|
||||
var tooltip_text := _format_camp_conversation_tooltip_text(conversation)
|
||||
var row := HBoxContainer.new()
|
||||
row.custom_minimum_size = Vector2(580, 64)
|
||||
row.custom_minimum_size = Vector2(580, 62)
|
||||
row.add_theme_constant_override("separation", 8)
|
||||
row.tooltip_text = tooltip_text
|
||||
talk_list.add_child(row)
|
||||
|
||||
row.add_child(_make_camp_conversation_portrait(conversation))
|
||||
row.add_child(_make_camp_conversation_portrait(conversation, tooltip_text))
|
||||
|
||||
var column := VBoxContainer.new()
|
||||
column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
column.add_theme_constant_override("separation", 3)
|
||||
column.add_theme_constant_override("separation", 4)
|
||||
column.tooltip_text = tooltip_text
|
||||
row.add_child(column)
|
||||
|
||||
var conversation_id := str(conversation.get("id", ""))
|
||||
var button := Button.new()
|
||||
button.text = _format_camp_conversation_row_title(conversation)
|
||||
button.custom_minimum_size = Vector2(500, 32)
|
||||
button.custom_minimum_size = Vector2(500, 30)
|
||||
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
button.tooltip_text = tooltip_text
|
||||
_apply_button_style(button)
|
||||
button.pressed.connect(_on_camp_conversation_pressed.bind(conversation_id))
|
||||
column.add_child(button)
|
||||
|
||||
var preview_label := Label.new()
|
||||
preview_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
preview_label.custom_minimum_size = Vector2(500, 24)
|
||||
preview_label.text = _format_camp_conversation_preview_text(conversation)
|
||||
_apply_label_style(preview_label, UI_AGED_INK)
|
||||
column.add_child(preview_label)
|
||||
var badge_row := HBoxContainer.new()
|
||||
badge_row.custom_minimum_size = Vector2(500, 22)
|
||||
badge_row.add_theme_constant_override("separation", 5)
|
||||
badge_row.tooltip_text = tooltip_text
|
||||
column.add_child(badge_row)
|
||||
|
||||
for badge_text in _format_camp_conversation_visible_badges(conversation):
|
||||
var text := str(badge_text).strip_edges()
|
||||
if text.is_empty():
|
||||
continue
|
||||
badge_row.add_child(_make_armory_info_badge(text, tooltip_text))
|
||||
|
||||
|
||||
func _make_camp_conversation_portrait(conversation: Dictionary) -> PanelContainer:
|
||||
func _make_camp_conversation_portrait(conversation: Dictionary, tooltip_text: String = "") -> PanelContainer:
|
||||
var portrait_panel := PanelContainer.new()
|
||||
portrait_panel.custom_minimum_size = CAMP_TALK_PORTRAIT_SIZE
|
||||
portrait_panel.tooltip_text = tooltip_text
|
||||
_apply_panel_style(portrait_panel, "portrait")
|
||||
|
||||
var stack := Control.new()
|
||||
stack.custom_minimum_size = CAMP_TALK_PORTRAIT_SIZE
|
||||
stack.tooltip_text = tooltip_text
|
||||
portrait_panel.add_child(stack)
|
||||
|
||||
var texture_rect := TextureRect.new()
|
||||
texture_rect.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||
texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
texture_rect.tooltip_text = tooltip_text
|
||||
stack.add_child(texture_rect)
|
||||
|
||||
var initials_label := Label.new()
|
||||
@@ -10057,6 +10069,7 @@ func _make_camp_conversation_portrait(conversation: Dictionary) -> PanelContaine
|
||||
initials_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
initials_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
initials_label.add_theme_font_size_override("font_size", 18)
|
||||
initials_label.tooltip_text = tooltip_text
|
||||
_apply_label_style(initials_label, UI_PARCHMENT_TEXT)
|
||||
stack.add_child(initials_label)
|
||||
|
||||
@@ -10143,16 +10156,37 @@ func _format_camp_conversation_button_text(conversation: Dictionary) -> String:
|
||||
func _format_camp_conversation_row_title(conversation: Dictionary) -> String:
|
||||
var label := str(conversation.get("label", "군막 담화"))
|
||||
var speaker := _camp_conversation_preview_speaker(conversation)
|
||||
var group := _camp_conversation_group_text(str(conversation.get("group", "topic")))
|
||||
var parts := [group, label]
|
||||
var parts := [label]
|
||||
if not speaker.is_empty():
|
||||
parts.append(speaker)
|
||||
var effects_text := _format_camp_conversation_effects_text(conversation)
|
||||
if not effects_text.is_empty():
|
||||
parts.append(effects_text)
|
||||
return _join_strings(parts, " · ")
|
||||
|
||||
|
||||
func _format_camp_conversation_visible_badges(conversation: Dictionary) -> Array:
|
||||
var badges := [
|
||||
_camp_conversation_group_text(str(conversation.get("group", "topic")))
|
||||
]
|
||||
var speaker := _camp_conversation_preview_speaker(conversation)
|
||||
if not speaker.is_empty():
|
||||
badges.append(speaker)
|
||||
if _camp_conversation_has_grant_item_effect(conversation):
|
||||
badges.append(_format_camp_conversation_supply_state_text(conversation))
|
||||
else:
|
||||
badges.append("대화")
|
||||
return badges
|
||||
|
||||
|
||||
func _format_camp_conversation_tooltip_text(conversation: Dictionary) -> String:
|
||||
var lines := [
|
||||
_format_camp_conversation_button_text(conversation)
|
||||
]
|
||||
var preview := _format_camp_conversation_preview_text(conversation)
|
||||
if not preview.is_empty():
|
||||
lines.append(preview)
|
||||
lines.append("클릭하면 군막 대화를 엽니다.")
|
||||
return _join_strings(lines, "\n")
|
||||
|
||||
|
||||
func _format_camp_conversation_preview_text(conversation: Dictionary) -> String:
|
||||
var parts := []
|
||||
var summary := str(conversation.get("summary", "")).strip_edges()
|
||||
@@ -10218,6 +10252,20 @@ func _camp_conversation_preview_portrait_path(conversation: Dictionary) -> Strin
|
||||
return ""
|
||||
|
||||
|
||||
func _camp_conversation_has_grant_item_effect(conversation: Dictionary) -> bool:
|
||||
for effect in conversation.get("effects", []):
|
||||
if typeof(effect) == TYPE_DICTIONARY and str(effect.get("type", "")) == "grant_item":
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _format_camp_conversation_supply_state_text(conversation: Dictionary) -> String:
|
||||
var conversation_id := str(conversation.get("id", ""))
|
||||
if campaign_state.has_claimed_camp_conversation_effects(active_scenario_id, conversation_id):
|
||||
return "보급 완료"
|
||||
return "보급 대기"
|
||||
|
||||
|
||||
func _short_preview_text(text: String, max_length: int) -> String:
|
||||
var normalized := text.strip_edges()
|
||||
if max_length <= 3 or normalized.length() <= max_length:
|
||||
|
||||
Reference in New Issue
Block a user