105 lines
4.7 KiB
GDScript
105 lines
4.7 KiB
GDScript
class_name ABGBattleOpeningArt
|
|
extends Control
|
|
|
|
## Engine-drawn rail and relation accents reconstructed from the accepted battle
|
|
## hierarchy. Dynamic copy and entities stay in separate overlay nodes.
|
|
|
|
var threat_visible := true
|
|
var handoff_visible := false
|
|
|
|
|
|
func _ready() -> void:
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
queue_redraw()
|
|
|
|
|
|
func set_state(threat: bool, handoff: bool) -> void:
|
|
threat_visible = threat
|
|
handoff_visible = handoff
|
|
queue_redraw()
|
|
|
|
|
|
func _draw() -> void:
|
|
var width := size.x
|
|
var height := size.y
|
|
if width <= 0.0 or height <= 0.0:
|
|
return
|
|
var top_height := height * 0.145
|
|
var bottom_y := height * 0.82
|
|
var bottom_height := height - bottom_y
|
|
var navy := Color("#101b2a", 0.92)
|
|
var navy_light := Color("#203247", 0.84)
|
|
var gold := Color("#d9af58", 0.94)
|
|
var ivory := Color("#f1e6c8", 0.90)
|
|
var blue := Color("#6cb7e8", 0.90)
|
|
var red := Color("#d65b57", 0.92)
|
|
|
|
# Continuous top and bottom rails keep the field dominant while providing
|
|
# the accepted battle-status hierarchy.
|
|
draw_rect(Rect2(0.0, 0.0, width, top_height), navy)
|
|
draw_line(Vector2(0.0, top_height - 2.0), Vector2(width, top_height - 2.0), gold, 2.0)
|
|
draw_line(Vector2(0.0, top_height - 7.0), Vector2(width, top_height - 7.0), Color(gold, 0.30), 1.0)
|
|
draw_rect(Rect2(0.0, bottom_y, width, bottom_height), Color("#101a28", 0.95))
|
|
draw_line(Vector2(0.0, bottom_y), Vector2(width, bottom_y), gold, 2.0)
|
|
draw_line(Vector2(0.0, bottom_y + 6.0), Vector2(width, bottom_y + 6.0), Color(gold, 0.32), 1.0)
|
|
|
|
# Field-attached objective/rule strips: translucent, narrow and flush with
|
|
# the scene rather than standalone cards.
|
|
draw_style_box(_plate(Color("#16263a", 0.74), Color("#d9af58", 0.72), 2, 5), Rect2(width * 0.03, height * 0.155, width * 0.31, height * 0.23))
|
|
draw_line(Vector2(width * 0.04, height * 0.255), Vector2(width * 0.32, height * 0.255), Color(gold, 0.45), 1.0)
|
|
|
|
# Continuous relation cord and a directional arrow through the enemy gap.
|
|
var cord_y := height * 0.675
|
|
draw_line(Vector2(width * 0.07, cord_y), Vector2(width * 0.54, cord_y), Color("#d7bd79", 0.80), 3.0)
|
|
draw_line(Vector2(width * 0.34, height * 0.61), Vector2(width * 0.59, height * 0.61), Color("#f0d37c", 0.68), 2.0)
|
|
draw_line(Vector2(width * 0.59, height * 0.61), Vector2(width * 0.575, height * 0.60), Color("#f0d37c", 0.68), 2.0)
|
|
draw_line(Vector2(width * 0.59, height * 0.61), Vector2(width * 0.575, height * 0.62), Color("#f0d37c", 0.68), 2.0)
|
|
|
|
# First disclosed threat marker; the beam is intentionally static on BAT-001.
|
|
if threat_visible:
|
|
var center := Vector2(width * 0.595, height * 0.355)
|
|
var diamond := PackedVector2Array([
|
|
center + Vector2(0.0, -height * 0.045),
|
|
center + Vector2(width * 0.022, 0.0),
|
|
center + Vector2(0.0, height * 0.045),
|
|
center + Vector2(-width * 0.022, 0.0),
|
|
])
|
|
draw_colored_polygon(diamond, Color("#e35d5d", 0.90))
|
|
draw_polyline(diamond + PackedVector2Array([diamond[0]]), Color("#ffe8cc", 0.95), 2.0)
|
|
draw_line(Vector2(width * 0.595, height * 0.40), Vector2(width * 0.595, height * 0.57), Color("#ef6a6a", 0.55), 3.0)
|
|
draw_circle(Vector2(width * 0.595, height * 0.57), width * 0.022, Color("#ef6a6a", 0.22))
|
|
|
|
# Rail endcaps and status diamonds echo the accepted reference without
|
|
# baking counts or labels.
|
|
var left_cap := PackedVector2Array([Vector2(0.0, 0.0), Vector2(width * 0.07, 0.0), Vector2(width * 0.07, top_height), Vector2(0.0, top_height)])
|
|
var right_cap := PackedVector2Array([Vector2(width * 0.93, 0.0), Vector2(width, 0.0), Vector2(width, top_height), Vector2(width * 0.93, top_height)])
|
|
draw_colored_polygon(left_cap, Color("#1d3550", 0.88))
|
|
draw_colored_polygon(right_cap, Color("#4b2632", 0.88))
|
|
draw_line(Vector2(width * 0.07, 0.0), Vector2(width * 0.07, top_height), gold, 2.0)
|
|
draw_line(Vector2(width * 0.93, 0.0), Vector2(width * 0.93, top_height), gold, 2.0)
|
|
for index in range(4):
|
|
_draw_diamond(Vector2(width * (0.13 + index * 0.034), height * 0.073), width * 0.008, blue)
|
|
_draw_diamond(Vector2(width * (0.76 + index * 0.034), height * 0.073), width * 0.008, red)
|
|
|
|
if handoff_visible:
|
|
draw_style_box(_plate(Color("#173b49", 0.88), Color("#9ed7aa", 0.95), 2, 5), Rect2(width * 0.36, height * 0.775, width * 0.28, height * 0.055))
|
|
|
|
|
|
func _draw_diamond(center: Vector2, radius: float, color: Color) -> void:
|
|
var points := PackedVector2Array([
|
|
center + Vector2(0.0, -radius),
|
|
center + Vector2(radius, 0.0),
|
|
center + Vector2(0.0, radius),
|
|
center + Vector2(-radius, 0.0),
|
|
])
|
|
draw_colored_polygon(points, color)
|
|
|
|
|
|
func _plate(background: Color, border: Color, width: int, radius: int) -> StyleBoxFlat:
|
|
var style := StyleBoxFlat.new()
|
|
style.bg_color = background
|
|
style.border_color = border
|
|
style.set_border_width_all(width)
|
|
style.set_corner_radius_all(radius)
|
|
return style
|