feat(m55): extract result action dock
This commit is contained in:
@@ -3,6 +3,7 @@ extends "res://presentation/page_view.gd"
|
||||
|
||||
const M55_RESULT_HEADER = preload("res://ui/m55/result_header.gd")
|
||||
const M55_RESULT_OUTCOME = preload("res://ui/m55/result_outcome_summary.gd")
|
||||
const M55_RESULT_ACTION_DOCK = preload("res://ui/m55/result_action_dock.gd")
|
||||
|
||||
|
||||
## UI-only OUT-001 Battle Result View.
|
||||
@@ -99,24 +100,14 @@ func _render_view(data: Dictionary) -> void:
|
||||
detail.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
context.add_child(detail)
|
||||
|
||||
var footer := HBoxContainer.new()
|
||||
var footer := M55_RESULT_ACTION_DOCK.new().configure(
|
||||
localize("因果详情", "Cause Details", data), localize("继续", "Continue", data),
|
||||
bool(commands.get("diagnosis_enabled", true)), bool(commands.get("continue_enabled", false)), 48.0 if short_result else 52.0
|
||||
)
|
||||
footer.name = "BattleResultFooter"
|
||||
footer.custom_minimum_size = Vector2(0, 48 if short_result else 52)
|
||||
footer.add_theme_constant_override("separation", 8)
|
||||
layout.add_child(footer)
|
||||
var inspect := make_company_button("BattleResultDiagnosis", localize("因果详情", "Cause Details", data), "diagnosis", "company_secondary", "inspect")
|
||||
inspect.custom_minimum_size = Vector2(230, footer.custom_minimum_size.y)
|
||||
set_command_state(inspect, not bool(commands.get("diagnosis_enabled", true)))
|
||||
footer.add_child(inspect)
|
||||
var spacer := Control.new()
|
||||
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
footer.add_child(spacer)
|
||||
var continue_button := make_company_button("BattleResultContinue", localize("继续", "Continue", data), "continue", "company_primary", "confirm")
|
||||
continue_button.custom_minimum_size = Vector2(220, footer.custom_minimum_size.y)
|
||||
continue_button.tooltip_text = localize("先查看因果链,再进入下一阶段恢复", "Review the causal chain before next-stage recovery", data)
|
||||
set_command_state(continue_button, not bool(commands.get("continue_enabled", false)))
|
||||
footer.add_child(continue_button)
|
||||
inspect.call_deferred("grab_focus")
|
||||
footer.action_pressed.connect(func(intent_id: String): emit_intent(intent_id))
|
||||
footer.get_node("BattleResultDiagnosis").call_deferred("grab_focus")
|
||||
|
||||
|
||||
func _render_invalid(parent: Control, notice_text: String, data: Dictionary) -> void:
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
class_name ABGM55ResultActionDock
|
||||
extends HBoxContainer
|
||||
|
||||
signal action_pressed(intent_id: String)
|
||||
|
||||
func configure(inspect_text: String, continue_text: String, inspect_enabled: bool, continue_enabled: bool, height: float) -> ABGM55ResultActionDock:
|
||||
custom_minimum_size = Vector2(0, height)
|
||||
add_theme_constant_override("separation", 8)
|
||||
var inspect := _button("BattleResultDiagnosis", inspect_text, "diagnosis", "company_secondary", "inspect", inspect_enabled, height)
|
||||
add_child(inspect)
|
||||
var spacer := Control.new()
|
||||
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
add_child(spacer)
|
||||
var continue_button := _button("BattleResultContinue", continue_text, "continue", "company_primary", "confirm", continue_enabled, height)
|
||||
add_child(continue_button)
|
||||
return self
|
||||
|
||||
func _button(node_name: String, text_value: String, intent_id: String, variant: String, icon: String, enabled: bool, height: float) -> Button:
|
||||
var button := preload("res://ui/shared/ui_factory.gd").command_button(node_name, text_value, variant, icon, "angular", "company", Vector2(220, height), false)
|
||||
button.disabled = not enabled
|
||||
button.pressed.connect(func(): action_pressed.emit(intent_id), CONNECT_DEFERRED)
|
||||
return button
|
||||
Reference in New Issue
Block a user