feat(m110): align battle HUD labels to v002 and resolve relation ids
This commit is contained in:
+162
-55
@@ -4459,18 +4459,20 @@ func _build_battle_live_field(parent: Control, company: Dictionary, battle: Dict
|
||||
var view_feedback: Dictionary = Dictionary(view_data.get("feedback", {}))
|
||||
var view_state: Dictionary = Dictionary(view_data.get("state", {}))
|
||||
var live_state := String(view_state.get("name", battle_live_state))
|
||||
var objective_title := _battle_live_overlay_label(parent, "BattleLiveTitle", _tr("风镜初渡 · 自动", "WINDGLASS · AUTO"), Rect2(0.026, 0.148, 0.205, 0.020), 6, Color("#e8d39d"))
|
||||
# M110 v002: fixed slots (encounter_identity / objective_label / encounter_rule)
|
||||
# and the corrected recent_event_sequence above the bottom Company rail.
|
||||
var objective_title := _battle_live_overlay_label(parent, "BattleLiveTitle", _tr("风镜初渡 · 自动", "WINDGLASS · AUTO"), Rect2(0.025, 0.145, 0.31, 0.030), 7, Color("#e8d39d"))
|
||||
objective_title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
var objective := _battle_live_overlay_label(parent, "BattleLiveObjective", _tr("目标 · 击破敌方队列", "BREAK THE ENEMY LINE"), Rect2(0.026, 0.170, 0.220, 0.028), 9, Color("#f5ead0"))
|
||||
var objective := _battle_live_overlay_label(parent, "BattleLiveObjective", _tr("目标 · 击破敌方队列", "BREAK THE ENEMY LINE"), Rect2(0.025, 0.180, 0.31, 0.035), 9, Color("#f5ead0"))
|
||||
objective.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
var no_respawn := _battle_live_overlay_label(parent, "BattleLiveNoRespawn", _tr("无复活", "NO RESPAWN"), Rect2(0.026, 0.204, 0.090, 0.020), 5, Color("#f0c979"))
|
||||
var no_respawn := _battle_live_overlay_label(parent, "BattleLiveNoRespawn", _tr("无复活", "NO RESPAWN"), Rect2(0.025, 0.220, 0.14875, 0.035), 7, Color("#f0c979"))
|
||||
no_respawn.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
var no_reserve := _battle_live_overlay_label(parent, "BattleLiveNoReserve", _tr("无后备", "NO RESERVE"), Rect2(0.119, 0.204, 0.105, 0.020), 5, Color("#f0c979"))
|
||||
var no_reserve := _battle_live_overlay_label(parent, "BattleLiveNoReserve", _tr("无后备", "NO RESERVE"), Rect2(0.18625, 0.220, 0.14875, 0.035), 7, Color("#f0c979"))
|
||||
no_reserve.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
|
||||
var has_event := not view_event.is_empty() and live_state != "waiting_for_next_event"
|
||||
var opening_event := String(view_event.get("kind", "")) == "opening"
|
||||
var event_state := _battle_live_overlay_label(parent, "BattleLiveEventState", _battle_live_state_copy(), Rect2(0.555, 0.315, 0.17, 0.022), 6, Color("#e8d39d"))
|
||||
var event_state := _battle_live_overlay_label(parent, "BattleLiveEventState", _battle_live_state_copy(), Rect2(0.370, 0.140, 0.26, 0.040), 7, Color("#e8d39d"))
|
||||
event_state.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
event_state.visible = not opening_event and (has_event or live_state in ["paused", "inspect_handoff", "pause_controls_handoff", "outcome_locked", "invalid_event_data", "snapshot_retrying", "loading_resume", "interrupted_background", "no_resumable_battle"])
|
||||
if live_state == "outcome_locked":
|
||||
@@ -4492,12 +4494,17 @@ func _build_battle_live_field(parent: Control, company: Dictionary, battle: Dict
|
||||
var caption_kind := String(view_event.get("kind", ""))
|
||||
if not captions_on or (captions_critical_only and not caption_kind in ["damage", "knockout", "result", "telegraph"]):
|
||||
captions_on = false
|
||||
var detail_text := _battle_live_event_detail(company, battle) if captions_on else ""
|
||||
var event_detail := _battle_live_overlay_label(parent, "BattleLiveEventDetail", detail_text, _battle_live_relation_rect(battle), 6, Color("#f6e3b0"))
|
||||
var detail_text := _battle_live_relation_copy(view_battle, view_event) if captions_on else ""
|
||||
var detail_placement := _battle_live_relation_placement(view_battle, view_event, detail_text)
|
||||
var event_detail := _battle_live_overlay_label(parent, "BattleLiveEventDetail", detail_text, detail_placement.rect, 7, Color("#f6e3b0"))
|
||||
event_detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
event_detail.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
event_detail.visible = not detail_text.is_empty() and String(view_event.get("kind", "")) != "opening" and live_state not in ["outcome_locked", "invalid_event_data", "snapshot_retrying", "loading_resume", "interrupted_background"]
|
||||
var event_id := _battle_live_overlay_label(parent, "BattleLiveEventId", _battle_live_event_identity(), _battle_live_event_id_rect(battle), 6, Color("#d9c88f"))
|
||||
event_detail.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART if bool(detail_placement.get("wrapped", false)) else TextServer.AUTOWRAP_OFF
|
||||
event_detail.visible = bool(detail_placement.get("visible", false))
|
||||
event_detail.set_meta("relation_placement_id", String(detail_placement.get("placement_id", "")))
|
||||
event_detail.set_meta("relation_clearance_px", float(detail_placement.get("clearance_px", -1.0)))
|
||||
event_detail.set_meta("relation_lines", int(detail_placement.get("lines", 0)))
|
||||
event_detail.set_meta("relation_token_px", int(detail_placement.get("token_px", 0)))
|
||||
var event_id := _battle_live_overlay_label(parent, "BattleLiveEventId", _battle_live_event_identity(), _battle_live_event_id_rect(battle), 7, Color("#d9c88f"))
|
||||
event_id.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
event_id.visible = not opening_event and live_state in ["event_forecast", "action_committed", "event_resolving"]
|
||||
event_id.tooltip_text = _battle_live_event_identity()
|
||||
@@ -4507,7 +4514,7 @@ func _build_battle_live_field(parent: Control, company: Dictionary, battle: Dict
|
||||
delta.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
delta.visible = not delta_text.is_empty() and live_state == "event_resolved"
|
||||
if live_state == "outcome_locked":
|
||||
var outcome_label := _battle_live_overlay_label(parent, "BattleLiveOutcomeLabel", "OUT-001", Rect2(0.690, 0.318, 0.105, 0.026), 6, Color("#f6dfaa"))
|
||||
var outcome_label := _battle_live_overlay_label(parent, "BattleLiveOutcomeLabel", "OUT-001", Rect2(0.690, 0.318, 0.105, 0.026), 7, Color("#f6dfaa"))
|
||||
outcome_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
_build_battle_live_diagnostic_actions(parent)
|
||||
|
||||
@@ -4545,7 +4552,7 @@ func _build_battle_live_field(parent: Control, company: Dictionary, battle: Dict
|
||||
enemies.add_child(enemy_actor)
|
||||
var feedback_copy := String(view_feedback.get("text", ""))
|
||||
var recent_copy := feedback_copy if not feedback_copy.is_empty() else _battle_live_recent_copy(view_battle)
|
||||
var recent := _battle_live_overlay_label(parent, "BattleLiveRecentEvents", recent_copy, Rect2(0.31, 0.765, 0.38, 0.022), 6, Color("#edf0dd"))
|
||||
var recent := _battle_live_overlay_label(parent, "BattleLiveRecentEvents", recent_copy, Rect2(0.170, 0.760, 0.550, 0.040), 7, Color("#edf0dd"))
|
||||
recent.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
recent.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||
recent.tooltip_text = feedback_copy
|
||||
@@ -4742,7 +4749,7 @@ func _build_battle_live_bottom(parent: Control, company: Dictionary, battle: Dic
|
||||
next_label.anchor_top = 0.68
|
||||
next_label.anchor_right = 0.98
|
||||
next_label.anchor_bottom = 0.94
|
||||
next_label.add_theme_font_size_override("font_size", _battle_live_text_size(6))
|
||||
next_label.add_theme_font_size_override("font_size", _battle_live_text_size(7))
|
||||
|
||||
|
||||
func _battle_live_enemy(index: int, enemy_id: String, rect: Rect2) -> Control:
|
||||
@@ -4888,7 +4895,7 @@ func _battle_live_state_cell(position: int, recruit: Dictionary, battle: Diction
|
||||
role.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
cell.add_child(role)
|
||||
var fallen := String(recruit.get("recruit_id", "")) in Array(battle.get("knocked_out_ids", []))
|
||||
var state := _label(_tr("离场", "FALLEN") if fallen else _tr("就绪", "READY"), _battle_live_text_size(5), Color("#e98b83") if fallen else Color("#8fd2a2"))
|
||||
var state := _label(_tr("离场", "FALLEN") if fallen else _tr("就绪", "READY"), _battle_live_text_size(7), Color("#e98b83") if fallen else Color("#8fd2a2"))
|
||||
state.name = "BattleLiveStateStatus"
|
||||
state.anchor_left = 0.50
|
||||
state.anchor_top = 0.025
|
||||
@@ -4992,15 +4999,18 @@ func _battle_live_marker_anchors(battle: Dictionary, allies: bool) -> Array[Vect
|
||||
|
||||
|
||||
func _battle_live_actor_anchor(actor_id: String, battle: Dictionary, source_fallback: bool) -> Vector2:
|
||||
# M110: bridge-projected events carry ally-/enemy- prefixes; resolve them with
|
||||
# the same normalization as battle_live_page_controller.gd:157.
|
||||
var resolved_id := _battle_live_strip_runtime_prefix(actor_id)
|
||||
var ally_ids: Array = battle.get("front_to_rear_ids", [])
|
||||
var ally_source_index := ally_ids.find(actor_id)
|
||||
var ally_source_index := ally_ids.find(resolved_id)
|
||||
if ally_source_index >= 0:
|
||||
var ally_visual_index := ally_ids.size() - 1 - ally_source_index
|
||||
var ally_slots := _battle_live_ally_slots()
|
||||
var ally_slot: Rect2 = ally_slots[mini(ally_visual_index, ally_slots.size() - 1)]
|
||||
return ally_slot.position + Vector2(ally_slot.size.x * 0.50, ally_slot.size.y * 0.58)
|
||||
var enemy_ids: Array = battle.get("enemy_ids", [])
|
||||
var enemy_index := enemy_ids.find(actor_id)
|
||||
var enemy_index := enemy_ids.find(resolved_id)
|
||||
if enemy_index >= 0:
|
||||
var enemy_slots := _battle_live_enemy_slots()
|
||||
var enemy_slot: Rect2 = enemy_slots[mini(enemy_index, enemy_slots.size() - 1)]
|
||||
@@ -5008,11 +5018,113 @@ func _battle_live_actor_anchor(actor_id: String, battle: Dictionary, source_fall
|
||||
return Vector2(0.47, 0.56) if source_fallback else Vector2(0.67, 0.56)
|
||||
|
||||
|
||||
func _battle_live_relation_rect(battle: Dictionary) -> Rect2:
|
||||
var source := _battle_live_actor_anchor(String(battle_live_event.get("actor_id", "")), battle, true)
|
||||
var target := _battle_live_actor_anchor(String(battle_live_event.get("target_id", "")), battle, false)
|
||||
var center := (source + target) * 0.5
|
||||
return Rect2(clampf(center.x - 0.105, 0.34, 0.66), clampf(center.y - 0.105, 0.40, 0.58), 0.21, 0.030)
|
||||
func _battle_live_strip_runtime_prefix(value: String) -> String:
|
||||
if value.begins_with("ally-") or value.begins_with("enemy-"):
|
||||
return value.substr(value.find("-") + 1)
|
||||
return value
|
||||
|
||||
|
||||
# M110 v002: engine-owned dynamic placement for the source-to-target relation copy.
|
||||
# Bounds and rules come from approved/v002/text-slots.json
|
||||
# (source_target_relation.dynamic_policy); px are design px at 1280x720.
|
||||
const RELATION_CORRIDOR := Rect2(0.440, 0.280, 0.220, 0.420)
|
||||
const RELATION_CLEAR_ZONE := Rect2(0.510625, 0.498056, 0.09375, 0.161667)
|
||||
const RELATION_MIN_CLEARANCE_PX := 4.0
|
||||
const RELATION_AVOID_RECTS_PX := [
|
||||
Rect2(549.3, 348.1, 104.3, 137.5), # front-most ally silhouette envelope
|
||||
Rect2(773.6, 358.6, 129.6, 116.4), # left enemy silhouette envelope
|
||||
Rect2(0.0, 0.0, 1280.0, 104.0), # top faction rails
|
||||
Rect2(499.2, 0.0, 281.6, 74.2), # playback ribbon
|
||||
Rect2(38.4, 180.0, 1203.2, 28.8), # floating_value_band
|
||||
Rect2(819.2, 190.8, 204.8, 28.8), # urgent_event_marker
|
||||
Rect2(473.6, 100.8, 332.8, 28.8), # current_event_state
|
||||
Rect2(473.6, 133.2, 332.8, 25.2), # current_event_id_tick
|
||||
Rect2(473.6, 252.0, 332.8, 28.8), # event_value_delta
|
||||
Rect2(217.6, 547.2, 704.0, 28.8), # recent_event_sequence (v002)
|
||||
Rect2(0.0, 576.0, 1280.0, 144.0), # bottom Company rail
|
||||
]
|
||||
|
||||
|
||||
func _battle_live_relation_placement(view_battle: Dictionary, view_event: Dictionary, text: String) -> Dictionary:
|
||||
if text.is_empty():
|
||||
return {"visible": false, "placement_id": "", "rect": Rect2(), "clearance_px": -1.0, "lines": 0, "token_px": 0, "wrapped": false}
|
||||
var design := Vector2(1280.0, 720.0)
|
||||
var font_size := _battle_live_text_size(7)
|
||||
var source_anchor := _battle_live_actor_anchor(String(view_event.get("actor_id", "")), view_battle, true)
|
||||
var target_anchor := _battle_live_actor_anchor(String(view_event.get("target_id", "")), view_battle, false)
|
||||
var single_ink := UI_FONT.get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size)
|
||||
var plans := _battle_live_relation_plans((source_anchor + target_anchor) * 0.5, single_ink, 1, false, design, 0.0)
|
||||
var placement := _battle_live_first_relation_plan(plans, design, font_size)
|
||||
if not placement.is_empty():
|
||||
return placement
|
||||
var text_scale := float(setup_draft.get("text_scale", settings.get("text_scale", 1.0)))
|
||||
if text_scale > 1.15:
|
||||
var wrap_px := RELATION_CORRIDOR.size.x * design.x
|
||||
var wrapped := UI_FONT.get_multiline_string_size(text, HORIZONTAL_ALIGNMENT_CENTER, wrap_px, font_size)
|
||||
var line_height := maxf(1.0, float(UI_FONT.get_height(font_size)))
|
||||
var lines := clampi(int(round(wrapped.y / line_height)), 1, 2)
|
||||
if lines > 1 and wrapped.x <= wrap_px:
|
||||
var wrapped_plans := _battle_live_relation_plans((source_anchor + target_anchor) * 0.5, wrapped, lines, true, design, wrap_px)
|
||||
placement = _battle_live_first_relation_plan(wrapped_plans, design, font_size)
|
||||
if not placement.is_empty():
|
||||
return placement
|
||||
return {"visible": false, "placement_id": "omitted_crowded", "rect": Rect2(), "clearance_px": -1.0, "lines": 0, "token_px": font_size, "wrapped": false}
|
||||
|
||||
|
||||
func _battle_live_relation_plans(midpoint: Vector2, ink: Vector2, lines: int, wrap: bool, design: Vector2, wrap_px: float) -> Array:
|
||||
var zone_center := RELATION_CLEAR_ZONE.get_center()
|
||||
var upper := Vector2(zone_center.x, RELATION_CLEAR_ZONE.position.y + (RELATION_MIN_CLEARANCE_PX + ink.y * 0.5) / design.y)
|
||||
var lower := Vector2(zone_center.x, RELATION_CLEAR_ZONE.end.y - (RELATION_MIN_CLEARANCE_PX + ink.y * 0.5) / design.y)
|
||||
return [
|
||||
{"id": "path_midpoint", "center": midpoint, "ink": ink, "lines": lines, "wrap": wrap, "wrap_px": wrap_px},
|
||||
{"id": "gap_center", "center": zone_center, "ink": ink, "lines": lines, "wrap": wrap, "wrap_px": wrap_px},
|
||||
{"id": "gap_upper", "center": upper, "ink": ink, "lines": lines, "wrap": wrap, "wrap_px": wrap_px},
|
||||
{"id": "gap_lower", "center": lower, "ink": ink, "lines": lines, "wrap": wrap, "wrap_px": wrap_px},
|
||||
]
|
||||
|
||||
|
||||
func _battle_live_first_relation_plan(plans: Array, design: Vector2, font_size: int) -> Dictionary:
|
||||
for plan_value in plans:
|
||||
var plan: Dictionary = plan_value
|
||||
var ink: Vector2 = plan.ink
|
||||
var rect_size := ink / 0.94
|
||||
var rect := Rect2((Vector2(plan.center) * design) - rect_size * 0.5, rect_size)
|
||||
var ink_rect := Rect2(rect.position + (rect.size - ink) * 0.5, ink)
|
||||
var corridor := Rect2(RELATION_CORRIDOR.position * design, RELATION_CORRIDOR.size * design)
|
||||
var inside_corridor := (
|
||||
ink_rect.position.x >= corridor.position.x - 0.01
|
||||
and ink_rect.position.y >= corridor.position.y - 0.01
|
||||
and ink_rect.end.x <= corridor.end.x + 0.01
|
||||
and ink_rect.end.y <= corridor.end.y + 0.01
|
||||
)
|
||||
if not inside_corridor:
|
||||
continue
|
||||
var clearance := _battle_live_relation_clearance_px(ink_rect)
|
||||
if clearance < RELATION_MIN_CLEARANCE_PX:
|
||||
continue
|
||||
return {
|
||||
"visible": true,
|
||||
"placement_id": String(plan.id),
|
||||
"rect": Rect2(rect.position / design, rect.size / design),
|
||||
"ink_px": ink,
|
||||
"clearance_px": clearance,
|
||||
"lines": int(plan.lines),
|
||||
"token_px": font_size,
|
||||
"wrapped": bool(plan.wrap),
|
||||
"wrap_px": float(plan.wrap_px),
|
||||
}
|
||||
return {}
|
||||
|
||||
|
||||
func _battle_live_relation_clearance_px(ink_rect: Rect2) -> float:
|
||||
var worst := 1.0e9
|
||||
for avoid_value in RELATION_AVOID_RECTS_PX:
|
||||
var avoid: Rect2 = avoid_value
|
||||
var dx := maxf(avoid.position.x - ink_rect.end.x, ink_rect.position.x - avoid.end.x)
|
||||
var dy := maxf(avoid.position.y - ink_rect.end.y, ink_rect.position.y - avoid.end.y)
|
||||
var distance := maxf(dx, dy) if (dx <= 0.0 and dy <= 0.0) else Vector2(maxf(dx, 0.0), maxf(dy, 0.0)).length()
|
||||
worst = minf(worst, distance)
|
||||
return worst
|
||||
|
||||
|
||||
func _battle_live_event_id_rect(battle: Dictionary) -> Rect2:
|
||||
@@ -5026,9 +5138,10 @@ func _battle_live_delta_rect(battle: Dictionary) -> Rect2:
|
||||
|
||||
|
||||
func _battle_live_actor_side(actor_id: String, battle: Dictionary) -> String:
|
||||
if actor_id in Array(battle.get("front_to_rear_ids", [])):
|
||||
var resolved_id := _battle_live_strip_runtime_prefix(actor_id)
|
||||
if resolved_id in Array(battle.get("front_to_rear_ids", [])):
|
||||
return "ally"
|
||||
if actor_id in Array(battle.get("enemy_ids", [])):
|
||||
if resolved_id in Array(battle.get("enemy_ids", [])):
|
||||
return "enemy"
|
||||
return ""
|
||||
|
||||
@@ -5083,49 +5196,43 @@ func _battle_live_event_short_copy() -> String:
|
||||
return _tr("事件", "EVENT")
|
||||
|
||||
|
||||
func _battle_live_event_detail(company: Dictionary, battle: Dictionary) -> String:
|
||||
if not battle_live_notice.is_empty():
|
||||
return battle_live_notice
|
||||
match battle_live_state:
|
||||
"waiting_for_next_event": return ""
|
||||
"paused": return _tr("速度 %dx · 事件 %d/9", "SPEED %dx · EVENT %d/9") % [int(battle_speed), int(battle_live_observation.get("next_phase_index", 0))]
|
||||
"inspect_handoff": return _tr("事件 %s · 快照 %s", "EVENT %s · SNAPSHOT %s") % [_short_hash(battle_live_event.get("event_id", "none")), _short_hash(battle.get("snapshot_hash", ""))]
|
||||
"pause_controls_handoff": return _tr("未创建撤退回执;时间线保持冻结", "No retreat receipt created; timeline remains frozen")
|
||||
"outcome_locked": return ""
|
||||
"invalid_event_data": return _battle_error_text(battle_live_error_code)
|
||||
"snapshot_retrying": return _tr("保持原快照、事件顺序与日志哈希", "Preserving the original snapshot, event order and journal hash")
|
||||
"loading_resume": return _tr("正在恢复最后安全事件边界", "Restoring the last safe event boundary")
|
||||
"interrupted_background": return _tr("最后提交事件 %d · 先前速度 %dx", "LAST COMMITTED %d · PRIOR SPEED %dx") % [int(battle_live_interruption.get("last_committed_tick", 0)), int(battle_live_interruption.get("prior_speed", 1.0))]
|
||||
"no_resumable_battle": return _battle_error_text(battle_live_error_code)
|
||||
if battle_live_event.is_empty():
|
||||
func _battle_live_relation_copy(view_battle: Dictionary, view_event: Dictionary) -> String:
|
||||
# M110 v002 dynamic policy: relation copy only; state notices stay in the
|
||||
# state-word slot and never enter the dynamic relation region.
|
||||
if view_event.is_empty() or String(view_event.get("kind", "")) == "opening":
|
||||
return ""
|
||||
var source_id := String(battle_live_event.get("actor_id", ""))
|
||||
var target_id := String(battle_live_event.get("target_id", ""))
|
||||
var source_id := String(view_event.get("actor_id", ""))
|
||||
var target_id := String(view_event.get("target_id", ""))
|
||||
if source_id.is_empty() and target_id.is_empty():
|
||||
return _tr("事件边界已验证", "Event boundary verified")
|
||||
var source := _battle_live_actor_short_name(battle, source_id, true)
|
||||
var target := _battle_live_actor_short_name(battle, target_id, false)
|
||||
var amount := int(battle_live_event.get("amount", 0))
|
||||
if source_id.is_empty():
|
||||
return _tr("目标 %s", "TARGET %s") % target
|
||||
if target_id.is_empty():
|
||||
return _tr("来源 %s", "SOURCE %s") % source
|
||||
var value_copy := ""
|
||||
if amount != 0:
|
||||
var direction := String(Dictionary(battle_live_event.get("state_delta", {})).get("direction", "none"))
|
||||
value_copy = " · %s%d" % ["-" if direction == "loss" else "+", amount]
|
||||
return _tr("%s → %s%s", "%s -> %s%s") % [source, target, value_copy]
|
||||
return ""
|
||||
var source_ok := not source_id.is_empty() and not _battle_live_actor_side(source_id, view_battle).is_empty()
|
||||
var target_ok := not target_id.is_empty() and not _battle_live_actor_side(target_id, view_battle).is_empty()
|
||||
if not source_ok and not target_ok:
|
||||
return ""
|
||||
if source_ok and target_ok:
|
||||
var source := _battle_live_actor_short_name(view_battle, source_id, true)
|
||||
var target := _battle_live_actor_short_name(view_battle, target_id, false)
|
||||
var value_copy := ""
|
||||
var amount := int(view_event.get("amount", 0))
|
||||
if amount != 0:
|
||||
var direction := String(Dictionary(view_event.get("state_delta", {})).get("direction", "none"))
|
||||
value_copy = " · %s%d" % ["-" if direction == "loss" else "+", amount]
|
||||
return _tr("%s → %s%s", "%s -> %s%s") % [source, target, value_copy]
|
||||
if source_ok:
|
||||
return _tr("来源 %s", "SOURCE %s") % _battle_live_actor_short_name(view_battle, source_id, true)
|
||||
return _tr("目标 %s", "TARGET %s") % _battle_live_actor_short_name(view_battle, target_id, false)
|
||||
|
||||
|
||||
func _battle_live_actor_short_name(battle: Dictionary, actor_id: String, source: bool) -> String:
|
||||
if actor_id.is_empty():
|
||||
return _tr("无", "NONE")
|
||||
var resolved_id := _battle_live_strip_runtime_prefix(actor_id)
|
||||
var ally_ids: Array = battle.get("front_to_rear_ids", [])
|
||||
var ally_index := ally_ids.find(actor_id)
|
||||
var ally_index := ally_ids.find(resolved_id)
|
||||
if ally_index >= 0:
|
||||
return _tr("%d号", "P%d") % ally_index
|
||||
var enemy_ids: Array = battle.get("enemy_ids", [])
|
||||
var enemy_index := enemy_ids.find(actor_id)
|
||||
var enemy_index := enemy_ids.find(resolved_id)
|
||||
if enemy_index >= 0:
|
||||
return _tr("敌%d", "E%d") % (enemy_index + 1)
|
||||
return _tr("来源", "SOURCE") if source else _tr("目标", "TARGET")
|
||||
|
||||
@@ -26,12 +26,41 @@ const PROXY_BAND_ENEMY := [0.10, 0.34]
|
||||
const SHARED_TEXT_TOKEN := "micro"
|
||||
const RESOLVED_DELTA_NAME := "resolved-delta"
|
||||
|
||||
# M110 v002: active fixed-slot contract (approved/v002/text-slots.json) plus the
|
||||
# engine-owned dynamic placement policy for BattleLiveEventDetail.
|
||||
const HUD_FIXED_SLOTS := {
|
||||
"BattleLiveTitle": {"slot_id": "encounter_identity", "norm": [0.025, 0.145, 0.31, 0.030]},
|
||||
"BattleLiveEventState": {"slot_id": "current_event_state", "norm": [0.370, 0.140, 0.26, 0.040]},
|
||||
"BattleLiveRecentEvents": {"slot_id": "recent_event_sequence", "norm": [0.170, 0.760, 0.550, 0.040]},
|
||||
}
|
||||
const HUD_RULE_SUBSLOTS := {
|
||||
"BattleLiveNoRespawn": {"slot_id": "encounter_rule_A", "norm": [0.025, 0.220, 0.14875, 0.035]},
|
||||
"BattleLiveNoReserve": {"slot_id": "encounter_rule_B", "norm": [0.18625, 0.220, 0.14875, 0.035]},
|
||||
}
|
||||
const HUD_RULE_BAND := [0.025, 0.220, 0.31, 0.035]
|
||||
const DESIGN_SIZE := Vector2(1280.0, 720.0)
|
||||
const SLOT_TOLERANCE_PX := 2.0
|
||||
const RELATION_CORRIDOR := Rect2(0.440, 0.280, 0.220, 0.420)
|
||||
const RELATION_MIN_CLEARANCE_PX := 4.0
|
||||
const RELATION_FALLBACK_SOURCE_PX := Vector2(0.47 * 1280.0, 0.56 * 720.0)
|
||||
const RELATION_FALLBACK_TARGET_PX := Vector2(0.67 * 1280.0, 0.56 * 720.0)
|
||||
const CONTRAST_MIN := 4.5
|
||||
const LONGEST_SHIPPED := {
|
||||
"BattleLiveTitle": {"zh": "风镜初渡 · 自动", "en": "WINDGLASS · AUTO"},
|
||||
"BattleLiveNoRespawn": {"zh": "无复活", "en": "NO RESPAWN"},
|
||||
"BattleLiveNoReserve": {"zh": "无后备", "en": "NO RESERVE"},
|
||||
"BattleLiveEventState": {"zh": "正在验证快照", "en": "OBSERVATION INTERRUPTED"},
|
||||
"BattleLiveRecentEvents": {"zh": "敌方威胁已公开 · 决定性伤害改变结果", "en": "Enemy threat revealed · Decisive damage changed the outcome"},
|
||||
"BattleLiveEventDetail": {"zh": "敌12 → 0号 · -33", "en": "E12 -> P0 · -33"},
|
||||
}
|
||||
|
||||
var failures: Array[String] = []
|
||||
var capture_count := 0
|
||||
var output_root := ""
|
||||
var viewport_size := Vector2i(1280, 720)
|
||||
var fixture_index := 0
|
||||
var locale := "en"
|
||||
var text_scale := 1.0
|
||||
var reference_viewport := false
|
||||
var state_records: Array = []
|
||||
var evidence_records: Array = []
|
||||
@@ -40,6 +69,9 @@ var non_opening_kind := ""
|
||||
var non_opening_phase := -1
|
||||
var action_event_id := ""
|
||||
var waiting_copy := ""
|
||||
var hud_gate_failures: Array[String] = []
|
||||
var hud_gate_cache := {}
|
||||
var relation_summary_cache := {}
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
@@ -49,10 +81,12 @@ func _initialize() -> void:
|
||||
func run_capture() -> void:
|
||||
fixture_index = int(OS.get_environment("ABG_CAPTURE_FIXTURE_INDEX"))
|
||||
var fixtures := [
|
||||
{"size": Vector2i(760, 360), "locale": "zh_CN"},
|
||||
{"size": Vector2i(844, 390), "locale": "en"},
|
||||
{"size": Vector2i(1280, 720), "locale": "zh_CN"},
|
||||
{"size": Vector2i(1280, 720), "locale": "en"},
|
||||
{"size": Vector2i(760, 360), "locale": "zh_CN", "scale": 1.0},
|
||||
{"size": Vector2i(844, 390), "locale": "en", "scale": 1.0},
|
||||
{"size": Vector2i(1280, 720), "locale": "zh_CN", "scale": 1.0},
|
||||
{"size": Vector2i(1280, 720), "locale": "en", "scale": 1.0},
|
||||
{"size": Vector2i(1280, 720), "locale": "zh_CN", "scale": 1.3},
|
||||
{"size": Vector2i(1280, 720), "locale": "en", "scale": 1.3},
|
||||
]
|
||||
if fixture_index < 0 or fixture_index >= fixtures.size():
|
||||
push_error("unknown BAT-002 live capture fixture %d" % fixture_index)
|
||||
@@ -60,6 +94,7 @@ func run_capture() -> void:
|
||||
return
|
||||
viewport_size = fixtures[fixture_index].size
|
||||
locale = fixtures[fixture_index].locale
|
||||
text_scale = float(fixtures[fixture_index].scale)
|
||||
reference_viewport = viewport_size == Vector2i(1280, 720)
|
||||
root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
|
||||
root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_EXPAND
|
||||
@@ -312,6 +347,7 @@ func run_capture() -> void:
|
||||
|
||||
func _finish() -> void:
|
||||
_cleanup()
|
||||
_evaluate_hud_gates()
|
||||
var manifest_path := _write_manifest()
|
||||
if failures.is_empty():
|
||||
var state_names: Array = []
|
||||
@@ -321,10 +357,14 @@ func _finish() -> void:
|
||||
var proof := Dictionary(capture_by_name.get(RESOLVED_DELTA_NAME, {}))
|
||||
var text_summary := _text_minimum_summary()
|
||||
var scale_summary := _actor_scale_summary()
|
||||
var hud := _hud_gate_summary()
|
||||
var relation := _relation_path_summary()
|
||||
var packet_status := "COMPLETE" if failures.is_empty() else "INCOMPLETE"
|
||||
print("ABG_DEV5_BATTLE_LIVE_CAPTURE_OK fixture=%d viewport=%dx%d locale=%s text_100=true states=%s state_captures=%d views=%d captures=%d source=runtime" % [fixture_index, viewport_size.x, viewport_size.y, locale, ",".join(state_names), state_records.size(), evidence_records.size(), capture_count])
|
||||
var scale_pct := int(round(text_scale * 100.0))
|
||||
print("ABG_DEV5_BATTLE_LIVE_CAPTURE_OK fixture=%d viewport=%dx%d locale=%s text_scale_pct=%d text_100=%s states=%s state_captures=%d views=%d captures=%d source=runtime" % [fixture_index, viewport_size.x, viewport_size.y, locale, scale_pct, str(scale_pct == 100), ",".join(state_names), state_records.size(), evidence_records.size(), capture_count])
|
||||
print("ABG_M107_BAT002_CAPTURE_MANIFEST_OK fixture=%d viewport=%dx%d locale=%s opening=phase0 action_kind=%s action_phase=%d states=%d views=%d manifest=%s" % [fixture_index, viewport_size.x, viewport_size.y, locale, non_opening_kind, non_opening_phase, state_records.size(), evidence_records.size(), manifest_path.get_file()])
|
||||
print("ABG_M109_BAT002_EVIDENCE_SEMANTICS_OK fixture=%d viewport=%dx%d locale=%s schema=m109.bat002.capture_manifest.v3 packet=%s resolved_delta=%s event=%s amount=%d direction=%s delta_text=%s placeholder_amount0=%s text_status=%s text_min_observed=%d scale_status=%s scale_proxy_all_pass=%s product_claim=false manifest=%s" % [fixture_index, viewport_size.x, viewport_size.y, locale, packet_status, _delta_proof_status(), String(proof.get("event_kind", "")), int(proof.get("amount", 0)), String(proof.get("state_delta_direction", "none")), String(proof.get("delta_text", "")), str(int(Dictionary(capture_by_name.get("05-resolved", {})).get("amount", -1)) == 0), String(text_summary.get("status", "NOT_PROVEN")), int(text_summary.get("minimum_observed_font_size", -1)), String(scale_summary.get("status", "NOT_PROVEN")), str(bool(scale_summary.get("all_proxy_pass", false))), manifest_path.get_file()])
|
||||
print("ABG_M109_BAT002_EVIDENCE_SEMANTICS_OK fixture=%d viewport=%dx%d locale=%s schema=m110.bat002.capture_manifest.v4 packet=%s resolved_delta=%s event=%s amount=%d direction=%s delta_text=%s placeholder_amount0=%s text_status=%s text_min_observed=%d text_token_px=%d scale_status=%s scale_proxy_all_pass=%s product_claim=false manifest=%s" % [fixture_index, viewport_size.x, viewport_size.y, locale, packet_status, _delta_proof_status(), String(proof.get("event_kind", "")), int(proof.get("amount", 0)), String(proof.get("state_delta_direction", "none")), String(proof.get("delta_text", "")), str(int(Dictionary(capture_by_name.get("05-resolved", {})).get("amount", -1)) == 0), String(text_summary.get("status", "NOT_PROVEN")), int(text_summary.get("minimum_observed_font_size", -1)), int(text_summary.get("shared_minimum_px", 0)), String(scale_summary.get("status", "NOT_PROVEN")), str(bool(scale_summary.get("all_proxy_pass", false))), manifest_path.get_file()])
|
||||
print("ABG_M110_BATTLE_HUD_LEGIBILITY_OK fixture=%d viewport=%dx%d locale=%s text_scale_pct=%d reference=%s states=%d text_token=micro text_token_px=%d text_min_px=%d under_minimum=%d slot_alignment=%s rule_subslots_disjoint=%s relation_status=%s relation_events=%d fallback_anchor_uses=%d composition_variants=1 second_layout=false" % [fixture_index, viewport_size.x, viewport_size.y, locale, scale_pct, str(reference_viewport), state_records.size() + evidence_records.size(), int(text_summary.get("shared_minimum_px", 0)), int(text_summary.get("minimum_observed_font_size", -1)), int(text_summary.get("states_with_under_minimum", 0)), String(hud.get("slot_alignment", "FAIL")), str(bool(hud.get("rule_subslots_disjoint", false))), String(relation.get("status", "NOT_PROVEN")), int(relation.get("relation_events", 0)), int(relation.get("fallback_anchor_uses", 0))])
|
||||
quit(0)
|
||||
else:
|
||||
for failure in failures:
|
||||
@@ -332,6 +372,32 @@ func _finish() -> void:
|
||||
quit(1)
|
||||
|
||||
|
||||
func _evaluate_hud_gates() -> void:
|
||||
# M110 A1-A3 machine gates. A1/A2/A3 gate the reference viewports only; the
|
||||
# smoke fixtures keep the same measurements recorded without product claims.
|
||||
var text_summary := _text_minimum_summary()
|
||||
if reference_viewport:
|
||||
if int(text_summary.get("states_with_under_minimum", 0)) > 0:
|
||||
failures.append("A1: %d captured states contain visible type below the %dpx applicable token" % [int(text_summary.get("states_with_under_minimum", 0)), _shared_text_minimum()])
|
||||
elif String(text_summary.get("status", "")) != "PASS_MEASURED":
|
||||
failures.append("A1: reference text census did not reach PASS_MEASURED")
|
||||
var hud := _hud_gate_summary()
|
||||
if String(hud.get("slot_alignment", "FAIL")) != "PASS":
|
||||
failures.append("A2: v002 slot alignment failed: %s" % str(hud.get("slot_alignment_failures", [])))
|
||||
if not bool(hud.get("rule_subslots_disjoint", false)):
|
||||
failures.append("A2: encounter_rule subslots are not disjoint")
|
||||
var relation := _relation_path_summary()
|
||||
if reference_viewport:
|
||||
if String(relation.get("status", "NOT_PROVEN")) != "PRESENT":
|
||||
failures.append("A3: relation path measurement is %s" % String(relation.get("status", "NOT_PROVEN")))
|
||||
if int(relation.get("fallback_anchor_uses", 0)) != 0:
|
||||
failures.append("A3: %d authored events still resolved to fallback anchors" % int(relation.get("fallback_anchor_uses", 0)))
|
||||
if int(relation.get("bridge_relation_events", 0)) < 1:
|
||||
failures.append("A3: no bridge-authored event resolved its relation path")
|
||||
if not bool(relation.get("proof_present", false)):
|
||||
failures.append("A3: the proof event relation path is not PRESENT")
|
||||
|
||||
|
||||
func _delta_proof_status() -> String:
|
||||
return String(_delta_proof_evaluation().get("status", "NOT_PROVEN"))
|
||||
|
||||
@@ -391,7 +457,7 @@ func _write_manifest() -> String:
|
||||
var resolved := Dictionary(capture_by_name.get("05-resolved", {}))
|
||||
var proof := Dictionary(capture_by_name.get(RESOLVED_DELTA_NAME, {}))
|
||||
var manifest := {
|
||||
"schema": "m109.bat002.capture_manifest.v3",
|
||||
"schema": "m110.bat002.capture_manifest.v4",
|
||||
"source": "runtime",
|
||||
"packet_status": "COMPLETE" if failures.is_empty() else "INCOMPLETE",
|
||||
"packet_failures": failures.size(),
|
||||
@@ -437,6 +503,12 @@ func _write_manifest() -> String:
|
||||
},
|
||||
"resolved_delta_proof": _resolved_delta_proof_record(proof),
|
||||
"text_minimum": _text_minimum_summary(),
|
||||
"text_scale": text_scale,
|
||||
"text_token_px": _shared_text_minimum(),
|
||||
"under_minimum": int(_text_minimum_summary().get("states_with_under_minimum", 0)),
|
||||
"hud_legibility": _hud_legibility_record(),
|
||||
"relation_path_summary": _relation_path_summary(),
|
||||
"path_contrast_measurement": _path_contrast_record(),
|
||||
"actor_scale_proxy": _actor_scale_summary(),
|
||||
"product_findings": _product_findings(),
|
||||
"ownership_deltas_measured": _ownership_delta_pairs(),
|
||||
@@ -566,7 +638,7 @@ func _new_shell(parent: Node) -> Control:
|
||||
var settings := SettingsStore.new().defaults()
|
||||
settings.setup_completed = true
|
||||
settings.locale = locale
|
||||
settings.text_scale = 1.0
|
||||
settings.text_scale = text_scale
|
||||
shell.settings = settings
|
||||
shell.setup_draft = settings.duplicate(true)
|
||||
return shell
|
||||
@@ -576,7 +648,7 @@ func _capture(viewport: SubViewport, shell: Control, state_name: String, role :=
|
||||
_verify_layout(shell, state_name)
|
||||
await RenderingServer.frame_post_draw
|
||||
var image := viewport.get_texture().get_image()
|
||||
var path := output_root.path_join("battle-live-timeline-%dx%d-%s-100-%s.png" % [viewport_size.x, viewport_size.y, locale, state_name])
|
||||
var path := output_root.path_join("battle-live-timeline-%dx%d-%s-%d-%s.png" % [viewport_size.x, viewport_size.y, locale, int(round(text_scale * 100.0)), state_name])
|
||||
if image.is_empty() or image.get_width() != viewport_size.x or image.get_height() != viewport_size.y:
|
||||
failures.append("invalid capture image for %s" % state_name)
|
||||
return {}
|
||||
@@ -592,6 +664,7 @@ func _capture(viewport: SubViewport, shell: Control, state_name: String, role :=
|
||||
"event_kind": String(shell.battle_live_event.get("kind", "")),
|
||||
"file": path.get_file(),
|
||||
"sha256": _file_sha256(path),
|
||||
"path_contrast": _path_contrast(image, shell),
|
||||
}
|
||||
record.merge(_state_evidence(shell), true)
|
||||
record.merge(extra, true)
|
||||
@@ -626,6 +699,7 @@ func _state_evidence(shell: Control) -> Dictionary:
|
||||
"delta_font_color": _color_hex(delta.get_theme_color("font_color")) if delta != null else "",
|
||||
"ownership": _ownership_fields(shell),
|
||||
"visible_text_census": _visible_text_census(shell),
|
||||
"hud_measurements": _hud_measurements(shell),
|
||||
"actor_scale_proxy": _actor_scale_proxy(shell),
|
||||
}
|
||||
|
||||
@@ -665,6 +739,506 @@ func _measure_label(label: Label, prefix: String, fields: Dictionary) -> void:
|
||||
fields["%s.rect" % prefix] = _rect_values(label)
|
||||
|
||||
|
||||
func _rect_array(rect: Rect2) -> Array:
|
||||
return [_rounded(rect.position.x), _rounded(rect.position.y), _rounded(rect.size.x), _rounded(rect.size.y)]
|
||||
|
||||
|
||||
func _normalized_array(rect: Rect2) -> Array:
|
||||
return [
|
||||
_rounded_fraction(rect.position.x / DESIGN_SIZE.x),
|
||||
_rounded_fraction(rect.position.y / DESIGN_SIZE.y),
|
||||
_rounded_fraction(rect.size.x / DESIGN_SIZE.x),
|
||||
_rounded_fraction(rect.size.y / DESIGN_SIZE.y),
|
||||
]
|
||||
|
||||
|
||||
func _design_slot(norm: Array) -> Rect2:
|
||||
return Rect2(
|
||||
float(norm[0]) * DESIGN_SIZE.x,
|
||||
float(norm[1]) * DESIGN_SIZE.y,
|
||||
float(norm[2]) * DESIGN_SIZE.x,
|
||||
float(norm[3]) * DESIGN_SIZE.y
|
||||
)
|
||||
|
||||
|
||||
func _design_scale(canvas: Control) -> Vector2:
|
||||
if canvas == null or canvas.size.x <= 0.0 or canvas.size.y <= 0.0:
|
||||
return Vector2.ONE
|
||||
return DESIGN_SIZE / canvas.size
|
||||
|
||||
|
||||
func _design_rect(control: Control, canvas: Control) -> Rect2:
|
||||
var global := control.get_global_rect()
|
||||
if canvas == null:
|
||||
return global
|
||||
var local := global.position - canvas.get_global_rect().position
|
||||
return Rect2(local * _design_scale(canvas), global.size * _design_scale(canvas))
|
||||
|
||||
|
||||
func _label_ink_size(label: Label, rect: Rect2) -> Vector2:
|
||||
var font := label.get_theme_font("font")
|
||||
if font == null or label.text.is_empty():
|
||||
return Vector2.ZERO
|
||||
var font_size := int(label.get_theme_font_size("font_size"))
|
||||
if label.autowrap_mode == TextServer.AUTOWRAP_OFF:
|
||||
return font.get_string_size(label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size)
|
||||
return font.get_multiline_string_size(label.text, HORIZONTAL_ALIGNMENT_LEFT, rect.size.x, font_size)
|
||||
|
||||
|
||||
func _ink_box_for(label: Label, rect: Rect2, ink: Vector2) -> Rect2:
|
||||
if ink == Vector2.ZERO:
|
||||
return rect
|
||||
var x := rect.position.x
|
||||
match label.horizontal_alignment:
|
||||
HORIZONTAL_ALIGNMENT_CENTER: x = rect.position.x + (rect.size.x - ink.x) * 0.5
|
||||
HORIZONTAL_ALIGNMENT_RIGHT: x = rect.end.x - ink.x
|
||||
var y := rect.position.y
|
||||
match label.vertical_alignment:
|
||||
VERTICAL_ALIGNMENT_CENTER: y = rect.position.y + (rect.size.y - ink.y) * 0.5
|
||||
VERTICAL_ALIGNMENT_BOTTOM: y = rect.end.y - ink.y
|
||||
return Rect2(Vector2(x, y), ink)
|
||||
|
||||
|
||||
func _design_ink_box(label: Label, canvas: Control) -> Rect2:
|
||||
var rect := label.get_global_rect()
|
||||
var ink := _label_ink_size(label, rect)
|
||||
var box := _ink_box_for(label, rect, ink)
|
||||
var canvas_origin := canvas.get_global_rect().position if canvas != null else Vector2.ZERO
|
||||
return Rect2((box.position - canvas_origin) * _design_scale(canvas), box.size * _design_scale(canvas))
|
||||
|
||||
|
||||
func _label_ink_margins(label: Label, rect: Rect2, ink: Vector2) -> Array:
|
||||
var margin_x := 0.0 if rect.size.x <= 0.0 else 1.0 - ink.x / rect.size.x
|
||||
var margin_y := 0.0 if rect.size.y <= 0.0 else 1.0 - ink.y / rect.size.y
|
||||
return [snappedf(margin_x, 0.0001), snappedf(margin_y, 0.0001)]
|
||||
|
||||
|
||||
func _hud_node_record(shell: Control, canvas: Control, node_name: String, slot_id: String, slot_norm: Array) -> Dictionary:
|
||||
var label := shell.find_child(node_name, true, false) as Label
|
||||
var record := {"node": node_name, "authored_slot_id": slot_id, "exists": label != null, "measurement_status": "NOT_PROVEN"}
|
||||
if label == null:
|
||||
return record
|
||||
var rect := label.get_global_rect()
|
||||
var design_rect := _design_rect(label, canvas)
|
||||
var slot := _design_slot(slot_norm)
|
||||
var corner_delta := [
|
||||
absf(design_rect.position.x - slot.position.x),
|
||||
absf(design_rect.position.y - slot.position.y),
|
||||
absf(design_rect.end.x - slot.end.x),
|
||||
absf(design_rect.end.y - slot.end.y),
|
||||
]
|
||||
var delta := corner_delta[0]
|
||||
for value in corner_delta:
|
||||
delta = maxf(delta, float(value))
|
||||
var ink := _label_ink_size(label, rect)
|
||||
var ink_box := _ink_box_for(label, rect, ink)
|
||||
var design_ink := Rect2((ink_box.position - canvas.get_global_rect().position) * _design_scale(canvas), ink_box.size * _design_scale(canvas))
|
||||
var margins := _label_ink_margins(label, rect, ink)
|
||||
var ellipsized := label.text_overrun_behavior != TextServer.OVERRUN_NO_TRIMMING and ink.x > rect.size.x + 0.5
|
||||
record.merge({
|
||||
"visible": label.is_visible_in_tree(),
|
||||
"text": label.text,
|
||||
"font_size_px": int(label.get_theme_font_size("font_size")),
|
||||
"applicable_token_px": _shared_text_minimum(),
|
||||
"owner_rect_px": _rect_array(design_rect),
|
||||
"owner_rect_normalized": _normalized_array(design_rect),
|
||||
"slot_rect_px": _rect_array(slot),
|
||||
"slot_delta_px": _rounded(delta),
|
||||
"ink_box_px": _rect_array(design_ink),
|
||||
"ink_inside_rect": (
|
||||
design_ink.position.x >= design_rect.position.x - 0.5
|
||||
and design_ink.position.y >= design_rect.position.y - 0.5
|
||||
and design_ink.end.x <= design_rect.end.x + 0.5
|
||||
and design_ink.end.y <= design_rect.end.y + 0.5
|
||||
),
|
||||
"ink_margin_ratio_x": margins[0],
|
||||
"ink_margin_ratio_y": margins[1],
|
||||
"lines_used": label.get_line_count(),
|
||||
"visible_lines": label.get_visible_line_count(),
|
||||
"ellipsized": ellipsized,
|
||||
"measurement_status": "MEASURED",
|
||||
}, true)
|
||||
var shipped: Dictionary = LONGEST_SHIPPED.get(node_name, {})
|
||||
var shipped_text := String(shipped.get("zh" if locale == "zh_CN" else "en", ""))
|
||||
if not shipped_text.is_empty():
|
||||
var font := label.get_theme_font("font")
|
||||
var shipped_ink := font.get_string_size(shipped_text, HORIZONTAL_ALIGNMENT_LEFT, -1, int(label.get_theme_font_size("font_size"))) if font != null else Vector2.ZERO
|
||||
var shipped_margins := _label_ink_margins(label, design_rect, shipped_ink)
|
||||
record["longest_shipped_text"] = shipped_text
|
||||
record["longest_shipped_ink_px"] = [_rounded(shipped_ink.x), _rounded(shipped_ink.y)]
|
||||
record["longest_shipped_ink_inside_rect"] = shipped_ink.x <= design_rect.size.x + 0.5 and shipped_ink.y <= design_rect.size.y + 0.5
|
||||
record["longest_shipped_margin_ratio_x"] = shipped_margins[0]
|
||||
record["longest_shipped_margin_ratio_y"] = shipped_margins[1]
|
||||
return record
|
||||
|
||||
|
||||
func _rule_band_record(shell: Control, canvas: Control, nodes: Dictionary) -> Dictionary:
|
||||
var a: Dictionary = Dictionary(nodes.get("BattleLiveNoRespawn", {}))
|
||||
var b: Dictionary = Dictionary(nodes.get("BattleLiveNoReserve", {}))
|
||||
var band := _design_slot(HUD_RULE_BAND)
|
||||
var record := {
|
||||
"exists": bool(a.get("exists", false)) and bool(b.get("exists", false)),
|
||||
"band_rect_px": _rect_array(band),
|
||||
"measurement_status": "NOT_PROVEN",
|
||||
}
|
||||
if not bool(record.exists):
|
||||
return record
|
||||
var ra := Rect2(a.owner_rect_px[0], a.owner_rect_px[1], a.owner_rect_px[2], a.owner_rect_px[3])
|
||||
var rb := Rect2(b.owner_rect_px[0], b.owner_rect_px[1], b.owner_rect_px[2], b.owner_rect_px[3])
|
||||
var union := ra.merge(rb)
|
||||
var union_delta := maxf(maxf(absf(union.position.x - band.position.x), absf(union.position.y - band.position.y)), maxf(absf(union.end.x - band.end.x), absf(union.end.y - band.end.y)))
|
||||
var disjoint := not ra.intersects(rb)
|
||||
var neither_spans := ra.size.x < band.size.x - 0.5 and rb.size.x < band.size.x - 0.5
|
||||
var gap := 0.0
|
||||
if disjoint:
|
||||
gap = maxf(ra.position.x - rb.end.x, rb.position.x - ra.end.x)
|
||||
record.merge({
|
||||
"subslot_a_rect_px": _rect_array(ra),
|
||||
"subslot_b_rect_px": _rect_array(rb),
|
||||
"subslot_a_rect_normalized": a.owner_rect_normalized,
|
||||
"subslot_b_rect_normalized": b.owner_rect_normalized,
|
||||
"union_rect_px": _rect_array(union),
|
||||
"band_union_delta_px": _rounded(union_delta),
|
||||
"disjoint": disjoint,
|
||||
"subslot_gap_px": _rounded(gap),
|
||||
"neither_spans_band": neither_spans,
|
||||
"measurement_status": "MEASURED",
|
||||
}, true)
|
||||
return record
|
||||
|
||||
|
||||
func _relation_label_record(shell: Control, canvas: Control) -> Dictionary:
|
||||
var label := shell.find_child("BattleLiveEventDetail", true, false) as Label
|
||||
var record := {"exists": label != null, "measurement_status": "NOT_PROVEN"}
|
||||
if label == null:
|
||||
return record
|
||||
var design_rect := _design_rect(label, canvas)
|
||||
var design_ink := _design_ink_box(label, canvas)
|
||||
var corridor := Rect2(RELATION_CORRIDOR.position * DESIGN_SIZE, RELATION_CORRIDOR.size * DESIGN_SIZE)
|
||||
record.merge({
|
||||
"visible": label.is_visible_in_tree(),
|
||||
"text": label.text,
|
||||
"placement_id": String(label.get_meta("relation_placement_id", "")),
|
||||
"rect_px": _rect_array(design_rect),
|
||||
"rect_normalized": _normalized_array(design_rect),
|
||||
"clearance_px": _rounded(float(label.get_meta("relation_clearance_px", -1.0))),
|
||||
"lines": int(label.get_meta("relation_lines", 0)),
|
||||
"token_px": int(label.get_meta("relation_token_px", 0)),
|
||||
"ink_box_px": _rect_array(design_ink),
|
||||
"center_in_corridor": corridor.has_point(design_rect.get_center()),
|
||||
"ink_inside_corridor": (
|
||||
design_ink.position.x >= corridor.position.x - 0.5
|
||||
and design_ink.position.y >= corridor.position.y - 0.5
|
||||
and design_ink.end.x <= corridor.end.x + 0.5
|
||||
and design_ink.end.y <= corridor.end.y + 0.5
|
||||
),
|
||||
"corridor_rect_px": _rect_array(corridor),
|
||||
"measurement_status": "MEASURED",
|
||||
}, true)
|
||||
return record
|
||||
|
||||
|
||||
func _hud_measurements(shell: Control) -> Dictionary:
|
||||
var canvas := shell.find_child("BattleLiveCanvas", true, false) as Control
|
||||
var nodes := {}
|
||||
for node_name in HUD_FIXED_SLOTS.keys():
|
||||
var spec: Dictionary = HUD_FIXED_SLOTS[node_name]
|
||||
nodes[node_name] = _hud_node_record(shell, canvas, node_name, String(spec.slot_id), spec.norm)
|
||||
for node_name in HUD_RULE_SUBSLOTS.keys():
|
||||
var spec: Dictionary = HUD_RULE_SUBSLOTS[node_name]
|
||||
nodes[node_name] = _hud_node_record(shell, canvas, node_name, String(spec.slot_id), spec.norm)
|
||||
return {
|
||||
"nodes": nodes,
|
||||
"rule_band": _rule_band_record(shell, canvas, nodes),
|
||||
"relation_label": _relation_label_record(shell, canvas),
|
||||
}
|
||||
|
||||
|
||||
func _hud_gate_summary() -> Dictionary:
|
||||
if not hud_gate_cache.is_empty():
|
||||
return hud_gate_cache
|
||||
var alignment_failures: Array = []
|
||||
var disjoint := true
|
||||
var disjoint_seen := false
|
||||
var relation_non_omitted := 0
|
||||
var relation_omitted := 0
|
||||
var max_lines := 2 if text_scale > 1.15 else 1
|
||||
for name_value in capture_by_name.keys():
|
||||
var record: Dictionary = capture_by_name[name_value]
|
||||
var hud: Dictionary = record.get("hud_measurements", {})
|
||||
if hud.is_empty():
|
||||
continue
|
||||
var nodes: Dictionary = hud.get("nodes", {})
|
||||
var capture_label := String(record.get("name", name_value))
|
||||
for node_name in HUD_FIXED_SLOTS.keys():
|
||||
var node: Dictionary = Dictionary(nodes.get(node_name, {}))
|
||||
_check_hud_node(capture_label, node, max_lines, alignment_failures)
|
||||
for node_name in HUD_RULE_SUBSLOTS.keys():
|
||||
var node: Dictionary = Dictionary(nodes.get(node_name, {}))
|
||||
_check_hud_node(capture_label, node, max_lines, alignment_failures)
|
||||
var rule: Dictionary = hud.get("rule_band", {})
|
||||
if bool(rule.get("exists", false)):
|
||||
disjoint_seen = true
|
||||
if not bool(rule.get("disjoint", false)) or not bool(rule.get("neither_spans_band", false)):
|
||||
disjoint = false
|
||||
alignment_failures.append("%s rule subslots not disjoint or full-band" % capture_label)
|
||||
if float(rule.get("band_union_delta_px", 99.0)) > SLOT_TOLERANCE_PX:
|
||||
alignment_failures.append("%s rule union delta %.1fpx" % [capture_label, float(rule.get("band_union_delta_px", 99.0))])
|
||||
var relation: Dictionary = hud.get("relation_label", {})
|
||||
if bool(relation.get("visible", false)):
|
||||
var placement := String(relation.get("placement_id", ""))
|
||||
if placement.is_empty() or placement == "omitted_crowded":
|
||||
relation_omitted += 1
|
||||
alignment_failures.append("%s relation copy omitted (%s)" % [capture_label, placement])
|
||||
else:
|
||||
relation_non_omitted += 1
|
||||
if float(relation.get("clearance_px", -99.0)) < RELATION_MIN_CLEARANCE_PX:
|
||||
alignment_failures.append("%s relation clearance %.1fpx" % [capture_label, float(relation.get("clearance_px", -99.0))])
|
||||
if int(relation.get("token_px", 0)) != _shared_text_minimum():
|
||||
alignment_failures.append("%s relation token %d != %d" % [capture_label, int(relation.get("token_px", 0)), _shared_text_minimum()])
|
||||
if int(relation.get("lines", 0)) > max_lines:
|
||||
alignment_failures.append("%s relation lines %d > %d" % [capture_label, int(relation.get("lines", 0)), max_lines])
|
||||
if not bool(relation.get("center_in_corridor", false)) or not bool(relation.get("ink_inside_corridor", false)):
|
||||
alignment_failures.append("%s relation copy outside the authored corridor" % capture_label)
|
||||
hud_gate_cache = {
|
||||
"slot_alignment": "PASS" if alignment_failures.is_empty() else "FAIL",
|
||||
"slot_alignment_failures": alignment_failures,
|
||||
"rule_subslots_disjoint": disjoint_seen and disjoint,
|
||||
"relation_non_omitted_measurements": relation_non_omitted,
|
||||
"relation_omitted_measurements": relation_omitted,
|
||||
"slot_tolerance_px": SLOT_TOLERANCE_PX,
|
||||
"applicable_token_px": _shared_text_minimum(),
|
||||
"text_scale": text_scale,
|
||||
"reference_viewport": reference_viewport,
|
||||
"product_claim": false,
|
||||
}
|
||||
return hud_gate_cache
|
||||
|
||||
|
||||
func _check_hud_node(capture_label: String, node: Dictionary, max_lines: int, alignment_failures: Array) -> void:
|
||||
var node_name := String(node.get("node", ""))
|
||||
if not bool(node.get("exists", false)):
|
||||
alignment_failures.append("%s %s missing" % [capture_label, node_name])
|
||||
return
|
||||
if float(node.get("slot_delta_px", 99.0)) > SLOT_TOLERANCE_PX:
|
||||
alignment_failures.append("%s %s slot delta %.1fpx" % [capture_label, node_name, float(node.get("slot_delta_px", 99.0))])
|
||||
if int(node.get("font_size_px", 0)) < _shared_text_minimum():
|
||||
alignment_failures.append("%s %s font %dpx below token" % [capture_label, node_name, int(node.get("font_size_px", 0))])
|
||||
if bool(node.get("ellipsized", false)):
|
||||
alignment_failures.append("%s %s ellipsized" % [capture_label, node_name])
|
||||
if int(node.get("lines_used", 0)) > max_lines:
|
||||
alignment_failures.append("%s %s lines %d > %d" % [capture_label, node_name, int(node.get("lines_used", 0)), max_lines])
|
||||
if bool(node.get("visible", false)):
|
||||
if not bool(node.get("ink_inside_rect", false)):
|
||||
alignment_failures.append("%s %s ink outside owner rect" % [capture_label, node_name])
|
||||
if float(node.get("ink_margin_ratio_x", -1.0)) < 0.06 or float(node.get("ink_margin_ratio_y", -1.0)) < 0.06:
|
||||
alignment_failures.append("%s %s ink margin below 6%%" % [capture_label, node_name])
|
||||
if not bool(node.get("longest_shipped_ink_inside_rect", false)):
|
||||
alignment_failures.append("%s %s longest shipped string does not fit" % [capture_label, node_name])
|
||||
if float(node.get("longest_shipped_margin_ratio_x", -1.0)) < 0.06 or float(node.get("longest_shipped_margin_ratio_y", -1.0)) < 0.06:
|
||||
alignment_failures.append("%s %s longest shipped string margin below 6%%" % [capture_label, node_name])
|
||||
|
||||
|
||||
func _relation_path_summary() -> Dictionary:
|
||||
if not relation_summary_cache.is_empty():
|
||||
return relation_summary_cache
|
||||
var relation_events := 0
|
||||
var bridge_events := 0
|
||||
var fallback_uses := 0
|
||||
var proof_present := false
|
||||
var measured_states := 0
|
||||
for name_value in capture_by_name.keys():
|
||||
var record: Dictionary = capture_by_name[name_value]
|
||||
var fields: Dictionary = record.get("ownership", {})
|
||||
var kind := String(record.get("event_kind", ""))
|
||||
var source_id := String(record.get("source_id", ""))
|
||||
var target_id := String(record.get("target_id", ""))
|
||||
var source_side := String(fields.get("art.relation_source_side", ""))
|
||||
var target_side := String(fields.get("art.relation_target_side", ""))
|
||||
var source_anchor: Array = fields.get("art.relation_source_anchor_px", [])
|
||||
var target_anchor: Array = fields.get("art.relation_target_anchor_px", [])
|
||||
if not kind.is_empty():
|
||||
measured_states += 1
|
||||
if not source_side.is_empty() and not target_side.is_empty():
|
||||
relation_events += 1
|
||||
if source_id.begins_with("ally-") or source_id.begins_with("enemy-") or target_id.begins_with("ally-") or target_id.begins_with("enemy-"):
|
||||
bridge_events += 1
|
||||
if not source_id.is_empty() and source_anchor.size() == 2 and absf(float(source_anchor[0]) - RELATION_FALLBACK_SOURCE_PX.x) <= 0.5 and absf(float(source_anchor[1]) - RELATION_FALLBACK_SOURCE_PX.y) <= 0.5:
|
||||
fallback_uses += 1
|
||||
if not target_id.is_empty() and target_anchor.size() == 2 and absf(float(target_anchor[0]) - RELATION_FALLBACK_TARGET_PX.x) <= 0.5 and absf(float(target_anchor[1]) - RELATION_FALLBACK_TARGET_PX.y) <= 0.5:
|
||||
fallback_uses += 1
|
||||
if name_value == RESOLVED_DELTA_NAME and not source_side.is_empty() and not target_side.is_empty():
|
||||
proof_present = true
|
||||
relation_summary_cache = {
|
||||
"status": "PRESENT" if relation_events > 0 else "NOT_PROVEN",
|
||||
"relation_events": relation_events,
|
||||
"bridge_relation_events": bridge_events,
|
||||
"fallback_anchor_uses": fallback_uses,
|
||||
"proof_present": proof_present,
|
||||
"measured_states": measured_states,
|
||||
"fallback_source_anchor_px": [RELATION_FALLBACK_SOURCE_PX.x, RELATION_FALLBACK_SOURCE_PX.y],
|
||||
"fallback_target_anchor_px": [RELATION_FALLBACK_TARGET_PX.x, RELATION_FALLBACK_TARGET_PX.y],
|
||||
}
|
||||
return relation_summary_cache
|
||||
|
||||
|
||||
func _hud_legibility_record() -> Dictionary:
|
||||
var reference_capture := Dictionary(capture_by_name.get(RESOLVED_DELTA_NAME, {}))
|
||||
if reference_capture.is_empty():
|
||||
reference_capture = Dictionary(capture_by_name.get("05-resolved", {}))
|
||||
var measurements: Dictionary = reference_capture.get("hud_measurements", {})
|
||||
return {
|
||||
"gate": _hud_gate_summary(),
|
||||
"measured_nodes": measurements.get("nodes", {}),
|
||||
"rule_band": measurements.get("rule_band", {}),
|
||||
"relation_label": measurements.get("relation_label", {}),
|
||||
"reference_capture": String(reference_capture.get("name", "")),
|
||||
"longest_shipped_source": "runtime/tests/dev5/battle_live_capture_test.gd LONGEST_SHIPPED",
|
||||
}
|
||||
|
||||
|
||||
func _path_contrast_record() -> Dictionary:
|
||||
var per_capture: Array = []
|
||||
var worst := 999.0
|
||||
var status := "NOT_PROVEN"
|
||||
for name_value in capture_by_name.keys():
|
||||
var record: Dictionary = capture_by_name[name_value]
|
||||
var contrast: Dictionary = record.get("path_contrast", {})
|
||||
if contrast.is_empty() or String(contrast.get("status", "")) == "NOT_APPLICABLE":
|
||||
continue
|
||||
per_capture.append({
|
||||
"capture": String(record.get("name", name_value)),
|
||||
"status": String(contrast.get("status", "")),
|
||||
"worst_ratio": float(contrast.get("worst_ratio", 0.0)),
|
||||
"core_ratio": float(contrast.get("core_ratio", 0.0)),
|
||||
"source_marker_ratio": float(contrast.get("source_marker_ratio", 0.0)),
|
||||
"target_marker_ratio": float(contrast.get("target_marker_ratio", 0.0)),
|
||||
"stroke": String(contrast.get("stroke", "")),
|
||||
})
|
||||
worst = minf(worst, float(contrast.get("worst_ratio", 0.0)))
|
||||
if per_capture.is_empty():
|
||||
return {"status": "NOT_PROVEN", "reason": "no captured state draws the relation path", "contrast_min": CONTRAST_MIN}
|
||||
status = "MET" if worst >= CONTRAST_MIN else "NOT_MET"
|
||||
return {
|
||||
"status": status,
|
||||
"worst_ratio": snappedf(worst, 0.01),
|
||||
"contrast_min": CONTRAST_MIN,
|
||||
"method": "M84-D P95 carrier around the rendered stroke/markers, stroke pixels excluded; measure-and-record only in this packet",
|
||||
"per_capture": per_capture,
|
||||
}
|
||||
|
||||
|
||||
func _event_color_for(kind: String) -> Color:
|
||||
match kind:
|
||||
"healing": return Color("#70c59b", 0.96)
|
||||
"guard", "guarded_recovery": return Color("#73b8dc", 0.96)
|
||||
"magic": return Color("#b58bd6", 0.96)
|
||||
"knockout": return Color("#e16c67", 0.98)
|
||||
"result": return Color("#dfbd68", 0.98)
|
||||
return Color("#e2b75f", 0.96)
|
||||
|
||||
|
||||
func _luminance(color: Color) -> float:
|
||||
var linear: Array = []
|
||||
for value in [color.r, color.g, color.b]:
|
||||
linear.append(value / 12.92 if value <= 0.03928 else pow((value + 0.055) / 1.055, 2.4))
|
||||
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2]
|
||||
|
||||
|
||||
func _contrast_ratio(left: Color, right: Color) -> float:
|
||||
var lighter := maxf(_luminance(left), _luminance(right))
|
||||
var darker := minf(_luminance(left), _luminance(right))
|
||||
return (lighter + 0.05) / (darker + 0.05)
|
||||
|
||||
|
||||
func _carrier_p95(samples: Array) -> Color:
|
||||
if samples.is_empty():
|
||||
return Color.BLACK
|
||||
samples.sort_custom(func(a, b): return _luminance(a) < _luminance(b))
|
||||
return samples[mini(samples.size() - 1, int(float(samples.size() - 1) * 0.95))]
|
||||
|
||||
|
||||
func _is_stroke_pixel(color: Color, stroke: Color) -> bool:
|
||||
return absf(color.r - stroke.r) + absf(color.g - stroke.g) + absf(color.b - stroke.b) < 0.24
|
||||
|
||||
|
||||
func _band_carrier_p95(image: Image, points: Array, stroke: Color, pad: float) -> Color:
|
||||
if points.is_empty():
|
||||
return Color.BLACK
|
||||
var bounds := Rect2(points[0], Vector2.ZERO)
|
||||
for point_value in points:
|
||||
bounds = bounds.expand(point_value)
|
||||
bounds = bounds.grow(pad)
|
||||
var samples: Array = []
|
||||
var x0 := clampi(int(bounds.position.x), 0, image.get_width() - 1)
|
||||
var x1 := clampi(int(bounds.end.x), 0, image.get_width() - 1)
|
||||
var y0 := clampi(int(bounds.position.y), 0, image.get_height() - 1)
|
||||
var y1 := clampi(int(bounds.end.y), 0, image.get_height() - 1)
|
||||
for x in range(x0, maxi(x0 + 1, x1), 2):
|
||||
for y in range(y0, maxi(y0 + 1, y1), 2):
|
||||
var color := image.get_pixel(x, y)
|
||||
if not _is_stroke_pixel(color, stroke):
|
||||
samples.append(color)
|
||||
return _carrier_p95(samples)
|
||||
|
||||
|
||||
func _annulus_carrier_p95(image: Image, center: Vector2, radius: float, stroke: Color, thickness: float) -> Color:
|
||||
var samples: Array = []
|
||||
var reach := int(ceil(radius + thickness + 2.0))
|
||||
for dx in range(-reach, reach + 1):
|
||||
for dy in range(-reach, reach + 1):
|
||||
var distance := Vector2(float(dx), float(dy)).length()
|
||||
if absf(distance - radius) > thickness:
|
||||
continue
|
||||
var x := clampi(int(center.x) + dx, 0, image.get_width() - 1)
|
||||
var y := clampi(int(center.y) + dy, 0, image.get_height() - 1)
|
||||
var color := image.get_pixel(x, y)
|
||||
if not _is_stroke_pixel(color, stroke):
|
||||
samples.append(color)
|
||||
return _carrier_p95(samples)
|
||||
|
||||
|
||||
func _path_contrast(image: Image, shell: Control) -> Dictionary:
|
||||
var art := shell.find_child("BattleLiveArt", true, false)
|
||||
if art == null or image.is_empty():
|
||||
return {"status": "NOT_PROVEN", "reason": "no art node or image"}
|
||||
var kind := String(art.get("event_kind"))
|
||||
if kind.is_empty() or String(art.get("source_side")).is_empty() or String(art.get("target_side")).is_empty():
|
||||
return {"status": "NOT_APPLICABLE", "reason": "no relation path drawn in this state"}
|
||||
var stroke := _event_color_for(kind)
|
||||
var width := float(image.get_width())
|
||||
var height := float(image.get_height())
|
||||
var source: Vector2 = art.get("source_anchor") * Vector2(width, height)
|
||||
var target: Vector2 = art.get("target_anchor") * Vector2(width, height)
|
||||
var bend := -height * 0.095 if source.x < target.x else height * 0.075
|
||||
var midpoint := (source + target) * 0.5 + Vector2(0.0, bend)
|
||||
var points: Array = []
|
||||
for index in range(21):
|
||||
var t := float(index) / 20.0
|
||||
points.append(source * pow(1.0 - t, 2.0) + midpoint * 2.0 * (1.0 - t) * t + target * pow(t, 2.0))
|
||||
var core_carrier := _band_carrier_p95(image, points, stroke, 6.0)
|
||||
var source_carrier := _annulus_carrier_p95(image, source, width * 0.012, stroke, 3.0)
|
||||
var target_carrier := _annulus_carrier_p95(image, target, width * 0.029, stroke, 3.0)
|
||||
var core_ratio := _contrast_ratio(stroke, core_carrier)
|
||||
var source_ratio := _contrast_ratio(stroke, source_carrier)
|
||||
var target_ratio := _contrast_ratio(stroke, target_carrier)
|
||||
var worst := minf(core_ratio, minf(source_ratio, target_ratio))
|
||||
return {
|
||||
"method": "M84-D P95 carrier around the rendered stroke/markers, stroke pixels excluded",
|
||||
"event_kind": kind,
|
||||
"stroke": stroke.to_html(false),
|
||||
"core_ratio": snappedf(core_ratio, 0.01),
|
||||
"core_carrier_p95": core_carrier.to_html(false),
|
||||
"source_marker_ratio": snappedf(source_ratio, 0.01),
|
||||
"source_carrier_p95": source_carrier.to_html(false),
|
||||
"target_marker_ratio": snappedf(target_ratio, 0.01),
|
||||
"target_carrier_p95": target_carrier.to_html(false),
|
||||
"worst_ratio": snappedf(worst, 0.01),
|
||||
"contrast_min": CONTRAST_MIN,
|
||||
"status": "MET" if worst >= CONTRAST_MIN else "NOT_MET",
|
||||
}
|
||||
|
||||
|
||||
func _ownership_fields(shell: Control) -> Dictionary:
|
||||
# M109-I02: measured node facts only. No self-authored ownership strings.
|
||||
var fields := {}
|
||||
@@ -707,7 +1281,7 @@ func _ownership_fields(shell: Control) -> Dictionary:
|
||||
|
||||
|
||||
func _shared_text_minimum() -> int:
|
||||
return int(UITokens.FONT_SIZES.get(SHARED_TEXT_TOKEN, 11))
|
||||
return int(UITokens.font_size(SHARED_TEXT_TOKEN, text_scale))
|
||||
|
||||
|
||||
func _visible_text_census(shell: Control) -> Dictionary:
|
||||
@@ -864,6 +1438,7 @@ func _text_minimum_summary() -> Dictionary:
|
||||
"status": "SMOKE_RECORDED",
|
||||
"reference_viewport": false,
|
||||
"shared_token": SHARED_TEXT_TOKEN,
|
||||
"text_scale": text_scale,
|
||||
"shared_minimum_px": minimum,
|
||||
"minimum_observed_font_size": minimum_observed,
|
||||
"captured_states": measured_states,
|
||||
@@ -875,6 +1450,7 @@ func _text_minimum_summary() -> Dictionary:
|
||||
"status": "PASS_MEASURED" if under_states == 0 else "NOT_PROVEN",
|
||||
"reference_viewport": true,
|
||||
"shared_token": SHARED_TEXT_TOKEN,
|
||||
"text_scale": text_scale,
|
||||
"shared_minimum_px": minimum,
|
||||
"minimum_observed_font_size": minimum_observed,
|
||||
"captured_states": measured_states,
|
||||
|
||||
Reference in New Issue
Block a user