fix: simplify market and readiness composition
This commit is contained in:
@@ -436,11 +436,11 @@ func _market_hit_button(node_name: String, area: Rect2, intent_id: String, paylo
|
||||
button.disabled = disabled
|
||||
button.tooltip_text = tooltip
|
||||
button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN if disabled else Control.CURSOR_POINTING_HAND
|
||||
for style_name in ["normal", "disabled"]:
|
||||
button.add_theme_stylebox_override(style_name, StyleBoxEmpty.new())
|
||||
button.add_theme_stylebox_override("hover", _flat_style(Color(0.95, 0.82, 0.35, 0.10), Color("#d6ad5d"), 2, 6))
|
||||
button.add_theme_stylebox_override("pressed", _flat_style(Color(0.28, 0.53, 0.38, 0.18), Color("#f3d991"), 2, 6))
|
||||
button.add_theme_stylebox_override("focus", _flat_style(Color(0.22, 0.45, 0.57, 0.14), Color("#7fc5d7"), 2, 6))
|
||||
button.add_theme_stylebox_override("normal", Tokens.hit_area_style("normal"))
|
||||
button.add_theme_stylebox_override("disabled", Tokens.hit_area_style("normal"))
|
||||
button.add_theme_stylebox_override("hover", Tokens.hit_area_style("hover"))
|
||||
button.add_theme_stylebox_override("pressed", Tokens.hit_area_style("pressed"))
|
||||
button.add_theme_stylebox_override("focus", Tokens.hit_area_style("focus"))
|
||||
_market_place(button, area)
|
||||
button.pressed.connect(func(): emit_intent(intent_id, payload), CONNECT_DEFERRED)
|
||||
return button
|
||||
@@ -505,18 +505,8 @@ func _market_mode_button(overlay: Control, category: String, area: Rect2, count:
|
||||
button.custom_minimum_size = Vector2(0, 44)
|
||||
button.set_meta("selected", selected)
|
||||
UIFactory.apply_flat_command(button, "primary" if selected else "secondary", icon_kind, false, selected, "content")
|
||||
var plate := Panel.new()
|
||||
plate.name = "ModePlate"
|
||||
plate.show_behind_parent = true
|
||||
plate.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
plate.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
var style := StyleBoxFlat.new()
|
||||
style.bg_color = Color("#4d5960", 0.88) if selected else Color("#26343a", 0.88)
|
||||
style.border_color = Color("#d6ad5d", 0.94) if selected else Color("#7b7f75", 0.62)
|
||||
style.set_border_width_all(2 if selected else 1)
|
||||
style.set_corner_radius_all(5)
|
||||
plate.add_theme_stylebox_override("panel", style)
|
||||
button.add_child(plate)
|
||||
# UIFactory supplies the single visible command plate. A nested ModePlate
|
||||
# duplicated the border and made the category stack feel like layered cards.
|
||||
_market_badge(button, "ModeGlyph", Rect2(0.06, 0.20, 0.18, 0.60), "", Color("#8d6233") if selected else Color("#46545a"), title, icon_kind)
|
||||
var label := _market_label(button, "ModeLabel", Rect2(0.28, 0.12, 0.68, 0.76), title, 7, Color("#fff2cf") if selected else Color("#d6d5ca"), HORIZONTAL_ALIGNMENT_CENTER)
|
||||
label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||
|
||||
@@ -149,9 +149,9 @@ func _build_overlay(data: Dictionary) -> void:
|
||||
summary_band.name = "ReadinessSummaryBand"
|
||||
_readiness_place(summary_band, Rect2(0.04, 0.645, 0.73, 0.19))
|
||||
var summary_style := StyleBoxFlat.new()
|
||||
summary_style.bg_color = Color("#f2e4c5", 0.90)
|
||||
summary_style.border_color = Color("#a27e3c", 0.86)
|
||||
summary_style.set_border_width_all(2)
|
||||
summary_style.bg_color = Color("#f2e4c5", 0.74)
|
||||
summary_style.border_color = Color("#a27e3c", 0.62)
|
||||
summary_style.set_border_width_all(1)
|
||||
summary_style.set_corner_radius_all(7)
|
||||
summary_band.add_theme_stylebox_override("panel", summary_style)
|
||||
summary_band.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
@@ -281,8 +281,11 @@ func _readiness_action_button(node_name: String, area: Rect2, intent_id: String,
|
||||
button.set_meta("ui_factory_control", true)
|
||||
button.set_meta("ui_semantic_variant", "icon")
|
||||
button.set_meta("ui_icon_kind", "settings")
|
||||
for style_name in ["normal", "hover", "pressed", "disabled", "focus", "hover_pressed"]:
|
||||
button.add_theme_stylebox_override(style_name, StyleBoxEmpty.new())
|
||||
button.add_theme_stylebox_override("normal", Tokens.surface_style("overlay"))
|
||||
button.add_theme_stylebox_override("hover", Tokens.flat_command_style("utility", "hover"))
|
||||
button.add_theme_stylebox_override("pressed", Tokens.flat_command_style("utility", "pressed"))
|
||||
button.add_theme_stylebox_override("focus", Tokens.flat_command_style("utility", "focus"))
|
||||
button.add_theme_stylebox_override("disabled", Tokens.surface_style("overlay"))
|
||||
_readiness_place(button, area)
|
||||
UIFactory.attach_icon(button, "settings", "CommandIcon", "light", Rect2(0.22, 0.12, 0.56, 0.76))
|
||||
button.pressed.connect(func(): emit_intent(intent_id, payload), CONNECT_DEFERRED)
|
||||
@@ -317,8 +320,11 @@ func _readiness_warning_button(warning_rows: Array, data: Dictionary) -> Button:
|
||||
button.focus_mode = Control.FOCUS_ALL
|
||||
button.tooltip_text = localize("查看允许的警告与归属", "Review allowed warnings and ownership", data)
|
||||
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
for style_name in ["normal", "hover", "pressed", "disabled", "focus", "hover_pressed"]:
|
||||
button.add_theme_stylebox_override(style_name, StyleBoxEmpty.new())
|
||||
button.add_theme_stylebox_override("normal", Tokens.surface_style("overlay"))
|
||||
button.add_theme_stylebox_override("hover", Tokens.flat_command_style("utility", "hover"))
|
||||
button.add_theme_stylebox_override("pressed", Tokens.flat_command_style("utility", "pressed"))
|
||||
button.add_theme_stylebox_override("focus", Tokens.flat_command_style("utility", "focus"))
|
||||
button.add_theme_stylebox_override("disabled", Tokens.surface_style("overlay"))
|
||||
button.pressed.connect(func(): emit_intent("review_warnings"), CONNECT_DEFERRED)
|
||||
var lines: Array[String] = []
|
||||
for row in warning_rows:
|
||||
|
||||
@@ -200,6 +200,15 @@ static func flat_command_style(variant: String, state := "normal", selected := f
|
||||
return style
|
||||
|
||||
|
||||
static func hit_area_style(state := "normal") -> StyleBoxFlat:
|
||||
var style := StyleBoxFlat.new()
|
||||
style.bg_color = Color(COLOR_NAVY, 0.10) if state == "normal" else Color(COLOR_GOLD, 0.14) if state == "hover" else Color(COLOR_SKY, 0.16)
|
||||
style.border_color = Color(COLOR_GOLD_LIGHT, 0.28) if state == "normal" else COLOR_GOLD_LIGHT
|
||||
style.set_border_width_all(border_width("hairline"))
|
||||
style.set_corner_radius_all(corner_radius("control"))
|
||||
return style
|
||||
|
||||
|
||||
static func notice_style(severity := "info") -> StyleBoxFlat:
|
||||
var background := Color(COLOR_NAVY, 0.86)
|
||||
var border := COLOR_GOLD
|
||||
|
||||
Reference in New Issue
Block a user