refactor(ui): tokenize world_map scene colors (p2-74 cluster 3a)
Route inline Color() in world_map/** scene scripts onto ThemeAssets design tokens. Visual-only (Rail 3), no logic change: - arena_overlay: const P0/P1_COLOR -> build()-populated vars from player.blue/ player.orange; title -> accent.gold; turn label -> accent.science - courier_route_overlay: const COLOR_IN_TRANSIT/DELIVERED -> _ready()-populated vars from accent.sage (alpha preserved per state) - tile_info_panel: panel stylebox bg/border -> background.overlay/border.panel; invalid-yield modulate -> semantic.negative; pop count -> accent.sage - world_map: placement-area highlight -> accent.science (alpha preserved) - world_map_units: patrol line + flag labels -> accent.science Computed player-color overlays (arena_playback combat flash) and neutral white fallbacks/resets left as-is — genuinely dynamic, no token applies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ef3c494002
commit
d721d58d04
5 changed files with 32 additions and 20 deletions
|
|
@ -12,11 +12,11 @@ extends RefCounted
|
||||||
|
|
||||||
const ARROW: String = "▶ "
|
const ARROW: String = "▶ "
|
||||||
const DIM_ALPHA: float = 0.42
|
const DIM_ALPHA: float = 0.42
|
||||||
## Player 0 and player 1 label colors. Sourced from GameState.PLAYER_COLORS
|
## Player 0 and player 1 label colors. Token-sourced (ThemeAssets.color isn't
|
||||||
## by index; kept as constants here for fast access and to avoid churn if
|
## const-eval safe), populated in build(). Calm blue / warm orange map to the
|
||||||
## PLAYER_COLORS changes length.
|
## player palette tokens.
|
||||||
const P0_COLOR: Color = Color(0.30, 0.62, 1.00) ## calm blue
|
var _p0_color: Color = Color(0.30, 0.62, 1.00)
|
||||||
const P1_COLOR: Color = Color(1.00, 0.52, 0.28) ## warm orange
|
var _p1_color: Color = Color(1.00, 0.52, 0.28)
|
||||||
|
|
||||||
var _p1_label: Label = null
|
var _p1_label: Label = null
|
||||||
var _p2_label: Label = null
|
var _p2_label: Label = null
|
||||||
|
|
@ -38,6 +38,8 @@ func build(
|
||||||
) -> Label:
|
) -> Label:
|
||||||
_p1_name = p1
|
_p1_name = p1
|
||||||
_p2_name = p2
|
_p2_name = p2
|
||||||
|
_p0_color = ThemeAssets.color("player.blue")
|
||||||
|
_p1_color = ThemeAssets.color("player.orange")
|
||||||
|
|
||||||
var layer: CanvasLayer = CanvasLayer.new()
|
var layer: CanvasLayer = CanvasLayer.new()
|
||||||
layer.name = "ArenaOverlay"
|
layer.name = "ArenaOverlay"
|
||||||
|
|
@ -51,14 +53,14 @@ func build(
|
||||||
|
|
||||||
var title: Label = Label.new()
|
var title: Label = Label.new()
|
||||||
title.text = "%s · seed %d" % [match_id, seed_value]
|
title.text = "%s · seed %d" % [match_id, seed_value]
|
||||||
title.add_theme_color_override("font_color", Color(1.0, 0.85, 0.4))
|
title.add_theme_color_override("font_color", ThemeAssets.color("accent.gold"))
|
||||||
title.add_theme_font_size_override("font_size", 13)
|
title.add_theme_font_size_override("font_size", 13)
|
||||||
|
|
||||||
_p1_label = _make_player_label(p1, P0_COLOR)
|
_p1_label = _make_player_label(p1, _p0_color)
|
||||||
var vs: Label = Label.new()
|
var vs: Label = Label.new()
|
||||||
vs.text = " vs "
|
vs.text = " vs "
|
||||||
vs.add_theme_font_size_override("font_size", 12)
|
vs.add_theme_font_size_override("font_size", 12)
|
||||||
_p2_label = _make_player_label(p2, P1_COLOR)
|
_p2_label = _make_player_label(p2, _p1_color)
|
||||||
|
|
||||||
var versus_row: HBoxContainer = HBoxContainer.new()
|
var versus_row: HBoxContainer = HBoxContainer.new()
|
||||||
versus_row.add_child(_p1_label)
|
versus_row.add_child(_p1_label)
|
||||||
|
|
@ -68,7 +70,7 @@ func build(
|
||||||
_turn_label = Label.new()
|
_turn_label = Label.new()
|
||||||
_turn_label.text = "turn 1 / %d" % turn_limit
|
_turn_label.text = "turn 1 / %d" % turn_limit
|
||||||
_turn_label.add_theme_color_override(
|
_turn_label.add_theme_color_override(
|
||||||
"font_color", Color(0.6, 0.85, 1.0)
|
"font_color", ThemeAssets.color("accent.science")
|
||||||
)
|
)
|
||||||
_turn_label.add_theme_font_size_override("font_size", 11)
|
_turn_label.add_theme_font_size_override("font_size", 11)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,16 @@ extends Node2D
|
||||||
## Data source: EventBus courier diplomacy signals. No polling.
|
## Data source: EventBus courier diplomacy signals. No polling.
|
||||||
|
|
||||||
const HEX_PIXEL_SIZE: float = 64.0
|
const HEX_PIXEL_SIZE: float = 64.0
|
||||||
const COLOR_IN_TRANSIT: Color = Color(0.65, 0.90, 0.65, 0.40)
|
const IN_TRANSIT_ALPHA: float = 0.40
|
||||||
const COLOR_DELIVERED: Color = Color(0.65, 0.90, 0.65, 0.90)
|
const DELIVERED_ALPHA: float = 0.90
|
||||||
const COURIER_ICON_RADIUS: float = 6.0
|
const COURIER_ICON_RADIUS: float = 6.0
|
||||||
const ROUTE_LINE_WIDTH: float = 2.5
|
const ROUTE_LINE_WIDTH: float = 2.5
|
||||||
|
|
||||||
|
## Courier-route green, token-sourced in _ready() (ThemeAssets.color isn't
|
||||||
|
## const-eval safe). Same hue at two alphas: faded in transit, solid delivered.
|
||||||
|
var _color_in_transit: Color = Color(0.65, 0.90, 0.65, IN_TRANSIT_ALPHA)
|
||||||
|
var _color_delivered: Color = Color(0.65, 0.90, 0.65, DELIVERED_ALPHA)
|
||||||
|
|
||||||
## Keyed by agreement_id (int). Each value is a Dictionary with keys:
|
## Keyed by agreement_id (int). Each value is a Dictionary with keys:
|
||||||
## agreement_id, from_player, to_player, from_capital, to_capital,
|
## agreement_id, from_player, to_player, from_capital, to_capital,
|
||||||
## courier_pos (Vector2i), eta_turn (int), delivered (bool), intercepted (bool).
|
## courier_pos (Vector2i), eta_turn (int), delivered (bool), intercepted (bool).
|
||||||
|
|
@ -21,6 +26,9 @@ var _routes: Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var base: Color = ThemeAssets.color("accent.sage")
|
||||||
|
_color_in_transit = Color(base.r, base.g, base.b, IN_TRANSIT_ALPHA)
|
||||||
|
_color_delivered = Color(base.r, base.g, base.b, DELIVERED_ALPHA)
|
||||||
EventBus.courier_dispatched.connect(_on_courier_dispatched)
|
EventBus.courier_dispatched.connect(_on_courier_dispatched)
|
||||||
EventBus.courier_intercepted.connect(_on_courier_intercepted)
|
EventBus.courier_intercepted.connect(_on_courier_intercepted)
|
||||||
EventBus.shared_map_delivered.connect(_on_shared_map_delivered)
|
EventBus.shared_map_delivered.connect(_on_shared_map_delivered)
|
||||||
|
|
@ -86,11 +94,11 @@ func _draw() -> void:
|
||||||
var from_px: Vector2 = _axial_to_pixel(route["from_capital"])
|
var from_px: Vector2 = _axial_to_pixel(route["from_capital"])
|
||||||
var to_px: Vector2 = _axial_to_pixel(route["to_capital"])
|
var to_px: Vector2 = _axial_to_pixel(route["to_capital"])
|
||||||
var delivered: bool = bool(route.get("delivered", false))
|
var delivered: bool = bool(route.get("delivered", false))
|
||||||
var line_color: Color = COLOR_DELIVERED if delivered else COLOR_IN_TRANSIT
|
var line_color: Color = _color_delivered if delivered else _color_in_transit
|
||||||
draw_line(from_px, to_px, line_color, ROUTE_LINE_WIDTH)
|
draw_line(from_px, to_px, line_color, ROUTE_LINE_WIDTH)
|
||||||
if not delivered:
|
if not delivered:
|
||||||
var courier_px: Vector2 = _axial_to_pixel(route["courier_pos"])
|
var courier_px: Vector2 = _axial_to_pixel(route["courier_pos"])
|
||||||
draw_circle(courier_px, COURIER_ICON_RADIUS, COLOR_DELIVERED)
|
draw_circle(courier_px, COURIER_ICON_RADIUS, _color_delivered)
|
||||||
draw_arc(courier_px, COURIER_ICON_RADIUS + 2.0, 0.0, TAU, 16, Color(1, 1, 1, 0.7), 1.5)
|
draw_arc(courier_px, COURIER_ICON_RADIUS + 2.0, 0.0, TAU, 16, Color(1, 1, 1, 0.7), 1.5)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ func _ready() -> void:
|
||||||
|
|
||||||
func _apply_panel_style() -> void:
|
func _apply_panel_style() -> void:
|
||||||
var style: StyleBoxFlat = StyleBoxFlat.new()
|
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||||
style.bg_color = Color(0.02, 0.02, 0.05, 0.92)
|
style.bg_color = ThemeAssets.color("background.overlay")
|
||||||
style.border_color = Color(0.4, 0.35, 0.2, 0.8)
|
style.border_color = ThemeAssets.color("border.panel")
|
||||||
style.set_border_width_all(1)
|
style.set_border_width_all(1)
|
||||||
style.set_corner_radius_all(3)
|
style.set_corner_radius_all(3)
|
||||||
add_theme_stylebox_override("panel", style)
|
add_theme_stylebox_override("panel", style)
|
||||||
|
|
@ -203,7 +203,7 @@ func show_tile_with_placement_preview(
|
||||||
var reason: String = str(preview.get("reason", ""))
|
var reason: String = str(preview.get("reason", ""))
|
||||||
_worked_yield_label.text = ThemeVocabulary.lookup("placement_invalid") % reason
|
_worked_yield_label.text = ThemeVocabulary.lookup("placement_invalid") % reason
|
||||||
_worked_yield_label.visible = true
|
_worked_yield_label.visible = true
|
||||||
_worked_yield_label.modulate = Color(0.85, 0.3, 0.3, 1)
|
_worked_yield_label.modulate = ThemeAssets.color("semantic.negative")
|
||||||
return
|
return
|
||||||
_worked_yield_label.modulate = Color(1, 1, 1, 1)
|
_worked_yield_label.modulate = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
|
|
@ -251,7 +251,7 @@ func _populate_ecology_species(axial: Vector2i) -> void:
|
||||||
pop_lbl.custom_minimum_size.x = 60
|
pop_lbl.custom_minimum_size.x = 60
|
||||||
pop_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
pop_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||||
pop_lbl.add_theme_font_size_override("font_size", 12)
|
pop_lbl.add_theme_font_size_override("font_size", 12)
|
||||||
pop_lbl.add_theme_color_override("font_color", Color(0.7, 0.85, 0.7))
|
pop_lbl.add_theme_color_override("font_color", ThemeAssets.color("accent.sage"))
|
||||||
row.add_child(pop_lbl)
|
row.add_child(pop_lbl)
|
||||||
|
|
||||||
_ecology_list.add_child(row)
|
_ecology_list.add_child(row)
|
||||||
|
|
|
||||||
|
|
@ -1913,7 +1913,8 @@ func _refresh_placement_overlay() -> void:
|
||||||
for v: Vector2 in hex_poly:
|
for v: Vector2 in hex_poly:
|
||||||
shifted.append(origin + v)
|
shifted.append(origin + v)
|
||||||
poly.polygon = shifted
|
poly.polygon = shifted
|
||||||
poly.color = Color(0.6, 0.85, 1.0, 0.22)
|
var hl: Color = ThemeAssets.color("accent.science")
|
||||||
|
poly.color = Color(hl.r, hl.g, hl.b, 0.22)
|
||||||
_placement_overlay_node.add_child(poly)
|
_placement_overlay_node.add_child(poly)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,8 @@ func draw_waypoint_overlay(parent_node: Node2D, waypoints: Array) -> void:
|
||||||
line.name = "PatrolPolyline"
|
line.name = "PatrolPolyline"
|
||||||
line.add_to_group("patrol_overlay")
|
line.add_to_group("patrol_overlay")
|
||||||
line.width = 2.0
|
line.width = 2.0
|
||||||
line.default_color = Color(0.3, 0.6, 1.0, 0.75)
|
var patrol_hl: Color = ThemeAssets.color("accent.science")
|
||||||
|
line.default_color = Color(patrol_hl.r, patrol_hl.g, patrol_hl.b, 0.75)
|
||||||
for wp: Variant in waypoints:
|
for wp: Variant in waypoints:
|
||||||
var pixel: Vector2 = HexUtilsScript.axial_to_pixel(wp as Vector2i)
|
var pixel: Vector2 = HexUtilsScript.axial_to_pixel(wp as Vector2i)
|
||||||
line.add_point(pixel)
|
line.add_point(pixel)
|
||||||
|
|
@ -95,7 +96,7 @@ func draw_waypoint_overlay(parent_node: Node2D, waypoints: Array) -> void:
|
||||||
flag_label.add_to_group("patrol_overlay")
|
flag_label.add_to_group("patrol_overlay")
|
||||||
flag_label.text = str(i + 1)
|
flag_label.text = str(i + 1)
|
||||||
flag_label.add_theme_font_size_override("font_size", 13)
|
flag_label.add_theme_font_size_override("font_size", 13)
|
||||||
flag_label.add_theme_color_override("font_color", Color(0.2, 0.8, 1.0))
|
flag_label.add_theme_color_override("font_color", ThemeAssets.color("accent.science"))
|
||||||
flag_label.position = pixel + Vector2(-6.0, -20.0)
|
flag_label.position = pixel + Vector2(-6.0, -20.0)
|
||||||
parent_node.add_child(flag_label)
|
parent_node.add_child(flag_label)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue